By M.J. Taylor on
Hi All,
How does one control the area where something gets put into the body of a node?
I'm trying to add an Author Info area to the end of the body text, but have it before something like Service Links, but it's just not going where I think I'm telling it too.
I want:
Body Text
profile_author_info_footer
Service links
But keep getting:
Body Text
Service links
profile_author_info_footer
This is my node.tpl.php:
<div class="node<?php if ($sticky) { print " sticky"; } ?>">
<?php if ($picture) {
print $picture;
}?>
<?php if ($page == 0) { ?><h2 class="title"><a href="<?php print $node_url?>"><?php print $title?></a></h2><?php } ?>
<span class="submitted"><?php print $submitted?></span>
<span class="taxonomy"><?php print $terms?></span>
<?php if (module_exists("adsense")) {
$nodetype_ads = variable_get('adsense_'. $node->type, 0);
if ($nodetype_ads) { ?>
<div class="adsense">
<div class="ad1">
<?php
$nodechannel = db_result(db_query("SELECT a.channel
FROM {adsense} a
WHERE a.nid = '%s'", $node->nid));
print adsense_display("120x600", 1, $nodechannel);
?>
</div>
</div>
<?php } ?>
<?php } ?>
<div class="contentnode">
<?php print $content?>
<?php
if (arg(0) == 'node' && is_numeric(arg(1))) { $node = node_load(arg(1)); }
if ($node->type == 'story') {
$user = user_load(array('uid' => $node->uid));
//print_r($user);
if (isset($user->profile_author_info_footer)) { print check_markup($user->profile_author_info_footer); }
}
?>
</div>
<div class="aftercontent">
<?php print $service_links ?>
</div>
<div class="links">» <?php print $links?></div>
</div>
Here's a page on our test site:
http://tst52.reasontofreedom.com/title_author_bio_addition.html
profile_author_info_footer is set to: "Staff Bio Information"
Can anyone see what I've done wrong? Or point me at the way to get the display order correct?
Any help is gladly appreciated,
MJ
Comments
A guess
This code
is not where the service links are coming from. I would guess they are added to $content in the modules nodeapi hook. One approach to solving your problem is to write a small module that implements the nodeapi hook and adds the profile author information with the approriate weight.
Side note: This code
should not be needed unless you are placing a node with a node as $node is already set in node.tpl.php.
Thanks
I'll admit I didn't want the answer to be “make a module,” but if ya gotta, ya gotta...
And thanks for the side note, the theme in question has been drug kicking and screaming from 4.6, and probably needs a good tune up.
M.J. Taylor
Publisher
from Reason to Freedom