HTML Logo by World Wide Web Consortium ( Click to learn more about our commitment to accessibility and standards.

Moving forward with Composr

ocPortal has been relaunched as Composr CMS. ocPortal 9 is superseded by Composr 10.

Head over to for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.

Getting an image from your theme's folder

Login / Search

 [ Join | More ]
 Add topic 
#730 (In Topic #183)

Fan in action

Getting an image from your theme's folder

If you want to use different images based on your theme for your website, here's how…

1) For every PHP "block", you'll have to add a variable…

Originally posted by anything between <?php ?> is a block…
if ($tired=true) { echo "Go to bed!"; }


Anyways, add these variables to the blocks you want to use a "special" image…


This will replace $theme with the theme folder the person is using (defined by map.ini if you have multiple skins tied to your forum)

Now to get the image. Remember to follow the php rules (i.e echo "blah";) stuff…

<IMG SRC='{$base_url}/themes/{$theme}/filename.type'>

It's always good to use base_url, it's your website's location.. from there the code will go to the themes directory and then will replace $theme by the foldername of the theme you're using. It then grabs the filename you specify. :)

So, in turn, you can do something like this:

It's best that the filename is the same in the same theme folders, if its not then you'll run into a broken image problem….

ocProducts :wub: :wub:

Click here to drop by my website!
Back to the top
There are too many online users to list.
Control functions:

Quick reply   Contract

Your name:
Your message: