Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get url of current theme in prestashop's .tpl file&

Tags:

I need to get path of image which is located in www.mysite.com/themes/mytheme/img/image.png

=================================================

I've found the answer here: http://prestalab.ru/wiki/peremennye-v-shablonax.

The path to image in my theme will be: {$tpl_dir}img/myimage.png

like image 578
Dmitry Avatar asked Sep 15 '11 09:09

Dmitry


People also ask

How do I change my PrestaShop theme?

To install a new PrestaShop theme, you have to download it locally and to extract the archive at your computer. Then, go to your website's admin dashboard and click on Design > Theme and Logo. You will be redirected to the Theme management page where you should click on Upload a theme.

How do I override TPL in PrestaShop?

To override a module tpl you have to copy the folder structure and the file you want to override into your theme. Note that the folders may vary but you have to keep the structure. Save this answer.

What is PrestaShop template?

PrestaShop templates are ready-made designs for online stores running on PrestaShop eCommerce engine. A PrestaShop template package provides the files, images, modules and documentation to help you create a full-fledged e-store.


1 Answers

$tpl_uri will return the current theme's path relative to the web root.

Here are some other global variables PrestaShop makes available which may be helpful:

$img_ps_dir       // the PrestaShop image directory $img_cat_dir      // current category's images directory $img_lang_dir     // current language's images directory $img_prod_dir     // current product's images directory $img_manu_dir     // current manufacturer's images directory $img_sup_dir      // current supplier's images directory $img_ship_dir     // current carrier's (shipping) images directory $img_dir          // current theme’s images directory $css_dir          // current theme’s CSS directory $js_dir           // current theme’s JavaScript directory $tpl_dir          // current theme’s directory (physical path on machine) $tpl_uri          // current theme's directory (web-root relative path) $modules_dir      // modules directory $mail_dir         // mail templates directory $pic_dir          // pictures upload directory 
like image 175
mrbangybang Avatar answered Oct 21 '22 06:10

mrbangybang