Scenario:

- I create an Omega subtheme
- I place a file zone--postscript.tpl.php in the templates folder;

content of that file:

<?php 
/**
 * @file
 * Adding an image to the postscript zone
 */
?>
<div class="decoratie"><img src="<?php print $base_path . $directory; ?>/images/opleuken.jpg" /></div>
<?php if ($wrapper): ?><div<?php print $attributes; ?>><?php endif; ?>  
  <div<?php print $content_attributes; ?>>
    <?php print $content; ?>
  </div>
<?php if ($wrapper): ?></div><?php endif; ?>

- in the html rendered I get:

<img src="sites/**.****.nl/themes/omega/alpha/images/opleuken.jpg">

So <?php print $base_path . $directory; ?> refers to ../themes/omega/alpha??

Comments

Argus’s picture

Title: Clearify how the alpha theme interferes with general Drupal theming conventions » Clearify how the alpha theme interferes with Drupal paths
Priority: Normal » Minor

The question remains, but of course it's easier to add an image on top above the postscript regions the Omega Way:

- Add a region to the postscript zone (in the yourtheme.info for instance add regions[postscript_pre] = 'Postscript Pre').
- Clear Cache.
- Assign the region to the postscript zone, in my case I gave it a weight of zero so it would appear above the other regions in the postscript zone.
- Add a block with the image to that region.

This will take care of all the formatting for you, all margins and padding are taken care of. It does generate a little more HTML.

knalstaaf’s picture

Priority: Minor » Normal

The use of an extra region would be a little too much in my case. I just need to position a small image somewhere in the menu region, on the right of the menu. This isn't self evident because the menu is not positionable through the Block administration.

So indeed, if someone could pass through a little line of code that renders the path to the subtheme files, it would fill my heart with joy.

marcoka’s picture

Assigned: Unassigned » fubhy

base_path is core.
http://api.drupal.org/api/drupal/developer!globals.php/global/base_path/7
i do not know where $directory comes from. seems its the path to sites/**.****.nl/themes/omega/alpha/

bc’s picture

#1026156 explains why this happens

Argus’s picture

bc’s picture

yes, that one :)

i've taken to doing drupal_get_path() instead.

himerus’s picture

Status: Active » Fixed

yes, drupal_get_path is the appropriate method.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.