cancel
Showing results for 
Search instead for 
Did you mean: 

Block of quoted text in Traffic Script

SOLVED
Highlighted
Occasional Contributor

Block of quoted text in Traffic Script

Hi,

Is it possible to mark a block of text to be a comment ? e.g. in PHP you can use /* ..... */  or in python you can use """ commented text goes here  """ again to uncomment the rest of the file ...

Is there something like it in Traffic Script ? It'd make it easier to "disable" certain parts of a script when you're testing ...

Thanks

Alex

2 REPLIES
Frequent Contributor

Re: Block of quoted text in Traffic Script

Hi Alex,

There is no way to do multi-line comments in TrafficScript currently, other than prefixing each line with a '#'.

You could disable a block of code by surrounding it with 'if( 0 ) {' and '}', as I've illustrated below to 'comment out' the latitude test from Content Optimization across Equatorial Boundaries


$ct = http.getResponseHeader( "Content-Type" ); 


if( !string.startsWith( $ct, "text/html" ) ) break; 



if( 0 ) {


$serverlat = geo.getLatitude( request.getLocalIP() ); 


$clientlet = geo.getLatitude( request.getRemoteIP() ); 


if( $serverlat * $clientlat > 0 ) break; 


}



$body = http.getResponseBody();


Hope this helps

Owen

Occasional Contributor

Re: Block of quoted text in Traffic Script

Ok, thanks Owen. And thanks for the tip

Alex