By drupaceous on
Hi,
how do I post the (eg) 5 most recent posted nodes on the frontpage?
I put in page.tpl.php something like this:
<?php if($is_front):
$listlength="5";
$content_type = 'image';
$result1 = pager_query(db_rewrite_sql("SELECT n.nid, n.created FROM {node} n WHERE n.type = '$content_type' AND n.status = 1 ORDER BY n.created DESC"), $listlength);
while ($node = db_fetch_object($result1)) {
$output .= node_view(node_load(array('nid' => $node->nid)), 1);
}
print $output;
<?php endif; ?>
It's an oversimplified version of a snippet I found elsewhere on this site. This works fine, but I still get the welcome page from drupal below my postings. So how can I get rid of that?
To see what I mean: http://sandbox.bumblebee.be
Thanks,
Chris
Comments
quick one
HI Chris,
Follow these steps.
Now when you go to the front page of your site, that node list page will be picked up and since you have now added a node to your site, the "welcome to your drupal site" message will dissapear.
hope that makes sense
Dub
Currently in Switzerland working as an Application Developer with UBS Investment Bank...using Drupal 7 and lots of swiss chocolate
Wow, that was indeed quick!
Wow, that was indeed quick! :-) Makes perfect sense too. Thanks a lot!
??-- How do we get page.tpl.php to display as frontpage
Hello Dub & Drupal Nation,
Have a question which I believe to be simple, but I am wrecking my brain over it.
We would like the current content of our page.tpl.php to be both our front and home page (display @ www.examplesite.com). We have been of the understanding that page.tpl.php should be the default page layout for all pages, unless, there were some custom overrides in place which there are not.
We currently have "node" input in the default front page field of General Setting. This provides a listing of all nodes promoted to the front page, but not our desired page layout as depicted in page.tpl.php.
1) how do we get the contents of our page.tpl.php to display as our front page?
2) what should we input in the default front page field of General Settings so that the contents of our page.tpl.php displays?
Thank u for your time and interest. It is appreciated very much.....
Another easy one
Another easy way is to install the Views module and filter the front page to show some impossible node for example:
display
filter: title - is equal to = "sdfksjdfhsefuywetowietpwetjk"
/M