Jump to content

[SOLVED]how to change image location in template file?


Recommended Posts

I'm trying to figure out how to change the link location for the main logo in the header.tpl file. The default setting is on line 47 as follows....




this points to the directory /prestashop/img but what I want to do is have it point to the following directory; /prestashop/themes/mytheme/img

I've googled myself silly and tried every single thing I could think of but nothing seems to work. I'm trying to hard code and store as much of my work in my theme directory as possible so going to admin and uploading the file really wont work in my situation.

-Carl

Link to comment
Share on other sites

Hi,

The variable {$img_ps_dir} is set to /prestashop/img directory.
Use the variable {$img_dir} which is set to /prestashop/themes/yourtheme/img
if you want to use a custom directory from the prestashop themes image base, use for instance {$img_dir}your_path/your_image.jpg

  • Like 1
Link to comment
Share on other sites

oh sweet, thanks a ton!!! changing only the img_dir part did the trick! I didn't need any of the extra path info at all.

What I wound up doing was changing {$img_ps_dir}logo.jpg to the following....
{$img_dir}my_image.jpg


And this will work with other images and tpl files as well such as buttons, sprites, product images, or whatever other image location i want to change?

-Carl

Link to comment
Share on other sites

Yes, prestashop switch these variables to their values when executed to generate the HTML page code.
Use that kind of variable as it makes your code adapted to your configuration path whenever your base url is so you dont have to change it when you change your hosting directory for exemple...

if you want to know more about other variables that might exist you can check init.php in your root directory as these variables are set in that file.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...