Magento Forum

php call for img? 
 
velocis
Jr. Member
 
Total Posts:  8
Joined:  2008-04-22
 

is there a developer’s api with a list of function calls, etc anywhere? That sure would be nice.

Does anyone know if there is some way to get the image directory url for the current theme?

so I could do something like:

<img src="<?php magento_img_directory_url(); ?>/myImage.png" />

and not have to put in a manual URL for the img?

thanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

Unfortunately there’s no API documentation ready yet.

Current theme’s image url is retrieved in templates by:

<img src="<?php echo $this->getSkinUrl('images/myImage.png') ?>" />

Outside of the templates full notation should be used:

$imgUrl Mage::getDesign()->getSkinUrl('images/myImage.png');

Full image name should be included as an argument to allow fallback to default theme if the file doesn’t exist in the custom theme.

 
Magento Community Magento Community
Magento Community
Magento Community
 
velocis
Jr. Member
 
Total Posts:  8
Joined:  2008-04-22
 

I’m not sure I’m trying this in the right place…

right now I am in CMS editing the “home page” and in the content section I have

<img src="<?php echo $this->getSkinUrl('images/homepage_block.gif') ?>" />

and no luck. Is there a better place to try and customize the homepage?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Moshe
Magento Team
 
Avatar
Total Posts:  1770
Joined:  2007-08-07
Los Angeles
 

in CMS pages and blocks use:

{{skin url="images/homepage_block.gif"}}
 
Magento Community Magento Community
Magento Community
Magento Community
 
velocis
Jr. Member
 
Total Posts:  8
Joined:  2008-04-22
 

awesome.. thanks!

that’s kind of a lot of different ways you have to remember to do something tongue laugh

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top