Same image for all custom block
Permalink 1 user found helpful
Hi!
I want to make a custom block (classic product information).
All instances of that block must have the same image (a shopping cart).
There's a way to embed it in the code, without selecting it for every block's instance I create?
I've tried to put that image in the block's folder and in the theme's folder, giving both the full and the relative path, but I can't see the image on the page... Where I have to put it??
Thanks in advance,
Teo
I want to make a custom block (classic product information).
All instances of that block must have the same image (a shopping cart).
There's a way to embed it in the code, without selecting it for every block's instance I create?
I've tried to put that image in the block's folder and in the theme's folder, giving both the full and the relative path, but I can't see the image on the page... Where I have to put it??
Thanks in advance,
Teo
If it's an <img> tag, then you can just put it in your block directory and do some code like this in your block's view.php file:
If, on the other hand, you are referencing the image in CSS, then you don't need to use any kind of function to get a path... CSS urls are always relative to the CSS file itself (not the page's URL), so you can just put the image in the same directory as wherever the CSS file is and do this:
Hope that helps!
-Jordan