By mkinnan on
How would I go about creating a list of nodes (title, teaser, posted by, date, the hook_links, etc. ) like what can be observed on the page WITHOUT using the Views Module? I wrote some code that can query the database and display it (title, teaser, date, posted by) the way I want, but I cannot figure out how to make the hook_links appear or make each of the items 'node' based. For example, I want modules e.g. Vote Up/Down Module that interact with the list of nodes to appear as well.
I think my approach to this is wrong? Can someone give me some advice?
Comments
Why not just use the path
Why not just use the path 'node', which produces the default front page.
Hmm... maybe my description
Hmm... maybe my description above wasn't very good. What I want is to create a page with a list of nodes (that looks like the front page - title, teaser, hook_links, other node widgets e.g. voting). I know this can be done with the Views Module, but I want the page hardcoded. I wrote some code that pulls out the information from the database, and I can theme it to look right but I cannot figure out how to get the hook_links and other nodes widgets (e.g. voting) to appear.
And why not use views?
And why not use views?
I am working on a 'My List'
I am working on a 'My List' type of page that has several arguments and relationships. Since I haven't been able to figure out how the internals of the View module works, I cannot create custom *.views.inc files for the views module in order to do arguments and relationships. Additionally, I didn't want a dependency on views module.
use the node_view
Hi..
I have been doing this all the time because I don't want to use views module just for one page.... here is how i do it:
when querying the database, i get the node id and then load it using the node_view function so that the teaser is rendered.
now, you can set in you admin configurations for the links to show up in the teaser, or customize your node.tpl.php page to show links in teasers ... this is a simple example. using this method, you can do almost all that views can do... its just the query that becomes complex... that's it.
hope that helps...
Sateesh Nutulapati
Devops Solutions Architect at New Target, Inc.
how about calling your code
how about calling your code directly from theme / page-front.tpl.php ?
that is what i actually meant
sorry if i confused you... but i was implying that you implement this on in the page-front.tpl.php only.....
Sateesh Nutulapati
Devops Solutions Architect at New Target, Inc.