The mystery of the disappearing image...
Has anyone had the issue of an image appearing on one page node and not on another? I have a case where the image:
http://dev5.playpoi.com/sites/playpoi.com/themes/playpoi_NEXTGEN_v02/ima...
appears here:
http://dev5.playpoi.com/about-poi with:
![]()
but not any of the sub nodes such as here:
http://dev5.playpoi.com/about-poi/why-poi
http://dev5.playpoi.com/about-poi/poi-history
etc. with:
![]()
Looking at the pages with Firebug the CSS assignment looks identical as well.
The odd thing is that it's the same template file: page-about-poi.tmp.php for all of the pages. This can be confirmed with the presence of in the HTML source of each page within the tag.
Everything appears the same and yet the image will not display on the sub pages.


base_path ?
How do you build the path to the image?
print $directory
Via block-views-about_poi.tpl.php
<img width="170" height="48" border="0" src="<?php print $directory ?>/images/navBarRightBlock_RedTail.jpg" alt="" />This is consistent between both cases, one that works and one that fails to display the image.
Try with $base_path before $directory ?
<?php print $base_path . $directory ?>Freak show!
Markus,
Thanks for the suggestion, I've setup:
<div class="content"><?php print $block->content ?>
1.<img width="170" height="48" border="0" src="<?php print $base_path . $directory ?>images/navBarRightBlock_RedTail.jpg" alt="" />
2.<img width="170" height="48" border="0" src="<?php print 'http://' . $_SERVER["SERVER_NAME"] . '/' . $directory ?>/images/navBarRightBlock_RedTail.jpg" alt="" />
3.<img src="http://dev5.playpoi.com/sites/playpoi.com/themes/playpoi_NEXTGEN_v02/images/navBarRightBlock_RedTail.jpg" />
4.<img width="170" height="48" border="0" src="<?php print $base_path ?><?php $directory ?>images/navBarRightBlock_RedTail.jpg" alt="" />
5.<img width="170" height="48" border="0" src="<?php print base_path() . path_to_theme() ?>/images/navBarRightBlock_RedTail.jpg" alt="" />
</div>
Here: http://dev5.playpoi.com/about-poi and http://dev5.playpoi.com/about-poi/poi-history the results are still surprising but at least they're consistent.
The resulting HTML is:
1.<img width="170" height="48" border="0" src="sites/playpoi.com/themes/playpoi_NEXTGEN_v02images/navBarRightBlock_RedTail.jpg" alt="" />
2.<img width="170" height="48" border="0" src="http://dev5.playpoi.com/sites/playpoi.com/themes/playpoi_NEXTGEN_v02/images/navBarRightBlock_RedTail.jpg" alt="" />
3.<img src="http://dev5.playpoi.com/sites/playpoi.com/themes/playpoi_NEXTGEN_v02/images/navBarRightBlock_RedTail.jpg" />
4.<img width="170" height="48" border="0" src="images/navBarRightBlock_RedTail.jpg" alt="" />
5.<img width="170" height="48" border="0" src="/sites/playpoi.com/themes/playpoi_NEXTGEN_v02/images/navBarRightBlock_RedTail.jpg" alt="" />
Sadly what I would expect and what you've suggested is the one solution that fails. img tag 1. and 4. don't load while the other three hacks do. I'm going to go with number 5... odd but at least it works.
base_path()
Oh, if $base_path is not available under the context your template is being executed, then base_path() should do the trick. Sorry for not mentioning this before.
Context?
Markus,
Could you point me in the right direction to understand what the considerations are for "the context your template is being executed". Are there PHP/Drupal settings I should be aware of?
Source code itself?
Template files have a preprocessor function that build the variables available to templates. For example, for page-tpl.php, you can look at modules/system/page.tpl.php, that contains a lot of information about the available variables in its own source code, but those are prepared in function template_preprocess_page located in includes/theme.inc, which would be a better source if the template file was not documented.
When you see a function named theme_xxxx, there may also exist a function named template_preprocess_xxxx, or module_preprocess_xxxx (where 'module' is the name of the module that implements the theme function). In case of doubts, if not already documented in the module README or similar, you may contact the module author.
In the case of views, you have a lot of information in the sources as well, in the theme subdirectory of the views installation, or you can install the advance_help module that also provides information about views theming, or look at the views developers group.
Thank you...
Markus,
You're a wealth of information. It's people like you that make working with Drupal so rewarding. Thanks!