2010-02-16 61 views
0

我有很多頁面,我想爲每個頁面分配標題如何可以ID?如何通過smarty爲每個頁面分配標題?

我指定主頁但無法指定頁面。該變量將增加在header.tpl

頁(contact.php,order.php,products.php)

我使用{$ hometitle} $ smarty->分配( 'hometitle',$ hometitle);

回答

0

不知道我明白了這個問題: 這有幫助嗎?

在你的PHP:

<?php 
    $smarty = new Smarty(); 
    $smarty->assign('hometitle',$hometitle); 
    $smarty->display('index.tpl'); 
?> 

在您的模板:

<html> 
    <head> 
    <title>{$hometitle}</title> 
    </head> 
    <body> 
    <!--body content here--> 
    </body> 
</html> 
相關問題