Jump to content

Edit History

Rybaris

Rybaris


Edited for better problem understanding.

Hello guys.

I am starting with module development and i found first problem which gives me headaches :) PS 1.7.7.8

I have followed directory structure from tutorial https://devdocs.prestashop.com/1.7/modules/creation/module-file-structure/

aniinstagram
├── aniinstagram.php

├── logo.png
└── views
    ├── css
    │   └── aniinstagram.css
    ├── img
    │   └── ig_icon.png
    ├── js
    │   └── aniinstagram.js
    └── templates
        ├── admin
        ├── front
        └── hook
            └── aniinstagram.tpl

To reproduce problem, i want to source image views/img/ig_icon.png inside aniinstagram.tpl:

<!-- Block aniinstagram -->
<section id="aniinstagram_block_home" class="block">
  <div>
	<img src="ig_icon.png" alt="icon">
  </div>
</section>
<!-- /Block aniinstagram -->

I discovered that this is not that simple i thought.

I tried src with ../ with ../../ but nothing worked well and also i think that there must exists something more elegant, something Smarty.

So i started to try like this:

<img src="{$modules_dir}aniinstagram/views/img/ig_icon.png" alt="icon" />

I tried many global variables from here https://www.choosepizzi.net/prestashop-1-7-1-smarty-commands/ which i found on internet but ended with exception errors.

Then i found that it may not work in 1.7 anymore?

What is the right approach for this? How can i link my image to tpl file? 

Thanks in advance,

Rybaris

Rybaris

Rybaris

Hello guys.

I am starting with module development and i found first problem which gives me headaches :) PS 1.7.7.8

I have followed directory structure from tutorial https://devdocs.prestashop.com/1.7/modules/creation/module-file-structure/

aniinstagram
├── aniinstagram.php

├── logo.png
└── views
    ├── css
    │   └── aniinstagram.css
    ├── img
    │   └── ig_icon.png
    ├── js
    │   └── aniinstagram.js
    └── templates
        ├── admin
        ├── front
        └── hook
            └── aniinstagram.tpl

To reproduce problem, inside aniinstagram.tpl:

<!-- Block aniinstagram -->
<section id="aniinstagram_block_home" class="block">
  <div>
	<img src="ig_icon.png" alt="icon">
  </div>
</section>
<!-- /Block aniinstagram -->

I discovered that this is not that simple i thought.

I tried src with ../ with ../../ but nothing worked well and also i think that there must exists something more elegant, something Smarty.

So i started to try like this:

<img src="{$modules_dir}aniinstagram/views/img/ig_icon.png" alt="icon" />

I tried many global variables from here https://www.choosepizzi.net/prestashop-1-7-1-smarty-commands/ which i found on internet but ended with exception errors.

Then i found that it may not work in 1.7 anymore?

What is the right approach for this? How can i link my image to tpl file? 

Thanks in advance,

Rybaris

×
×
  • Create New...