smarty - Include path from root -


i have structure kinda this:

src ---stuff1 ------stuff2 ---------stuff3 ------------tpl1.tpl ---dir1 ------dir2 ---------dir3 ------------tpl2.tpl 

i want include tpl2.tpl in tpl1.tpl, how can avoid monsters this: {include file="../../../../../dir1/dir2/dir3/tpl.tpl"}?

php file:

<?php $root = "/path/to/the/root/of/my/site/or/templates" $smarty->assign('root',$root); 

template file:

{include file="`$root`/dir1/dir2/myfile.tpl"} 

or

{include file="$root/dir1/dir2/myfile.tpl"} 

or

{include file="$root|cat:"/dir1/dir2/myfile.tpl"} 

http://www.smarty.net/docs/en/language.syntax.quotes.tpl


Comments

Popular posts from this blog

Payment information shows nothing in one page checkout page magento -

tcpdump - How to check if server received packet (acknowledged) -