By nouriassafi on
I followed the instructions in the following node to replace block title with HTML image.
Now, depending on my URL, I have my title images appearing and disappering. To rephrase, when I use drupal's default URL (e.g node/10) the images disappear and when I use an alias the images reappear. What can be behind this issue? I am using BASIC as my theming template. Drupal version used is 6.15
What follows is the code in my block.tpl.php:
<?php if (!empty($block->subject)): ?>
<?php if (substr($block->subject,0,3)=="img") {
$tok = strtok($block->subject," ");
while ($tok !== false)
{
switch (substr($tok,0,1))
{
case "m":
$type="module";
$name=substr($tok,2);
break;
case "t":
$type="theme";
$name=substr($tok,2);
break;
case "e":
$type="theme_engine";
$name=substr($tok,2);
break;
case "w":
$imgwidth=substr($tok,2);
break;
case "h":
$imgheight=substr($tok,2);
break;
case "i":
$imgfilename=substr($tok,4);
break;
}
$tok = strtok(" ");
}
echo "<div class='title block-title'><img src='".drupal_get_path($type,$name).'/'.$imgfilename."' height='".$imgheight."' width='".$imgwidth."' /></div>";
} else { ?>
<h3 class="title block-title"><?php print $block->subject; ?></h3>
<?php } ?>
<?php endif; ?>
Comments
Did you try clearing your
Did you try clearing your cache? Block output is often cached.
When I use the absolute path the images show up.
I've changed the path in my block.tpl.php to . $_SERVER["SERVER_NAME"] . base_path().drupal_get_path($type,$name). and now images show up. Is this standard behaviour? Shouldn't the base path in my settings.php take care of that?
Thanks for your help.
$base_path should be fine.
$base_path should be fine. No reason for absolute path.
Have you looked at the HTML that is being output when the images were not visible, and how that compares to when they are visible?