This topic is locked

Commenting code

4/13/2009 7:40:41 PM
PHPRunner General questions
R
rgfischerjr author

I have modified several of the templates to suit my on tastes - and with the release of 5.1 I decided to comment out the unecessary sections instead of deleting to make it easier to 'go back' when something didn't work as planned...
For example - if I want to relocate the following block of code:

foreach Fields as @f filter bListPage order nListPageOrder##

{BEGIN ##@f.strName g##_fieldcolumn}

<td align=center valign=top ##if !@last##class=borderbody##endif## {$##@f.strName g##_style}>

{$##@f.strName g##_value}

</td>

{END ##@f.strName g##_fieldcolumn}

endfor##



I would enclose it in <!-- --> ... only the trailing --> is processed and printed to screen.
I've tried using the smarty comment { } with no success....
What is the secret to successfully commenting out the mixed smarty / html code??

J
Jane 4/14/2009

Hi,
here is a sample:

##comment test1

test2

test3##

R
rgfischerjr author 4/17/2009

Hi,

here is a sample:


Jane - sorry to be dense - but this is not working for me.
I want to comment out this section of code so that I can leave it in place in the html and it is not processed by the browser:

if @BUILDER.Registration.bChangePwdPage && @BUILDER.nLoginMethod == SECURITY_TABLE##

{BEGIN changepwd_link}

<span class=buttonborder><input type=button class=button value="##message CHANGE_PASSWORD##" {$changepwdlink_attrs}></span>

{END changepwd_link}

endif##



Adding additional '##' before and after the code block results in a error '{Begin not found'....
Adding <!-- before and --> after the code block results in '-->'
What am I missing?
Thanks!

J
Jane 4/20/2009

I'm not sure that I understand your changes.

You should add ##comment, not ## only.

R
rgfischerjr author 4/20/2009

I'm not sure that I understand your changes.

You should add ##comment, not ## only.


I apologize - I did the following in an unmodified (Madrid) lheader.htm (line 77 approx):
##comment

if @BUILDER.Registration.bChangePwdPage && @BUILDER.nLoginMethod == SECURITY_TABLE##

{BEGIN changepwd_link}

<span class=buttonborder><input type=button class=button value="##message CHANGE_PASSWORD##" {$changepwdlink_attrs}></span>

{END changepwd_link}

endif##

##

endif##



This produced an error: Could'nt find Element {Begin (line 80 in my file).

J
Jane 4/20/2009

Try to use this one:

##if 1=2##

if @BUILDER.Registration.bChangePwdPage && @BUILDER.nLoginMethod == SECURITY_TABLE##

{BEGIN changepwd_link}

<span class=buttonborder><input type=button class=button value="##message CHANGE_PASSWORD##" {$changepwdlink_attrs}></span>

{END changepwd_link}

endif##

endif

R
rgfischerjr author 4/20/2009

Try to use this one:



Very clever! Thanks!