I'm developing Marinelli theme for Drupal6.
In the node template I have to fetch theme relative path in order to print an image inside my theme folder.
Is there a correct way to do this?

the problem is that site themes can placed both in /themes/ or /sites/default/themes.

I'v tried something like

<?php global $base_url;
	if ($sticky) { print '<img src="'.$base_url.'/themes/marinelli/img/sticky.gif" alt="sticky icon" class="sticky" />'; } ?>
	<?php }; ?>

but of course this is not the proper way.

Thanks!

Comments

throk’s picture

You could print your sticky icon using CSS.
Depending on what you want to show up. If its just an icon left of the node title.

.sticky h2 {
padding-left: 15px;
background-image: url(img/sticky.gif);
background-position: left top;
background-repeat: no-repeat;
}

I'm not the best at CSS but that is probably a better way of doing it. I want to point out that I haven't even played with Drupal 6 yet.

Good luck!
__________________________________________________________
work in progress www.TheHappyHourHero.com

artist.lupein’s picture

This is a little bit better:

<?php global $base_url;
    if ($sticky) { print '<img src="' . base_path() . path_to_theme() . '/img/sticky.gif" alt="sticky icon" class="sticky" />'; } ?>
<?php }; ?>

Other way would be:
drupal_get_path('theme', 'yourTheme')
--
Lupein
Drupal themes - themeartists.com

Lioz’s picture

i had to to print it out as an image so Lupein's solutions worked great!

thanks!