//
// **************************
// Snippet: PrevNext
// By: Jeroen Bosch
// Date: februari 2005
// for: Etomite 0.6
// version: 0.9
// **************************
//
// Function:
// Generates a simple previous and next button. very
// handy on top or bottom of each individual newspost/log item
// Highly configurable. It can display document titles
// and add 'first' and 'last' to the options.
//
// You can set every option with the snippet call.
// example:
// [[PrevNext?sortBy=menuindex&sortHow=ASC&displayTitle=true]]
# Settings
# Sort items by? 'menuindex' or 'id' or 'createdon'
if(!isset($sortBy)){
$sortBy = 'menuindex'; // default in NewsListing-snippet
}
# Sort items How? 'ASC' or 'DESC'
if(!isset($sortHow)){
$sortHow = 'ASC'; // default in NewsListing-snippet
}
# Show 'prev' and 'next' or display document titles?
if(!isset($displayTitle)){
$displayTitle = true;
}
# Show 'first' and 'last'
if(!isset($displayFixed)){
$displayFixed = false;
}
// The code:
// Get the parent ID
$parentid = $etomite->documentObject['parent']; // maybe this solves it all, but I'm not sure.
// (re)set the $id variable to the one of this document.
$id = $etomite->documentIdentifier;
// select the other members in this folder -- See: NOTE 1
$fields='id,pagetitle,isfolder'; // what fields do you want to know
$children = $etomite->getActiveChildren($parentid, $sortBy, $sortHow, $fields);
// the number of selected documents
//$limit = $etomite->recordCount($children);
$limit = count($children);
// set $y to zero
$y = 1;
// sorting the documents, giving them a sequential and searchable index
foreach ($children as $child) {
$my_array[$y] = $child;
if ($my_array[$y]['id']==$id)
{
$current=$y; // The current page has number $y in the array
}
$y++;
}
$prev = $current-1;
$next = $current+1;
// Here starts the output
$output = "";
$output .= "<div class='PrevNextMenu' align=right>";
if($displayFixed==true) {
$output .= "< <a href='[~".$my_array[1]['id']."~]'>prva</a> | ";
}
else {
$output .= "< ";
}
if($prev > 0 && $displayTitle==false){
$output .= " <a href='[~".$my_array[$prev]['id']."~]'>nazaj</a> ";
}
elseif($prev > 0 && $displayTitle==true){
$output .= " <a href='[~".$my_array[$prev]['id']."~]'>".$my_array[$prev]['pagetitle']."</a> ";
}
$output .= "| <a href='[~".$parentid."~]'> domov </a> |";
if($next <= $limit && $displayTitle==false){
$output .= " <a href='[~".$my_array[$next]['id']."~]'>naprej</a> ";
}
elseif($next <= $limit && $displayTitle==true) {
$output .=" <a href='[~".$my_array[$next]['id']."~]'>".$my_array[$next]['pagetitle']."</a> ";
}
if($displayFixed==true) {
$output .= " | <a href='[~".$my_array[$limit]['id']."~]'>zadnja</a> >";
}
else {
$output .= " >";
}
$output .= "</div>";
$output .= "";
return $output;
Page 1 of 1
[slovenian] Prevnext Slovenski prevod
#1
Posted 23 February 2006 - 07:11 AM
Share this topic:
Page 1 of 1


Help
Back to top
MultiQuote








