This topic is locked

Smarty tags in include file

5/8/2008 11:08:56 PM
PHPRunner General questions
W
willjob author

I am playing around with the template files and would like to put smarty tags into the header include file that is called by smarty. The problem is that the web page displays the actual smarty tags. Any work around?
Thanks
Tripp

J
Jane 5/12/2008

Tripp,
I recommend you to have a look at the following article:

http://www.xlinesoft.com/phprunner/docs/smarty_templates.htm

W
willjob author 5/19/2008

Tripp,

I recommend you to have a look at the following article:

http://www.xlinesoft.com/phprunner/docs/smarty_templates.htm


I have read through this and the docs at the smarty site and cannot figure this out.
I am trying to put the following code in the header file...

[codebox]<table><tr>

<td align="center">Logged as <b>{$username}</b> &nbsp;

<a href="login.php?a=logout">Log out</a>

</td><td style="width:20">&nbsp;</td>

{if $not_a_guest}

<td><a href="changepwd.php">Change password</a></td>

{/if}

</tr></table>

<hr style="size:1;noshade=noshade" />

<table cellpadding="0" cellspacing="0" border="0">

<tr><td>

{if $allow_newuser}

<a href="newuser_list.php">

User</a>

{/if}

</td></tr>

<tr><td>

{if $allow_cars}

<a href="cars_list.php">

cars</a>

{/if}

</td></tr>

</table>[/codebox]
and the output on the page looks like this on the web page...
Logged as {$username} Log out {if $not_a_guest} Change password {/if}
--------------------------------------------------------------------------------

{if $allow_newuser} User {/if}

{if $allow_job} Jobs {/if}
Is it possible to put this in the header file?
Also, is it possible to put an event in the header file such as ... {doevent name="ListOnLoad"}
Thanks
Tripp

J
Jane 5/20/2008

Tripp,
if you want to use your own smarty tags in the header divide your header.php file into two files: header.php and header.htm file and then use smarty tags in the header.htm file.
But I recommend you to use pure PHP in your header. It's more easy.