Hello everyone,
First and foremost, I ask for mercy because I know this question has GOT to be answered somewhere but I can't find it. So please got easy on me and don't hurt me too much. :)
Now with that out of the way - what I'm looking to do is take the $links variable being passed to a theme'd template I've made (node-story_comments.tpl.php) and pluck the various array elements out and put them where I'd like.
Available $links:
Array
(
[comment_add] => Array
(
[title] => Comment
[href] => comment/reply/14
[attributes] => Array
(
[title] => Add a new comment to this page.
)
[fragment] => comment-form
)
[node_read_more] => Array
(
[title] => Read more
[href] => node/14
[attributes] => Array
(
[title] => Read the rest of Test Story.
)
)
[ignore_user] => Array
(
[title] => Ignore user
[href] => ignore_user/add/5
[query] => destination=node
[attributes] => Array
(
[class] => ignore-user
[title] => Add user to your ignore list
)
)
)
So for example, at this stage all I would want to do is take the content from comment_add and output it in a div as a link so I can style it, like: <div id="addcomment"> <?php $comment_add ?> </div> . I just don't know how to do this properly. Since what I want to do is relatively minor I think it's just better to theme it in a template than a preprocessor function...
However, my lack of PHP and Drupal syntax handling are causing this to be more of an issue than it should be - regardless of how much reading I'm doing.
Thanks everyone, and happy holidays!
Comments
print the pieces...
how about something like:
my syntax might be a bit off, but that is the jist. Kind of a tedious task rebuilding the output, but definitely provides the control that can make theming easier.
I've always do this in
I've always do this in template tpl.php
Optionally, you want to unset the $links['comment_add'].
--
CK Ng | myFineJob.com
Thank you guys for your
Thank you guys for your feedback, it's been a huge help.
Can you tell me what the syntax/method for unsetting variables in Drupal is so that it affects only the template? That would probably be the best way to go in most situations, but I don't want the unset to affect all the other template pages.
So for example, I would want to do something like this (which doesn't work):
<?php unset($links['comment_add']); ?>Thank you guys again!