[support] Display Node with Template

Zhang Xiao xellzhang at gmail.com
Thu Jan 28 03:18:38 UTC 2010


Hi,

If I understand you correctly, you just need to get the node object then use node_view() to output it.

The template file should be called in this way.

x.

On Jan 27, 2010, at 9:06 PM, Fred Jones wrote:

> I have a site with a custom content type called Class. We have a file
> in the theme called node-class.tpl.php.
> 
> Now the challenge is that we have need a URL like /featured_class
> which will search based on a boolean CCK and randomly select any class
> node which is marked as "Featured" and then display that.
> 
> I can do this with SQL and then redirect to the class node, but then
> the URL changes to that of the node. They want the URL to stay the
> same, ie. featured_class.
> 
> I can't wrap my head around this. I somehow need to get the
> node-class.tpl.php in there b/c there's a lot of code in there for
> displaying classes. The only solution I have thus far (that someone
> else gave me) is to use template_preprocess_page() to select that node
> template, based on the URL, and then use a custom function to find and
> load the node in question. I'm not sure it will work, but before I
> try, is there any other (better) way to do this?
> 
> Thanks!
> -- 
> [ Drupal support list | http://lists.drupal.org/ ]



More information about the support mailing list