TWDesign Posted April 6, 2012 Share Posted April 6, 2012 Hopefully others can expand on this. I find it to be a useful cheat sheet. {$smarty.server.REQUEST_URI} gives everything under the domain name e.g. /mydir/en/helloworld.html {$base_dir} gives the fully qualified domain name AND the base directory e.g. http://www.mydomain.com/mydir/ {$smarty.server.HTTP_HOST} gives the domain name only e.g. www.mydomain.com (without the http prefix) {$lang_iso} gives the current language locale e.g. en e.g. ja Would be interesting to know how to return JUST the base directory e.g. /mydir/ and how to get the current page uri minus the base directory e.g. /en/helloworld.html and hot to get just the page without any preceding qualifiers e.g. /helloworld.html Are there Smarty variables for these? Link to comment Share on other sites More sharing options...
Dh42 Posted April 6, 2012 Share Posted April 6, 2012 http://www.electrictoolbox.com/var-dump-print-r-inside-smarty-template/ You can dump all of the variables inside a temple with this. By default prestashop has {php} turned off in smarty so you will have to turn it on. Link to comment Share on other sites More sharing options...
TWDesign Posted June 15, 2012 Author Share Posted June 15, 2012 So lets say I have an image MyPic.jpg and it's in a folder /mypictures/ under the current theme. What is the correct way to link to the image in a TPL file? I usually end up hard coding everything under the {$base_dir} variable, which I know is not correct. Link to comment Share on other sites More sharing options...
Dh42 Posted June 15, 2012 Share Posted June 15, 2012 The best practice is to use {$theme_dir}themename/mypictures Link to comment Share on other sites More sharing options...
Arkadia Posted September 19, 2012 Share Posted September 19, 2012 Hi Guys... I'm having issues with things loading in https when using the smarty variable {base_dir} - is there a way to use {base_dir} but EXCLUDE the http portion in the output? So basically {base_dir} gives me "http://myshop.com/myshopfolder" but I want just "myshop.com/myshopfolder" (I have more than 1 site on the same server...so I need to specify the shops folder...) {base_dir} does what I need it to do...but it adds the http...which I don't want... Did you guys happen to come across a variable for this? Link to comment Share on other sites More sharing options...
pxloft Posted May 19, 2015 Share Posted May 19, 2015 HI! I don't know if you ever resolved this but I found a great solution. Turn: 13-mycatagory?p=4 into: 13-mycatagory by using the strtok operator in php. {assign var="currentPage" value=strtok($smarty.server.REQUEST_URI,'?')} {* page name without query/ parameters*} Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now