Hi everyone,
I am looking to have a custom footer at the bottom of the node of certain types of posts.
I have tried to play with VIEWS module to get this to happen, but to be perfectly honest Im kind of stumped how to make this work.
(I would want the footer to appear in the bottom....or even the top...of a node body of content type "story" with a taxonomy term associated with it.)
To be more specific, the website is for members to write stories and poems and get hints and reviews from other writers. One of the types of stories is "Fan-Fiction". I would like to have it set up so a disclaimer appears on the bottom of the posted node mentioning some legal and copyright stuff.
Anyone have a way to do this ?
Thanks
seanm
Comments
http://drupal.org/node/17565
http://drupal.org/node/17565
---
www.whatwoulddrupaldo.org
I would do that but that
I would do that but that would show the footer on all pages, wouldnt it ?
Id rather not have to have the footer appear in all content, only story pages of taxonomy type fan-fiction.
(and creating more than 1 content type would appear unwieldy to the end user)
Sean
My quick shot
Roughly:
Use a custom block with the disclaimer inside and using the permissions you can set the "Page specific visibility settings" to match your term.
Without using visibility, you can just throw this piece of code in a Block with filter set to PHP code.
One advantage of having a block is that you can theme it later and do fancy stuff with it (view permission...).
This worked great, Thanks
This worked great, Thanks tostini!
Seanm
Little update using block visibility settings
Create a block with "Disclaimer" as a title and "This is the disclaimer text." as a body.
Go under "visibility settings" choose PHP mode and paste this piece of code
Note the first piece of code was wrong because of the static
$node->taxonomy[1]->name. It's better to retrieve the first term with$term = array_pop($terms);.In cas of multiple terms, this should do the job.
How about this? In
How about this?
In node.tpl.php, insert some php code in the location of your choice to check the node type and taxonomy. If your php code evaluates to true, then display the custom fan-fiction footer. You can put this wherever in the template you want - top, bottom, etc.
If you are using phptemplate, the node type and taxonomy already available to you (see how the function phptemplate_node() in the file phptemplate.engine makes them available to you), so you just have to write the code that checks these values. The code would check that the node is a "story" type, and that fan-fiction is in the taxonomy.
There is also the taxonomy theming module
The taxonomy theme is a good solution to this problem as well, though the php snippets above are certainly more elegant. Using the module might be a bit excessive for what you need, though.
Felix
blog at http://www.felixcohen.co.uk
work at http://www.opendemocracy.net & http://www.chinadialogue.net
Skype me: felix_cohen
This is all set thanks to tostini
Thanks to the help of tostini this was set up and works perfectly.
the following code was created as the visibility settings section of a block:
This allows for a title and text to appear, but only on the correct taxonomy termed node.
Sean