0

I currently have a page template set up in its page-node-946.tpl.php. $content is being populated by that node numbers content. I need to loop through and display a teaser for all content nodes and certain type. I need some instruction on how to do it. Maybe I've gone wrong by trying to do this with a page-node template.

1

You can use Views for looping throug nodes. Just build Views that show list of certain nodes, then call it into your template file, like this: print views_embed_view('VIEWNAME', 'DISPLAY_ID');

But creating for each page one node template file is not good way for this (you will got many count of this page-node-XXX.tpl.php files, for serving all of these you will take more time, even you want to change something little), node-TYPE.tpl.php will better with more common page.tpl.php.

p.s. Also customizing page via Panels without template have better UI.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy