vADC Forum

Reply
Occasional Contributor
Posts: 5
Registered: ‎11-30-2012
Accepted Solution

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

Frequent Contributor
Posts: 321
Registered: ‎11-29-2012

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
Posts: 5
Registered: ‎11-30-2012

Re: Block of quoted text in Traffic Script

Ok, thanks Owen. And thanks for the tip

Alex

Join the Community

Get quick and easy access to valuable resource designed to help you manage your Brocade Network.