Block navigation/slider for nodes

sanjith - July 3, 2009 - 05:53

Hi,
I am new to Drupal ,
How to create a node navigation(previous and next) based on their title & type ?
Now I did using SQL Query in tpl files !
But is there any module to create this type of navigation !

*****************

Please Guide ME !

***************

I am using below code currently :

<?php
/*
*Previous
*/
$psql="select nid, title from node where type='".$node->type."'and title <'".$node->title."' order by title DESC limit 1";
$pres=db_query($psql);
$pitem=db_fetch_object($pres);
if(
$pitem->nid!='')
{
print
"<div id='previous' style='float:left;'>";
print
l(t('Previous'),'node/'.$pitem->nid);
print
"</div>";
}

/*
*Next node
*/
$nsql="select nid, title from node where type='".$node->type."'and title >'".$node->title."' order by title ASC limit 1";
$nres=db_query($nsql);
$nitem=db_fetch_object($nres);
if(
$nitem->nid!='')
{
print
"<div id='next' style='float:right;'>";
print
l(t('Next'),'node/'.$nitem->nid);
print
"</div>";
}
?>

Use Views Module

sudhanshu.cms - July 3, 2009 - 06:44

This functionality can be setup by Views modules.
Views module provide a way to create a list of nodes or users, depending on certain criteria. You can either create a page or a block for list.
You can also select specific fields of nodes which you are willing to display.
Views also provide pager functionality that will fulfill your requirement.
Views provide some sorting option as well so you can sort the list.
Visit its project page url is http://drupal.org/project/views for detailed information and download module.

Thanks 4 ur Reply!

sanjith - July 9, 2009 - 05:11

I had created a new content type ( with more than 20 fields) !
I like to theme that input form !
What should I do?

I was using this code in template.php file

<?php
   
'recipes_node_form' => array(
       
'arguments' => array('form' => NULL),
       
'template' => 'recipes-edit',
?>

I had placed this code in the tpl file...

<?php
print_r
($form);
?>

It's working ! but I don't know how to individually get the field's !

Please Guide me !

 
 

Drupal is a registered trademark of Dries Buytaert.