<p style="margin-top: 1em;font-weight:bold">Enter your comments in the space below (registered site users only):</p>
[!UserComments? &canpost=`Registered Users, Site Admins` &makefolder=`0` &postcss=`comment` &titlecss=`commentTitle` &numbercss=`commentNum` &altrowcss=`commentAlt` &authorcss=`commentAuthor` &ownercss=`commentMe` &sortorder=`0`!]
[!UserComments? &canpost=`Registered Users, Site Admins` &makefolder=`0` &postcss=`comment` &titlecss=`commentTitle` &numbercss=`commentNum` &altrowcss=`commentAlt` &authorcss=`commentAuthor` &ownercss=`commentMe` &sortorder=`0`!]
<p> Next Article : Previous Article (with some logic to check if there is a now/next link to present to user?)
[!NewsListing? &startID=`42` &summarize=`3` &paginate=`1` &alwaysshow=`1`!]
Showing <strong>[+start+]</strong> - <strong>[+stop+]</strong> of <strong>[+total+]</strong> Articles
[+previous+] [+pages+] [+next+] <div> </div>
Is it possible to add links to navigate through blog entries?
//
// **************************
// Snippet: PrevNext
// By: Jeroen Bosch
// Date: februari 2005
// 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 = 'createdon'; // 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 = $modx->documentObject['parent']; // maybe this solves it all, but I'm not sure.
// (re)set the $id variable to the one of this document.
$id = $modx->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 = $modx->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'><div>";
if($displayFixed==true) {
$output .= "< <a href='[~".$my_array[1]['id']."~]'>first</a> ";
} else {
$output .= "< ";
}
if($prev > 0 && $displayTitle==false){
$output .= " <a href='[~".$my_array[$prev]['id']."~]'>prev</a> ";
} elseif($prev > 0 && $displayTitle==true) {
$output .= " <a href='[~".$my_array[$prev]['id']."~]'>".$my_array[$prev]['pagetitle']."</a> ";
}
$output .= " <a href='[~".$parentid."~]'> index </a> ";
if($next <= $limit && $displayTitle==false){
$output .= " <a href='[~".$my_array[$next]['id']."~]'>next</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']."~]'>last</a> >";
} else {
$output .= " >";
}
$output .= "</div></div><br />";
$output .= "";
return $output;
//
// **************************
// Snippet: PrevJumpNext
// By: Jeroen Bosch moded by OncleBen31
// Date: februari 2005
// 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 = 'createdon'; // 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 = $modx->documentObject['parent']; // maybe this solves it all, but I'm not sure.
// (re)set the $id variable to the one of this document.
$id = $modx->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 = $modx->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'><div>";
if($displayFixed==true) {
$output .= "< <a href='[~".$my_array[1]['id']."~]'>first</a> ";
} else {
$output .= "< ";
}
if($prev > 0 && $displayTitle==false){
$output .= " <a href='[~".$my_array[$prev]['id']."~]'>prev</a> ";
} elseif($prev > 0 && $displayTitle==true) {
$output .= " <a href='[~".$my_array[$prev]['id']."~]'>".$my_array[$prev]['pagetitle']."</a> ";
}
$output .= ' <form action="" name="jump1" style="display:inline;">
<select name="myjumpbox"
OnChange="location.href=jump1.myjumpbox.options[selectedIndex].value">
<option selected>Please Select...';
foreach ($my_array as $my_page) {
// $output .= ' <option value="'[~'.$my_page['id'].'~]">'.$my_page['title'];
$output .= ' <option value="[~'.$my_page['id'].'~]">'.$my_page['pagetitle'];
}
$output .= '</select></form> ';
if($next <= $limit && $displayTitle==false){
$output .= " <a href='[~".$my_array[$next]['id']."~]'>next</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']."~]'>last</a> >";
} else {
$output .= " >";
}
$output .= "</div></div><br />";
$output .= "";
return $output;