Closed (fixed)
Project:
Nodequeue
Version:
5.x-2.0-beta
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
17 Aug 2007 at 04:00 UTC
Updated:
4 Sep 2007 at 22:11 UTC
I'd like to apply different themeing to a node depending in which queue it is. So rather than just having a teaser or a full node presentation option in my node-foo.tpl.php file, I need to display it differently when it is loaded into queue x.
Looking at the nodequeue_nodes function that would not be possible, since it uses the node_view() function to return the output, which only for teaser TRUE/FALSE.
Would it be possible to add a parameter that lets one provide the name of a custom theme function which will be used to style the node data after it has been loaded with node_load?
Or is there another way of achieving this with the current state of the module?
Comments
Comment #1
nicolash commentedTo illustrate a bit clearer...
Comment #2
merlinofchaos commentedWell, there's nothing in nodequeue specifically to do this. However, you could put this piece of code in your _phptemplate_variables function of the template.php, under the case 'node': (If you're unfamiliar with this, look up that function. It's tremendously useful):
Some notes: This only gets the 'first' queue a node is a member of, so if you happen to have it in multiple queues, you may need to play some additional tricks in order to pick the correct one. You may want to name your template after the queue rather than using the qid, but that'll require calling nodequeue_load($qid) to get the queue data, and you'll have to translate the queue title to be a valid filename...so you probably don't really want to do that. But the option is there.
I don't see anything here that nodequeue is likely to do, except perhaps provide an API function to let you know what queues a node is in. For that you can use:
$subqueues will be an array for every subqueue the node is a member of, and you can do what you will with that data.
Comment #3
merlinofchaos commentedActually, I take it back; it'll be a list of all subqueues that that node *may* be a member of. To find actual membership information you need one more function:
This is more complex than it seems like it needs to be since this API is really for a different purpose. I never need to know just what queues a node is a member of, but rather which queues a node may be a member of, and what the membership state actually is.
Comment #4
nicolash commentedGreat feedback...thanks. One thing that has me wanting to stay clear of the phptemplate query approach is that currently we only use nodequeue on the homepage. Considering that there are a LOT of non-homepages, it would mean another query each node display which would be unnecessary 99% of the time.
Actually, I've been going really well with that slightly altered function that I posted above...simply placed in the theme. I'm not quite sure whether that would be, *gasp*, considered hackery? And similar...calling functions of a module without actually using that module - sort of cherry picking.
Not sure about the etiquette here... what's your opinion on this?
Comment #5
merlinofchaos commentedNot hackery at all, really. It just means you need something the module doesn't quite provide, and you were able to write the code to provide it. Just be aware that updates might cause things to change, but that's pretty typical with Drupal anyway.
Comment #6
(not verified) commented