0
votes

I'm making a blog, but I don't have a large experience with Drupal (I'm using Drupal 6).

The index page should have a post with full content and the next 10 posts showing the teaser. I want to know how to show the full content of just the first loaded node.

I'm hitting my head against the keyboard for hours, but I can't get a simple solution for it. I've tried to see all defined_vars and all are filled with the teaser, I've tried to use node_view($node->nid) but it seems to enter in a infinite recursion. I've been searching a lot in Google, but nothing seems to satisfy.

I guess that I don't need to use the View module for it, cause I just wanna change the $teaser = true to false when I get loaded a node.

Someone have an idea for it?

Thank you all!

3
Are you trying to do this in a teaser's page? node's page? or where?yoavmatchulsky

3 Answers

2
votes

I'd recommend using the Views module for that. As you're getting familiar with Drupal, it's important to get familiar with Views because once you do, you'll start finding more and more places to use it.

1
votes

Like Matt V. said, use the Views module... but to be more specific..

1) Create a new view with filter node type = blog, node published = yes

2) Create a "page display" (left side of views UI, select page -> add display)

3) on the page display set "items per page" to 1, set row style to node, and select full node. then set the URL of your blog "index" page

4) Create a "block display" (left side of views UI, select block -> add display)

5) on the block display, set "items per page" to 10, set row style to node, and select teaser.

6) save the view, go to /admin/build/block, and add the blog block view to the bottom of your content region. in the block settings, ( click "configure" -> radio button for "show only on pages listed below" -> enter your blog "index" URL.

boom. views.

So in summary you are using the views module to create a single node view, with 2 displays. 1 display is a page with 1 full node, the other display is a block with 10 teaser nodes.

You'll probably want to tinker with the sort criteria on both displays, and the offset field (under "items per page" settings) on the block display (so the block doesn't show the same result that the page is showing).

This dude does something similar: http://www.designtotheme.com/tutorials/views-and-offsets-grouping-multiple-displays-one-view

good luck!!

0
votes

Views is a great fit for your problem. If you use views you can create a view for all the teasers and then add the full node view as the view header or use a view theme. a view theme gives you allot of flexibility.

If you want to do everything programmatically, try this to load the node.

$node = node_load($nid);
$content = node_build_content($node);

if that doesn't work try

$node = node_load($nid);
$node = (object)$node; // may need to cast to an object
$content = node_build_content($node);