| Topic: | HOW TO: News Articles with Multiple Pages (prev/next) |
|---|---|
|
nate_02631
Professional
Posts: 3055 Posted: |
Do you want your news stories to be able to span multiple pages similar to the Sections with next page and previous page links? Below is replacment code for your News module's article.php (PN v .726) to let you do just that! Complete details on usage are included in the comments above the code, but in brief, you insert the text [!--pagebreak--] where you would like the news story to be paginated. The article.php script below passes extra variables to your theme for you to output links to the next and previous pages or other information about the pagination of the document. To be able to access the additional pages of your story, you must include the appropriate variables in the portion of your theme that controls the look of the "full" article. In theme.php it's the themearticle() function - or refer to the .html file referenced in that function. Notes on Usage: Create an images directory under your modules/News directory and copy the two "arrow" images from the modules/Sections/images directory called "left.gif" and "right.gif". You are welcome to replace these with your own indicators, but keep the filenames the same. Again, to actually output the extra links to other pages of your story, go to your theme and edit the appropriate section as described above. Preformatted values are provided for next/previous links and a "page list" link set to access any page directly. Info and Links arrays are also provided describing the total number of pages in the article, the page you are on, "raw" links to the next/prev pages and more! You can use the information provided therein to make the next/previous links appear any way you wish. Note that sometimes information for the next/previous/page span link is empty depending on the number of pages in the article or the page you are on - i.e. the previous link info is empty if you are on the first page. If using the $info and $link vars to customize your output, you might want to add program logic in your theme to check for the existence of these vars - for example: Codeif ($links['next_page']) { // echo the custom HTML using the $info, $links array for the "next" page link } If you are using the $preformat array to output the prev/next links etc.. you can just echo the vars you need for output. Also, all the extra variables are avaiable to the "themeindex()" portion of your theme, so you can for example, output the total number of pages in the home page news block instead of "x bytes more"... Without further ado, here is the code. The modifications were actually very minor, so if you are using a different version of article.php, note that only the initial "list" statement had the $page var added to it and a section of code was added after the initial story vars were fetched, but before the themearticle call (see the NJW MOD in the comments). You can paste in the code as you like to other versions or already modified article.php scripts. (Note: I removed a seemingly extranneous "$page = "modules/News/article.php"; line to allow for the use of that variable). Replace the modules/News/article.php with this code: Code<?php // File: $Id: article.php,v 1.10 2003/06/14 14:11:03 larsneo Exp $ $Name: $ // ---------------------------------------------------------------------- // POST-NUKE Content Management System // Copyright (C) 2001 by the Post-Nuke Development Team. // http://www.postnuke.com/ // ---------------------------------------------------------------------- // Based on PHP-NUKE Web Portal System // Copyright (C) 2001 by Francisco Burzi (fbc@mandrakesoft.com) // http://www.phpnuke.org/ // ---------------------------------------------------------------------- // LICENSE // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License (GPL) // as published by the Free Software Foundation; either version 2 // of the License, or (at your option) any later version. // // This program is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. // // To read the license please visit http://www.gnu.org/copyleft/gpl.html // ---------------------------------------------------------------------- // Original Author of this file: Francisco Burzi // Modified by Nathan Welch. Date: 11/28/2003 // Purpose of this file: Modification of the article.php file to allow // spanning of long news items. // ---------------------------------------------------------------------- // NOTE: This is a modified version of the article.php file for version .726 // of the Postnuke CMS by Nathan Welch. Changes to the file are enclosed in // comments marked with "NJW MOD". To use this modification you must have // arrow images similar to the "Sections" modules under a "images" directory // under the New module directory. Name the graphics left.gif and right.gif // // To make the next and previous links appear, you must also modify the portion // of your theme that displays the full article. In a "classic" theme.php, you // will find this section under the themearticle() function. Otherwise, refer // to your theme editing documentation for the appropriate file to modify. // // The following xtra variables are available to your theme to output links and page info: // $preformat['page_total'], $info['page_total'] - Total # of pages in the article // $preformat['page_current'], $info['page_current'] - Current article page being viewed // NOTE: If there is no next/previous page the following values will be empty as appropriate: // $preformat['next_page'] - Hyperlinked arrow graphic and text to next page // $links['next_page'] - URL of next page (to be included in an anchor tag) // $info['next_page'] - Page number of next page // $preformat['previous_page'] - Hyperlinked arrow graphic and text to previous page // $links['previous_page'] - URL of previous page (to be included in an anchor tag) // $info['previous_page'] - Page number of previous page // NOTE: If there is only one page in an particular article the following var will be null // $preformat['page_span'] - Numbered direct links to all pages in the article // // To specify pagebreaks in your article, use the string: [!--pagebreak--] // This is slightly different from the "comment style" pagebreak marker used // in sections. One advantage is that you can see it in a WYSIWYG editor. if (!defined('LOADED_AS_MODULE')) { die ('You can\'t access this file directly...'); } // NJW MOD - Add $page to list of variables to retreive from query string ('page') list ($save, $op, $mode, $order, $thold, $sid, $tid, $page) = pnVarCleanFromInput('save', 'op', 'mode', 'order', 'thold', 'sid', 'tid', 'page'); // NJW MOD END if ((empty($sid) && empty($tid)) || (!is_numeric($sid) && !is_numeric($tid))) { include 'header.php'; OpenTable(); echo _MODARGSERROR; CloseTable(); include 'footer.php'; } $ModName = $GLOBALS['name']; modules_get_language(); $pntable = pnDBGetTables(); include_once('modules/'.$ModName.'/funcs.php'); // eugenio themeover 20020413 // pnThemeLoad(); if (isset($save) && (pnUserLoggedIn())) { $uid = pnUserGetVar('uid'); $column = &$pntable['users_column']; $sql = "UPDATE $pntable[users] SET "; $sql .= "$column[umode]='" . pnVarPrepForStore($mode) . "', "; $sql .= "$column[uorder]='" . pnVarPrepForStore($order) . "', "; $sql .= "$column[thold]='" . pnVarPrepForStore($thold) . "'"; $sql .= " WHERE $column[uid]='" . pnVarPrepForStore($uid) . "'"; $dbconn->Execute($sql); } if ($op == "Reply") { pnRedirect('modules.php?op=modload&name=NS-Comments&file=index' .'&req=Reply&pid=0&sid='.$sid.'&mode=' .$mode.'&order='.$order.'&thold='.$thold); } // Get the article we're looking at $results = getArticles("{$pntable['stories_column']['sid']}='" . pnVarPrepForStore($sid) . "'", "", ""); $info = genArticleInfo($results[0]); if (!pnSecAuthAction(0, 'Stories::Story', "$info[aid]:$info[cattitle]:$info[sid]", ACCESS_OVERVIEW) || !pnSecAuthAction(0, 'Topics::Topic', "$info[topicname]::$info[tid]", ACCESS_READ)) { include 'header.php'; echo ''._NOTAUTHSTORY.' '.$info['title'].''; include 'footer.php'; exit; } $links = genArticleLinks($info); $preformat = genArticlePreformat($info, $links); // NJW MOD - split content of main body text based on "pagebreak" tag $contentpages = explode( '[!--pagebreak--]', $info['maintext'] ); $pageno = count($contentpages); // Set page to first page if empty or an invalid # if (empty($page) || $page < 1) { $page = 1; } // Set page to last page if greater than total number of pages if ($page > $pageno) $page = $pageno; $arrayelement = (int)$page; $arrayelement --; $info['page_total'] = $pageno; $preformat['page_total'] = $pageno; $info['page_current'] = $page; $preformat['page_current'] = $page; // Set the body text to be passed to the theme. If on the first page, include // the stories opening text in the "fulltext" of the article. // Include the appropriate $info or $preformat variable as usual in your theme // to display the body text. if ($page == 1) { $info['fulltext'] = $info['hometext'].'<BR><BR>'.$contentpages[$arrayelement]; $preformat['fulltext'] = $preformat['hometext'].'<BR><BR>'.$contentpages[$arrayelement]; } else { $info['fulltext'] = $contentpages[$arrayelement]; $preformat['fulltext'] = $contentpages[$arrayelement]; } $info['maintext'] = $contentpages[$arrayelement]; $preformat['maintext'] = $contentpages[$arrayelement]; // Add extra $preformat, $info & $links variables for the previous/next links // passed to the theme ('previous_page' and 'next_page'). if ($page >= $pageno) { $preformat['next_page'] = ''; $info['next_page'] = ''; $links['next_page'] = ''; } else { $next_pagenumber = $page + 1; $preformat['next_page'] = '<a class="pn-normal" href="modules.php?op=modload&name=' .$GLOBALS[ModName]. '&file=article&sid=' .$info['sid']. '&mode=thread&order=0&thold=0&page=' .$next_pagenumber. '" class="pn-normal">' ._NEXT. ' (' .pnVarPrepForDisplay($next_pagenumber). '/' .pnVarPrepForDisplay($pageno). ')<img src="modules/' .pnVarPrepForOS($GLOBALS['name']). '/images/right.gif" border="0" hspace="3" align="absmiddle" alt="'._NEXT.'"></a>'; $info['next_page'] = $next_pagenumber; $links['next_page'] = 'modules.php?op=modload&name=' .$GLOBALS[ModName]. '&file=article&sid=' .$info['sid']. '&mode=thread&order=0&thold=0&page=' .$next_pagenumber; } if ($page <= 1) { $preformat['previous_page'] = ''; $info['previous_page'] = ''; $links['previous_page'] = ''; } else { $previous_pagenumber = $page - 1; $preformat['previous_page'] = '<a href="modules.php?op=modload&name=' .$GLOBALS[ModName]. '&file=article&sid=' .$info['sid']. '&mode=thread&order=0&thold=0&page=' .$previous_pagenumber. '" class="pn-normal"><img src="modules/' .pnVarPrepForOS($GLOBALS['name']). '/images/left.gif" border="0" hspace="3" align="absmiddle" alt="'._PREVIOUS.'">'._PREVIOUS.' ('.$previous_pagenumber.'/'.$pageno.')</a>'; $info['previous_page'] = $previous_pagenumber; $links['previous_page'] = 'modules.php?op=modload&name=' .$GLOBALS[ModName]. '&file=article&sid=' .$info['sid']. '&mode=thread&order=0&thold=0&page=' .$previous_pagenumber; } if ($pageno > 1) { for ($i = 1; $i <= $pageno; $i++) { if ($i != $page) $preformat['page_span'] .= '[<a href="modules.php?op=modload&name=' .$GLOBALS[ModName]. '&file=article&sid=' .$info['sid']. '&mode=thread&order=0&thold=0&page=' .$i. '" class="pn-normal">' .$i. '</a>] '; else $preformat['page_span'] .= '<b>['.$i.']</b> '; } } else { $preformat['page_span'] = ''; } // NJW MOD END $column = &$pntable['stories_column']; $dbconn->Execute("UPDATE $pntable[stories] SET $column[counter]=$column[counter]+1 WHERE $column[sid]='" . pnVarPrepForStore($sid) . "'"); // set theme overrides prior to header $themeOverrideCategory = $info['catthemeoverride']; $themeOverrideStory = $info['themeoverride']; $artpage = 1; include ('header.php'); $artpage = 0; // Backwards compatibility formatTimestamp(GetUserTime($info['time'])); $notes = $info['notes']; echo "<table width=\"100%\" border=\"0\"><tr><td valign=\"top\" width=\"85%\">\n"; if ($GLOBALS['postnuke_theme']) { themearticle($info['aid'], $info['informant'], $info['time'], $info['catandtitle'], $preformat['maintext'], $info['topic'], $info['topicname'], $info['topicimage'], $info['topictext'], $info, $links, $preformat); } else { themearticle($info['aid'], $info['informant'], $info['time'], $info['catandtitle'], $preformat['maintext'], $info['topic'], $info['topicname'], $info['topicimage'], $info['topictext']); } if(pnConfigGetVar('nobox') == 0) { echo "</td><td> </td><td valign=\"top\">\n"; $column = &$pntable['blocks_column']; $myquery = buildSimpleQuery ('blocks', array ('active', 'position', 'weight'), "$column[bkey]='login'"); $result = $dbconn->Execute($myquery); while(list($active, $position, $weight) = $result->fields) { $result->MoveNext(); if($active == '1' && $position == 'r'){ $row = array(); pnBlockShow('Core', 'login', array('position' => 'r')); } } // Only do topic things if the story had a topic if (!empty($info['tid'])) { $boxtitle = _RELATED; $boxstuff = "<font class=\"pn-normal\">"; $column = &$pntable['related_column']; $myquery = buildSimpleQuery ('related', array ('name', 'url'), "$column[tid]=$info[tid]"); $result = $dbconn->Execute($myquery); while(list($name, $url) = $result->fields) { $result->MoveNext(); $boxstuff .= "<strong><big>·</big></strong> <a class=\"pn-normal\" href=\"$url\" target=\"new\">$name</a><br>\n"; } $boxstuff .= "<strong><big>·</big></strong> <a class=\"pn-normal\" "; $boxstuff .= "href=\"modules.php?op=modload&name=Search&file=index&"; $boxstuff .= "action=search&overview=1&active_stories=1&"; $boxstuff .= "stories_topics[0]=$info[tid]\""; $boxstuff .= ">"._MOREABOUT." $info[topictext]</a><br>\n"; $boxstuff .= "<strong><big>·</big></strong> <a class=\"pn-normal\" "; $boxstuff .= "href=\"modules.php?op=modload&name=Search&file=index&"; $boxstuff .= "action=search&overview=1&active_stories=1&"; $boxstuff .= "stories_author=$info[informant]\""; $boxstuff .= ">"._NEWSBY." $info[informant]</a><br>\n"; // $boxlink is not defined and can't be found. Not sure what this code is doing. Comment it out - Skooter. //$boxstuff .= $boxlink; $boxstuff .= "</font><br><hr noshade width=\"95%\" size=\"1\"><div align=\"center\"><font class=\"pn-normal\">"._MOSTREAD." $info[topictext]:<br>\n"; // Last story on this topic $column = &$pntable['stories_column']; $results = getArticles("$column[topic]=$info[tid]", "$column[counter] DESC", 1); // # solve on bug #524506 // $ta_row = $results[0]; $ta_info = genArticleInfo($ta_row); $ta_links = genArticleLinks($ta_info); $ta_preformat = genArticlePreformat($ta_info, $ta_links); $boxstuff .= "$ta_preformat[title]</font></div><br>"; $boxstuff .= "<table border=\"0\" width=\"100%\"><tr><td align=\"left\">\n"; $boxstuff .= "</td><td align=\"right\">\n"; $boxstuff .= "</td></tr></table>\n"; $tbl = 180; $box['title'] = $boxtitle; $box['content'] = $boxstuff; $box['position'] = 'r'; themesideblock($box); } } $tbl = 0; echo "</td></tr></table>\n"; // added display hook - bug #174 - ferenc veres echo pnModCallHooks('item', 'display', $sid, "modules.php?op=modload&name=News&file=article&sid=$sid"); if ($info['withcomm'] == 0) { if ($GLOBALS['mode'] != 'nocomments') { if (pnSecAuthAction(0, 'Stories::Story', "$info[aid]:$info[cattitle]:$info[sid]", ACCESS_READ)) { include('modules/NS-Comments/index.php'); } } } include ('footer.php'); ?> Additional note: If you want to put in *really* long stories, the existing field for this in the stories table seems to have an upper limit, you can likely remedy this by changing it to a BLOB field... Below is some code you can paste into your theme (make sure you are in HTML "mode" in the script b4 pasting in) for debugging purposes. Enjoy! Code<P>Total page (pf) <?= $preformat['page_total'] ?><BR> Total page (info) <?= $info['page_total'] ?><BR><BR> current page (pf) <?= $preformat['page_current'] ?><BR> current page (info) <?= $info['page_current'] ?><BR><BR> Span Links (pf) <?= $preformat['page_span'] ?><BR><BR> next (pf) <?= $preformat['next_page'] ?><BR> next (link) <?= $links['next_page'] ?><BR> next (info) <?= $info['next_page'] ?><BR><BR> prev (pf) <?= $preformat['previous_page'] ?><BR> prev (link) <?= $links['previous_page'] ?><BR> prev (info) <?= $info['previous_page'] ?></P> Modifying your Printer Friendly Page P.S. If you plan on using printer-friendly pages on your site, you'll want to add a *small* bit of code so the pagebreak markers don't show up in your printable story text. Insert *either* or the code snippets below in the print.php file in your PN root directory - look for the comment line "//changed to local stylesheet" and put it just above that. If you want to remove the page markers completely, insert this code, just above where the style sheet is output for that page: Code// Remove the pagebreak markers from the bodytext if (!empty($bodytext)) $bodytext = preg_replace("/\[!--pagebreak(=.*){0,1}--]/i", "<BR><BR>", $bodytext); If you would like to retain the pagemarkers titles as subheadings (if you have "named" the subpages), insert the code below into your print.php file: Code// Replace the pagebreak markers with subheadings if (!empty($bodytext)) { $contentpages = preg_split("/\[!--pagebreak(=.*){0,1}--]/i", $bodytext, -1, PREG_SPLIT_NO_EMPTY); $pageno = count($contentpages); preg_match_all("/\[!--pagebreak(=.*){0,1}--]/i", $bodytext, $page_title, PREG_SET_ORDER); for ($i = 1; $i <= $pageno; $i++) { $this_page = substr($page_title[$i-1][1],1); $contentpages[$i] = '<BR><B>'.$this_page.'</B><BR>'.$contentpages[$i]; } $bodytext = implode($contentpages); } Note that no title will be output if you did not assign one to that page and no "Introduction" title will be output for the first page. -- Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods Cape Cod Travel Info... |
|
mulpppn
Softmore
Posts: 92 Posted: |
This would be REALLY nice: a page splitter that would work as Sitepoint's, to name one: drop-down or list menu w/ pages titles. (your related stories would work as this, but anyway...) X's, Murilo -- http://sf.net/projects/pnlanguages http://noc.postnuke.com/projects/pnlanguages http://www.emlondrina.com http://www.stj.gov.br http://abraji.org.br PN(+)emlondrina.com BSB/DF/BRazil |
|
nate_02631
Professional
Posts: 3055 Posted: |
Funny you mention that as that very site was responsible for my inspiration. I haven't the code for it, but I imagine it could go something like this: Optionally allow the pagebreak identifier to be: [!--pagebreak="Name of Page"--] The part of the script above that does the "split" could do it based on a regular expression of "[!--pagebreak...--]" (not my forte, those regex's - must be my dislexia) A second pass on the story text could be made to pluck out the stuff between the quotes of any pagebreak markers and put them into an array (eregi?). If no ="Page Name" is specified, the value "Page X" is used. Finally, a bulletted list of all page names with links to the pages could be built ($preformat['page_list']?), as well as having extra $preformat and $info values for "next_page_name", "previous_page_name" and "page_current_name" to echo links and/or text to the names of those pages... It's intriguing - I'd take a crack at it, except I'm fuzzy on the regular expressions and the subsequent fetching of the page name between the quotes... It would have to be so [!--pagebreak--] or [!--pagebreak="Page Name"--] could both be used... Might be a nice enhancement to the PN .8 News module (though they have pagination numbering already) as I don't see how this could be accomplished through the use of templates. -- Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods Cape Cod Travel Info... |
|
nate_02631
Professional
Posts: 3055 Posted: |
Enhanced Pagination a là "Sitepoint": Well, you asked for it, you got it... The following mod to the mod above allows you to *name* the different pages in your news story like the SitePoint.Com website mentioned above. Instead of using [!--pagebreak--] to mark the pages, you can optionally use [!--pagebreak=Page Name--] to name the following page. Extra values are passed to your theme which you can use as subtitles or enhanced links or "breadcumbs" for your news story (described below). Special notes: The first page is named "Introduction" and cannot be named. If a name is not specified in the pagebreak, the name of the page will be "Page X". (You can, of course, alter any of these values in the code below) The extra values passed to your theme (to be echoed and/or optionally combined with presentation logic) are: $preformat['page_list'] - A bulleted and linked list of the named pages in your news article. The current page in the list will not be linked. Value will be empty if story is only one page. $info['page_current_name'] - Name of the current page ("Introduction" if the first and/or only page) $info['next_page_name'] - Name of the next page (blank if on the last or only page) $info['previous_page_name'] - Name of the previous page (blank if on the first or only page) $preformat['next_page_name'] - Hyperlinked name of the next page. $preformat['previous_page_name'] - Hyperlinked name of the previous page. Replace the code between the Code// NJW MOD - split content of main body text based on "pagebreak" tag ..etc.. // NJW MOD END in the script above, with the following (sorry about the messy indents!)... Code// NJW MOD - split content of main body text based on "pagebreak" tag // Pagebreak tag default is [!--pagebreak--], however you can assign a title to the page // (except the first page, which is titled "Introduction"), by using this syntax: // [!--pagebreak=Name of Page--] which will name the following page "Name of Page" $contentpages = preg_split("/\[!--pagebreak(=.*){0,1}--]/i", $info['maintext'], -1, PREG_SPLIT_NO_EMPTY); $pageno = count($contentpages); preg_match_all("/\[!--pagebreak(=.*){0,1}--]/i", $info['maintext'], $page_title, PREG_SET_ORDER); // Set page to first page if empty or an invalid # if (empty($page) || $page < 1) { $page = 1; } // Set page to last page if greater than total number of pages if ($page > $pageno) $page = $pageno; $arrayelement = (int)$page; $arrayelement --; $info['page_total'] = $pageno; $preformat['page_total'] = $pageno; $info['page_current'] = $page; $preformat['page_current'] = $page; // Set the body text to be passed to the theme. If on the first page, include // the stories opening text in the "fulltext" of the article. // Include the appropriate $info or $preformat variable as usual in your theme // to display the body text. if ($page == 1) { $info['fulltext'] = $info['hometext'].'<BR><BR>'.$contentpages[$arrayelement]; $preformat['fulltext'] = $preformat['hometext'].'<BR><BR>'.$contentpages[$arrayelement]; $info['page_current_name'] = 'Introduction'; } else { $info['fulltext'] = $contentpages[$arrayelement]; $preformat['fulltext'] = $contentpages[$arrayelement]; $info['page_current_name'] = substr($page_title[$page-2][1],1); if (!$info['page_current_name']) $info['page_current_name'] = 'Page '.$page; } $info['maintext'] = $contentpages[$arrayelement]; $preformat['maintext'] = $contentpages[$arrayelement]; // Add extra $preformat, $info & $links variables for the previous/next links // passed to the theme ('previous_page' and 'next_page'). if ($page >= $pageno) { $preformat['next_page'] = ''; $info['next_page'] = ''; $info['next_page_name'] = ''; $links['next_page'] = ''; $preformat['next_page_name'] = ''; } else { $next_pagenumber = $page + 1; $preformat['next_page'] = '<a class="pn-normal" href="modules.php?op=modload&name=' .$GLOBALS[ModName]. '&file=article&sid=' .$info['sid']. '&mode=thread&order=0&thold=0&page=' .$next_pagenumber. '" class="pn-normal">' ._NEXT. ' (' .pnVarPrepForDisplay($next_pagenumber). '/' .pnVarPrepForDisplay($pageno). ')<img src="modules/' .pnVarPrepForOS($GLOBALS['name']). '/images/right.gif" border="0" hspace="3" align="absmiddle" alt="' ._NEXT. '"></a>'; $info['next_page'] = $next_pagenumber; $info['next_page_name'] = substr($page_title[$next_pagenumber-2][1],1); if (!$info['next_page_name']) $info['next_page_name'] = 'Page '.$next_pagenumber; $links['next_page'] = 'modules.php?op=modload&name=' .$GLOBALS[ModName]. '&file=article&sid=' .$info['sid']. '&mode=thread&order=0&thold=0&page=' .$next_pagenumber; $preformat['next_page_name'] = '<a href="modules.php?op=modload&name=' .$GLOBALS[ModName]. '&file=article&sid=' .$info['sid']. '&mode=thread&order=0&thold=0&page=' .$next_pagenumber. '" class="pn-normal">'.$info['next_page_name'].'</a>'; } if ($page <= 1) { $preformat['previous_page'] = ''; $info['previous_page'] = ''; $info['previous_page_name'] = ''; $links['previous_page'] = ''; $preformat['previous_page_name'] = ''; } else { $previous_pagenumber = $page - 1; $preformat['previous_page'] = '<a href="modules.php?op=modload&name=' .$GLOBALS[ModName]. '&file=article&sid='.$info['sid'].'&mode=thread&order=0&thold=0&page=' .$previous_pagenumber. '" class="pn-normal"><img src="modules/' .pnVarPrepForOS($GLOBALS['name']). '/images/left.gif" border="0" hspace="3" align="absmiddle" alt="' ._PREVIOUS. '">' ._PREVIOUS. ' (' .$previous_pagenumber. '/' .$pageno. ')</a>'; $info['previous_page'] = $previous_pagenumber; $info['previous_page_name'] = substr($page_title[$previous_pagenumber-2][1],1); if ($page == 2) $info['previous_page_name'] = 'Introduction'; if (!$info['previous_page_name']) $info['previous_page_name'] = 'Page '.$previous_pagenumber; $links['previous_page'] = 'modules.php?op=modload&name=' .$GLOBALS[ModName]. '&file=article&sid=' .$info['sid']. '&mode=thread&order=0&thold=0&page=' .$previous_pagenumber; $preformat['previous_page_name'] = '<a href="modules.php?op=modload&name=' .$GLOBALS[ModName]. '&file=article&sid=' .$info['sid']. '&mode=thread&order=0&thold=0&page=' .$previous_pagenumber. '" class="pn-normal">'.$info['previous_page_name'].'</a>'; } if ($pageno > 1) { $preformat['page_list'] = '<UL>'; for ($i = 1; $i <= $pageno; $i++) { if ($i == 1) $this_page = 'Introduction'; else $this_page = substr($page_title[$i-2][1],1); if (!$this_page) $this_page = 'Page '.$i; if ($i != $page) { $preformat['page_span'] .= '[<a href="modules.php?op=modload&name=' .$GLOBALS[ModName]. '&file=article&sid='.$info['sid'].'&mode=thread&order=0&thold=0&page='.$i.'" class="pn-normal">' .$i. '</a>] '; $preformat['page_list'] .= '<LI><a href="modules.php?op=modload&name=' .$GLOBALS[ModName]. '&file=article&sid=' .$info['sid']. '&mode=thread&order=0&thold=0&page=' .$i. '" class="pn-normal">' .$this_page. '</a></LI>'; } else { $preformat['page_span'] .= '<b>['.$i.']</b> '; $preformat['page_list'] .= '<LI><B>'.$this_page.'</B></LI>'; } } $preformat['page_list'] .= '</UL>'; } else { $preformat['page_span'] = ''; } // NJW MOD END It's a great way to break up stories, I think (thanks for the prod, mulpppn). Any questions, just ask! P.S. If anyone has a method as to how something similar would be accomplished with the upcoming PN .8 & pnRender, I'd love to hear about it! IMPORTANT NOTE: Refer to the bottom of the first post above for changes you'll want to make to print.php if using "Printer-Friendly" pages -- Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods Cape Cod Travel Info... |
|
mulpppn
Softmore
Posts: 92 Posted: |
I don't have the time to delve into your code, but it's amazing! Nice job, anyway! And thanks a lot for all your tutorials. X's, Murilo |
|
nate_02631
Professional
Posts: 3055 Posted: |
mulpppnI don't have the time to delve into your code This is a "no delve" zone... Just cut n' paste! mulpppnAnd thanks a lot for all your tutorials. You're welcome! -- Get PhotoGallery, PayPalCart, Dynamenu, Enhanced Blocks & other mods Cape Cod Travel Info... |
|
mulpppn
Softmore
Posts: 92 Posted: |
Cut 'n' Paste if you have the standard news mod, I suppose Thanks again. Murilo -- http://sf.net/projects/pnlanguages http://noc.postnuke.com/projects/pnlanguages http://www.emlondrina.com http://www.stj.gov.br http://abraji.org.br PN(+)emlondrina.com BSB/DF/BRazil |
|
nate_02631
Professional
Posts: 3055 Posted: |
No problem... If you don't have the standard "article.php" file in your News module, read the paragraph (carefully) in the first post just before the code... This mod is actually just one *minor* change at the top of the article.php script and then some new code (between the //NJW MOD comments) pasted in the appropriate place (in which case you can paste the second post with the "SitePoint" mod, if you lke) |