Get Reptags in full node view through node.tpl.php
| Project: | Rep[lacement]Tags |
| Version: | 5.x-1.x-dev |
| Component: | Code / API |
| Category: | support request |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Hi,
I read your remark on: http://drupal.org/node/115690#comment-504416
But actually title replacements are only supported in teaser view and not for full page rendered nodes. This is because for full pages the title is generated by the Drupal menu system (instead of the node module) and therefore cant be altered easily. This behaviour may change in Drupal 6, but atm it is by design.
If you really need full title replacements support for a certain node type you can override the title field in your theme's node template file (node-*.tpl.php).
How can I get the reptags field to show in node.tpl.php ?
Do I need to tell exactly which field I want to use, thats no problem, but how do I code the right node.tpl.php for the node-title?
Thanks a lot in advance for your reply!
greetings,
Martijn

#1
Hi,
I notice in Drupal 6, the same behaviour, very much interested in node.tpl.php solution for this.
Very eager to get reptags working for node-title.
EDIT: May be duplicate of: http://drupal.org/node/58855#comment-1123794, but very interested in theming-example.
Greetings,
Martijn
#2
In general there are two simple functions you can/should use from your theme templates.
If you want to process a piece of text, say the $text variable, you can easily replace
print $text;withprint reptag_replace($text);.If you want to process a field, such as a CCK field 'myfield' in the $node object, you can easily replace
print $node->myfield;withprint reptag_field_replace($node, 'myfield');.This means for title replacements you should wrap $title output like this
reptag_replace($title)in your page.tpl.php template. The $title variable in node-... templates is usually only printed in teaser view (for Garland you can find<?php if ($page == 0): ?>in node.tpl.php hiding the $title output for full pages). Again $title in page.tpl.php is printed on every page, but $title in node.tpl.php is only printed for teaser view.#3
Hi,
Thanks for explaining.
So it wouldn't do harm to wrap $title in reptag_replace($title) on page.tpl.php and node.tpl.php, is the $title just put through if there is no reptag to replace?
No performance issues with this?
Should I also wrap $content in reptag_replace, because on some module output like the weblinks module, the reptags are not changed?
Greetings,
Martijn
#4
For some simple applications, just insert a php include in your template:
<?php require_once($_SERVER['DOCUMENT_ROOT'].'/phpincludes/file.html'); ?>