You are missing our premiere tool bar navigation system! Register and use it for FREE!

•  Home •  Downloads •  Gallery •  Your Account •  Forums • 
Readme First
- Readme First! -

Read and follow the rules, otherwise your posts will be closed
· Home
· Buy a Theme
· Advertising
· AvantGo
· Bookmarks
· Columbia
· Community
· Donations
· Downloads
· Feedback
· Forums
· Private Messages
· Search
· Statistics
· Stories Archive
· Submit News
· Surveys
· Theme Gallery
· Top
· Topics
· Your Account
Who's Online
There are currently, 295 guest(s) and 0 member(s) that are online.

You are Anonymous user. You can register for free by clicking here
How to get multipage News articles

14.4.1. How to get multipage News articles

It appears that while Reviews, Section, and Content areas allow multipage bodies, the general News article does not. Contrary to what one would think, if you want to add such functionality in the News module, the code under modules/News/ is not the right place. The right place is the themearticle() in the theme.php file of your theme!

This is so, because it is the themearticle() function that outputs the article text, through a call to the FormatStory() function (which is also defined in theme.php):

FormatStory($thetext, $notes="", $aid, $informant);

Thus, all we have to do is format $thetext accordingly, before it is passed to FormatStory. Just add the following code to the begining of the themearticle() function in theme.php, like this[1] (see Multipage articles, Pagebreaks in articles):

function themearticle ($aid, $informant, $datetime, $title, $thetext, 
$topic, $topicname, $topicimage, $topictext) {
global $admin, $sid, $tipath, $page;
$contentpages = explode( "<!--pagebreak-->", $thetext );
$pageno = count($contentpages);
if ( $page=="" || $page < 1 )
$page = 1; 
if ( $page > $pageno )
$page = $pageno;
$arrayelement = (int)$page;
$arrayelement --;
if ($pageno > 1) {
$thetextNew .= "Page: $page/$pageno<br>";
$thetextNew .= "<p align=\"justify\">$contentpages[$arrayelement]</p>";
if($page >= $pageno) {
$next_page = "";
} else {
$next_pagenumber = $page + 1;
if ($page != 1) {
$next_page .= "- ";
$next_page .= "<a href=\"article.html$sid
&page=$next_pagenumber\">"._NEXT." ($next_pagenumber/$pageno)</a> 
<a href=\"article.html$sid&page=$next_pagenumber\">
<img src=\"images/right.gif\"border=\"0\" alt=\""._NEXT."\"></a>";
if ($page == $pageno) {
$thetextNew .= "<br><p align=\"justify\">".nl2br($mypage[page_footer])."</p><br><br>";
if($page <= 1) { 
$previous_page = "";
} else {
$previous_pagenumber = $page - 1;
$previous_page = "<a href=\"article.html$sid
<img src=\"images/left.gif\" border=\"0\" alt=\""._PREVIOUS."\"></a> 
<a href=\"article.html$sid
&page=$previous_pagenumber\">"._PREVIOUS." ($previous_pagenumber/$pageno)</a>";
$thetextNew .= "<br><br><br><center>$previous_page $next_page</center><br><br>";
$thetext = $thetextNew;

Now you can use <!--pagebreak--> in your News stories, and the code above will split the text at the <!--pagebreak--> and create the "previous" and "next" hyperlinks for you (don't forget to define _NEXT and _PREVIOUS in your language file, as shown in Chapter 13).



Notice that we have added $page to the global variable list - other than that ,the first two lines are included here only for your orientation.

Web site engine's code is Copyright © 2002 by PHP-Nuke. All Rights Reserved. PHP-Nuke is Free Software released under the GNU/GPL license.
Page Generation: 0.157 Seconds - 508 pages served in past 5 minutes. Nuke Cops Founded by Paul Laudanski (Zhen-Xjell)
:: FI Theme :: PHP-Nuke theme by coldblooded ( ::