Hi there everyone. I am wondering why the following code, when executed from a block does not work, but if I put this into my page.tpl.php file, it does work as expected? I'd like to use the built in functionality of displaying this code on all pages/nodes except the ones listed. I know that I can do this through a comparative structure int he page.tpl.php file, but would rather not have to resort to that. Any thoughts?

<?php if (isset($primary_links)): ?><div id="contentNav" class="contentNav"><span><?php print theme('links', $secondary_links); ?></span></div><?php endif; ?>

Your assistance is appreciated greatly!

Comments

nevets’s picture

$primary_links is not defined for blocks.

You could write the code as

<?php
$primary_links = menu_primary_links();
if (isset($primary_links)): ?>
<div id="contentNav" class="contentNav"><span><?php print theme('links', $secondary_links); ?></span></div>
<?php endif; ?>
jesusrocksmyfaceoff’s picture

Thanks! you got me on the right track, for anyone else who might take advantage of this... the code above works with one addition, see below:

<?php
$primary_links = menu_primary_links();
$secondary_links = menu_secondary_links();
if (isset($primary_links)): ?>
<div id="contentNav" class="contentNav"><span><?php print theme('links', $secondary_links); ?></span></div>
<?php endif; ?>

Josh Mans
New Creation WOC
www.newcreationwoc.org

rcr1000’s picture

What would be the analogous way to do that for the following code?
print $field_amazon_rendered;