getThemePath vs getStylesheet

Permalink 1 user found helpful
Please if anyone could explain me the difference between getThemePath and get getStylesheet when calling Css and Js files.

Also, i created my own theme, but none of the images are showing.
Do i have to add getThemePath to each image in my website, or is there some easier way to display images?



View Replies: View Best Answer
Mnkras replied on at Permalink Best Answer Reply
getThemePath() returns the path to the theme, like /packages/theme_destyle/themes/destyle, where getStyleSheet() is only for css, and it allows the css to be customized by c5.

Madebym replied on at Permalink Reply
Thanks Mike, just one thing please, do i need to add getThemePath to all images in my stylesheets and in Html?
xaritas replied on at Permalink Reply
Typically you would use getThemePath() to resolve links to images referenced in HTML. Images referenced in CSS using url() notation are resolved relative to the stylesheet. So something like this will probably work:

<?php $logoSrc = $this->getThemePath()."/images/my_image.jpg"; ?>
// ... in CSS,
background: url(../images/my_image.jpg);

Of course the exact path depends on exactly where the assets are. You can use Firebug/WebKit inspector to look at network requests. It will tell you what path it is trying to use to load an image, and from that you deduce how to tweak your path.