{if $loggedin}
{literal}
{include file="allhead.html"}
{/literal}
{else}
{literal}
{include file="allhead1.html"}
{/literal}
{/if}
How do I include the code contained into an HTML file in a smarty .tpl file? I've tried different solutions on various forums, but none work.
You mean I have to create a PHP file with this:
<?php
$smarty->assign('allhead', '/public_html/billing/templates/allhead.html');
$smarty->assign('allhead1', '/public_html/billing/templates/allhead1.html');
?>
Then add into the Smarty .tpl file this:
{if $loggedin}
{include file="$allhead"}开发者_开发知识库
{else}
{include file="$allhead1"}
{/if}
But how will the smarty template know it got to check the $ vars from the PHP file?
In PHP:
$smarty->assign('allhead1', 'FULL_PATH_T0_FILE');
In Smarty Template:
<body>
<!-- don't put literal tags around include -->
{include file="$allhead1"}
</body>
精彩评论