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

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -