FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum Development » Bug Reports » Syntax error in code generated after adding {IF} to template
Show: Today's Messages :: Unread Messages :: Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Return to the default flat view Create a new topic Submit Reply
Syntax error in code generated after adding {IF} to template [message #167801] Mon, 01 October 2012 19:20 Go to previous message
DPhan is currently offline  DPhan   United States
Messages: 9
Registered: September 2012
Location: San Jose, Calif
Karma:
Junior Member
add to buddy list
ignore all messages by this user
In the default index.tmpl file, I made the following change:

before:
{TEMPLATE: show_links}

after:
{IF: _uid} {TEMPLATE: show_links} {ENDIF}

The generated code BEFORE the change is as follows:

"index.php?t=selmsg&amp;date=today&amp;<?php echo _rsid; ?>&amp;frm_id=<?php echo (isset($frm->forum_id) ? $frm->forum_id.'' : $frm->id.'' ) .'&amp;th='.$th.'" title="Show all messages that were posted today" rel="nofollow">Today's Messages</a>
'.(_uid ? '<b>::</b> <a href=" index.php?t=selmsg&amp;unread=1&amp;'._rsid.'&amp;frm_id='.(iss et($frm- >forum_id) ? $frm->forum_id.'' : $frm->id.'' ) .'" title="Show all unread messages" rel="nofollow">Unread Messages</a>&nbsp;' : ''); ?>
<?php echo (!$th ? '<b>::</b> <a href=" index.php?t=selmsg&amp;reply_count=0&amp;'._rsid.'&amp;frm_id=' .(isset($frm- >forum_id) ? $frm->forum_id.'' : $frm->id.'' ) .'" title="Show all messages, which have no replies" rel="nofollow">Unanswered Messages</a>&nbsp;' : ''); ?>
<b>::</b> <a href="index.php?t=mnav&amp;<?php echo _rsid; ?>" rel="nofollow">Message Navigator</a><?php echo $admin_cp; ?>
<?php echo $cat_path; ?>

The generated code AFTER the change contains syntax error and is as follows:

<?php echo (_uid ? ' <span class="GenText fb">Show:</span>
<a href=" index.php?t=selmsg&amp;date=today&amp;'._rsid.'&amp;frm_id='.(i sset($frm- >forum_id) ? $frm->forum_id.'' : $frm->id.'' ) .'&amp;th='.$th.'" title="Show all messages that were posted today" rel="nofollow">Today's Messages</a>
'.(_uid ? '<b>::</b> <a href=" index.php?t=selmsg&amp;unread=1&amp;'._rsid.'&amp;frm_id='.(iss et($frm- >forum_id) ? $frm->forum_id.'' : $frm->id.'' ) .'" title="Show all unread messages" rel="nofollow">Unread Messages</a>&nbsp;' : ''); ?>
<?php echo (!$th ? '<b>::</b> <a href=" index.php?t=selmsg&amp;reply_count=0&amp;'._rsid.'&amp;frm_id=' .(isset($frm- >forum_id) ? $frm->forum_id.'' : $frm->id.'' ) .'" title="Show all messages, which have no replies" rel="nofollow">Unanswered Messages</a>&nbsp;' : ''); ?>
<b>::</b> <a href="index.php?t=mnav&amp;<?php echo _rsid; ?>" rel="nofollow">Message Navigator</a> ' : ''); ?>
<?php echo $admin_cp; ?>
<?php echo $cat_path; ?>

Correct the syntax error by removing the trailing ; ?> near "Unanswered Messages" and replace with a dot, and add a
single quote on the next line.

Corrected version:

<?php echo (_uid ? ' <span class="GenText fb">Show:</span>
<a href=" index.php?t=selmsg&amp;date=today&amp;'._rsid.'&amp;frm_id='.(i sset($frm- >forum_id) ? $frm->forum_id.'' : $frm->id.'' ) .'&amp;th='.$th.'" title="Show all messages that were posted today" rel="nofollow">Today's Messages</a>
'.(_uid ? '<b>::</b> <a href=" index.php?t=selmsg&amp;unread=1&amp;'._rsid.'&amp;frm_id='.(iss et($frm- >forum_id) ? $frm->forum_id.'' : $frm->id.'' ) .'" title="Show all unread messages" rel="nofollow">Unread Messages</a>&nbsp;' : ''); ?>
<?php echo (!$th ? '<b>::</b> <a href=" index.php?t=selmsg&amp;reply_count=0&amp;'._rsid.'&amp;frm_id=' .(isset($frm- >forum_id) ? $frm->forum_id.'' : $frm->id.'' ) .'" title="Show all messages, which have no replies" rel="nofollow">Unanswered Messages</a>&nbsp;' : '') .
'<b>::</b> <a href="index.php?t=mnav&amp;<?php echo _rsid; ?>" rel="nofollow">Message Navigator</a> ' : ''); ?>
<?php echo $admin_cp; ?>
<?php echo $cat_path; ?>

I started to look at the code generation routine compiler.inc for a permanent fix but I thought I should ask if there is someone who is more familiar with this code generation routine.

Dan
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Cross-site scripting attacks
Next Topic: Fatal error if moderator uses the "move selected" button
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Mon Oct 03 08:27:24 EDT 2022

Total time taken to generate the page: 0.00876 seconds