blog first page to display all posts instead of teasers

raphaeltsr - March 31, 2008 - 18:52

Hello Community,

I've created a blog on my new drupal site and when I access the main page of my blog (blog/1) it displays the teaser of each post I've created.

I wanted to display the complete post on this page. Is it possible?

Thanks!! :)

Doing some research on my

raphaeltsr - March 31, 2008 - 19:47

Solved it using the following snippet in the node-blog.tpl.php

<?php
if($teaser) :
//displays the teaser

//query - select the body content according to the nid
$query = db_query("SELECT n.body FROM {node_revisions} n WHERE n.nid = %d", $node->nid);
$f = db_fetch_array($consulta); //fetches query

//print the body content instead of the teaser
print $f["body"];

else :
//displays the other content possibilties
print $node->body;

endif;
?>

This type of solution is

ultimateboy - March 31, 2008 - 19:55

This type of solution is generally frowned upon in drupal.. Although it will work, there are other options.

If you are working with a simple site, simply changing the size of teasers to unlimited might be a simple and easy solution. You can do this via the Admin > Content Management >Post Settings (admin/content/node-settings). Simply select unlimited. You might have to go and re-save any content that you have previously created in order for these changes to take effect.

The next option is to create a new view which displays the entire node rather than the teaser. The View Module is extremely powerful. A simple page view which outputs all published blogs in a full node view should do the trick.

I hope you take the time to read this post and try to implement what I have discussed about using views. Although your code snippet might work, this is a prefect time to be introduced to the power of views.

--matt tucker
http://www.monarch-digital.com

Good to know! :) Many

raphaeltsr - March 31, 2008 - 20:06

Good to know! :) Many thanks!

Drupal 5.x makes working with teasers a little bit harder than 6.1 :(

 
 

Drupal is a registered trademark of Dries Buytaert.