PHP-NUKE Serious, need a litle help with coding

Newbie Spellweaver
Joined
Dec 29, 2004
Messages
49
Reaction score
0
Hello php coders i need a little help with my nuke site .If u know in nuke sites are a little mod like news page numbers bet the lates version of it is only for nuke 7.0, my nuke is 7.8 and i need litle help. start here this is the instructions.

Code:
###############################################################################
#                                                                             #
# Page Numbers for PHP-Nuke 7.0 Alpha 2                                       #
#                                                                             #
# Copyright (c) 3/2003 by Scott Rubin ([email protected])                 #
# http://www.ierealtor.com - phpnuke id: scottr                               #
#                                                                             #
# Page Numbers at the bottom of the News/Topics/Categories pages.             #
# Auto install contains exploit fix in rate_article function too. (Mar 22, 03)#
#                                                                             #
###############################################################################
Version 1.0 - October 16, 2003
This release slightly different for PHP-Nuke 7.0
=============================================================================== 
Example, what you'll see when you are on the first News page of 117 stories
with 'Stories Number in Home' in Admin/Preferences set to 10:
117 Stories (12 Pages, 10 Per Page)
[ 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 ]  ->
-   -   -   -   -   -   -   -   --   --   --
================================================================================
Installation Instructions:
Page Numbers can be installed by overwriting 
html/modules/News/index.php            # News Stories and Topics
html/modules/News/categories.php       # Categories
OR 
by making 6 changes described below (3 in each file)
and copying the contents of pagenum-yourlang.txt to inside
html/modules/News/language/lang-yourlang.php
where yourlang is your language like english
(send me more language files)
===============================================================================
Page Numbers for Stories and Topics
-----------------------------------
You can simply overwrite html/modules/News/index.php with index.php provided
OR if you've already changed the file then make these 3 changes:
1. near line 25:
add $pagenum to end of global statement in function theindex()
2. near line 63:
replace this line:
$sql = "SELECT sid, catid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories $qdb $querylang ORDER BY sid DESC limit $storynum";
with these lines:
# start Page Numbers
if ($pagenum == "") { $pagenum = 1; **
$offset = ($pagenum-1) * $storynum;
$sql = "SELECT sid, catid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories $qdb $querylang ORDER BY sid DESC limit $offset, $storynum";
# end Page Numbers
3. near line 222:
add these lines before the include("footer.php") statement at end of function theindex()
#START Page Numbers
# Uncomment this next line and change 100 to whatever for number of stories in news and topics for Page Numbers section
#$limitpn = "limit 100"; # limit number of stories
$sql_pn = "select * from ".$prefix."_stories $qdb $querylang $limitpn";
$result_pn = $db->sql_query($sql_pn);
$numstories = $db->sql_numrows($result_pn);
$numpages = ceil($numstories / $storynum);
#if ($numpages > 1 and $new_topic == 0) {
if ($numpages > 1) {
opentable();
echo "<center>$numstories "._STORIES." ($numpages "._PAGES.", $storynum "._PERPAGE.")<br>";
if ($pagenum > 1) {
$prevpage = $pagenum - 1;
$leftarrow = "images/left.gif";
if(isset($new_topic)) {
echo "<a href=\"modules.php?name=News&new_topic=$new_topic&pagenum=$prevpage\">";
echo "<img src=\"$leftarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
** else {
echo "<a href=\"modules.php?name=News&pagenum=$prevpage\">";
echo "<img src=\"$leftarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
**
**
echo "[ ";
for ($i=1; $i < $numpages+1; $i++) {
if ($i == $pagenum) {
echo "<b>$i</b>";
** else {
if(isset($new_topic)) {
echo "<a href=\"modules.php?name=News&new_topic=$new_topic&pagenum=$i\">$i</a>";
** else {
echo "<a href=\"modules.php?name=News&pagenum=$i\">$i</a>";
**
**
if ($i < $numpages) { echo " | "; ** else { echo " ]"; **
**
if ($pagenum < $numpages) {
$nextpage = $pagenum + 1;
$rightarrow = "images/right.gif";
if(isset($new_topic)) {
echo "<a href=\"modules.php?name=News&new_topic=$new_topic&pagenum=$nextpage\">";
echo "<img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
** else {
echo "<a href=\"modules.php?name=News&pagenum=$nextpage\">";
echo "<img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
**
**
echo "</center>";
closetable();
**
#END Page Numbers in news and topics
===============================================================================
Page Numbers for Categories
---------------------------
You can simply overwrite html/modules/News/categories.php with categories.php provided
OR if you've changed the file then make these 3 changes:
1. near line 29:
add $pagenum to end of global statement in function theindex()
2. near line 42:
Change this line:
$sql = "SELECT sid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories where catid='$catid' $querylang ORDER BY sid DESC limit $storynum";
To these lines:
# start Page Numbers
if ($pagenum == "") { $pagenum = 1; **
$offset = ($pagenum-1) * $storynum;
$sql = "SELECT sid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories where catid='$catid' $querylang ORDER BY sid DESC limit $offset, $storynum";
# end Page Numbers
3.  near line 139:
add these lines before the include("footer.php") statement at end of function theindex()
#START Page Numbers
# Uncomment this next line and change 100 to whatever for number of stories in categories for Page Numbers section
#$limitpn = "limit 100"; # limit number of stories in categories
$numstories = $db->sql_numrows($db->sql_query("select * from ".$prefix."_stories where catid='$catid' $querylang $limitpn"));
$numpages = ceil($numstories / $storynum);
if ($numpages > 1) {
opentable();
echo "<center>$numstories "._STORIES." ($numpages "._PAGES.", $storynum "._PERPAGE.")<br>";
if ($pagenum > 1) {
$prevpage = $pagenum - 1;
$leftarrow = "images/left.gif";
echo "<a href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid&pagenum=$prevpage\">";
echo "<img src=\"$leftarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
**
echo "[ ";
for ($i=1; $i < $numpages+1; $i++) {
if ($i == $pagenum) {
echo "<b>$i</b>";
** else {
echo "<a href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid&pagenum=$i\">$i</a>";
**
if ($i < $numpages) { echo " | "; ** else { echo " ]"; **
**
if ($pagenum < $numpages) {
$nextpage = $pagenum + 1;
$rightarrow = "images/right.gif";
echo "<a href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid&pagenum=$nextpage\">";
echo "<img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
**
echo "</center>";
closetable();
**
#END Page Numbers in categories
===============================================================================
file list:
Page_Numbers/Page_Numbers.txt
Page_Numbers/index.php
Page_Numbers/categories.php
Page_Numbers/language/pagenum-english.txt
Page_Numbers/language/pagenum-norwegian.txt
Page_Numbers/language/pagenum-spanish.txt
Page_Numbers/language/pagenum-turkish.txt
Page_Numbers/language/pagenum-polish.txt
Page_Numbers/language/pagenum-french.txt
Page_Numbers/language/pagenum-german.txt
Page_Numbers/language/pagenum-dutch.txt
 

Attachments

and from instructions and egzample i did this index.php who works on 7.8nuke :awesome:

then is category.php here is it good for nuke 7.0


Code:
<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if (!eregi("modules.php", $_SERVER['PHP_SELF'])) {
    die ("You can't access this file directly...");
**

require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);

$index = 1;
$categories = 1;
$cat = $catid;
automated_news();

function theindex($catid) {
	# Page Numbers added $pagenum
    global $storyhome, $httpref, $httprefmax, $topicname, $topicimage, $topictext, $datetime, $user, $cookie, $nukeurl, $prefix, $multilingual, $currentlang, $db, $articlecomm, $module_name, $pagenum;
    if ($multilingual == 1) {
	    $querylang = "AND (alanguage='$currentlang' OR alanguage='')"; /* the OR is needed to display stories who are posted to ALL languages */
    ** else {
	    $querylang = "";
    **
    include("header.php");
    if (isset($cookie[3])) {
	$storynum = $cookie[3];
    ** else {
	$storynum = $storyhome;
    **
    $db->sql_query("update ".$prefix."_stories_cat set counter=counter+1 where catid='$catid'");
	# START Page Numbers
    if ($pagenum == "") { $pagenum = 1; **
    $offset = ($pagenum-1) * $storynum;
    $sql = "SELECT sid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories where catid='$catid' $querylang ORDER BY sid DESC limit $offset, $storynum";
	# END Page Numbers

    $result = $db->sql_query($sql);
    while ($row = $db->sql_fetchrow($result)){
	$s_sid = $row['sid'];
	$aid = $row[aid];
	$title = $row[title];
	$time = $row[time];
	$hometext = $row[hometext];
	$bodytext = $row[bodytext];
	$comments = $row[comments];
	$counter = $row[counter];
	$topic = $row[topic];
	$informant = $row[informant];
	$notes = $row[notes];
	$acomm = $row[acomm];
	$score = $row[score];
	$ratings = $row[ratings];
	getTopics($s_sid);
	formatTimestamp($time);
	$subject = stripslashes($subject);
	$hometext = stripslashes($hometext);
	$notes = stripslashes($notes);
	$introcount = strlen($hometext);
	$fullcount = strlen($bodytext);
	$totalcount = $introcount + $fullcount;
	$c_count = $comments;
	$r_options = "";
        if (isset($cookie[4])) { $r_options .= "&mode=$cookie[4]"; **
        if (isset($cookie[5])) { $r_options .= "&order=$cookie[5]"; **
        if (isset($cookie[6])) { $r_options .= "&thold=$cookie[6]"; **
	if (is_user($user)) {
	    $the_icons = " | <a href=\"modules.php?name=News&file=print&sid=$s_sid\"><img src=\"images/print.gif\" border=\"0\" alt=\""._PRINTER."\" title=\""._PRINTER."\" width=\"16\" height=\"11\"></a>  <a href=\"modules.php?name=News&file=friend&op=FriendSend&sid=$s_sid\"><img src=\"images/friend.gif\" border=\"0\" alt=\""._FRIEND."\" title=\""._FRIEND."\" width=\"16\" height=\"11\"></a>";
	** else {
	    $the_icons = "";
	**
	$story_link = "<a href=\"modules.php?name=News&file=article&sid=$s_sid$r_options\">";
	$morelink = "(";
	if ($fullcount > 0 OR $c_count > 0 OR $articlecomm == 0 OR $acomm == 1) {
	    $morelink .= "$story_link<b>"._READMORE."</b></a> | ";
	** else {
	    $morelink .= "";
	**
	if ($fullcount > 0) { $morelink .= "$totalcount "._BYTESMORE." | "; **
	if ($articlecomm == 1 AND $acomm == 0) {
	    if ($c_count == 0) { $morelink .= "$story_link"._COMMENTSQ."</a>"; ** elseif ($c_count == 1) { $morelink .= "$story_link$c_count "._COMMENT."</a>"; ** elseif ($c_count > 1) { $morelink .= "$story_link$c_count "._COMMENTS."</a>"; **
	**
	$morelink .= "$the_icons";
	if ($score != 0) {
	    $rated = substr($score / $ratings, 0, 4);
	** else {
	    $rated = 0;
	**
	$morelink .= " | "._SCORE." $rated";
	$morelink .= ")";
	$morelink = str_replace(" |  | ", " | ", $morelink);
	$sid = $s_sid;
	$sql2 = "select title from ".$prefix."_stories_cat where catid='$catid'";
	$result2 = $db->sql_query($sql2);
	$row2 = $db->sql_fetchrow($result2);
	$title1 = $row2[title];
	
	$title = "$title1: $title";
	themeindex($aid, $informant, $datetime, $title, $counter, $topic, $hometext, $notes, $morelink, $topicname, $topicimage, $topictext);
    **
    if ($httpref==1) {
	$referer = $_SERVER["HTTP_REFERER"];
	if ($referer=="" OR ereg("unknown", $referer) OR eregi($nukeurl,$referer)) {
	** else {
	    $db->sql_query("insert into ".$prefix."_referer values (NULL, '$referer')");
	**
	$numrows = $db->sql_numrows($db->sql_query("select * from ".$prefix."_referer"));
	if($numrows==$httprefmax) {
    	    $db->sql_query("delete from ".$prefix."_referer");
	**
    **
    # START Page Numbers

    # Uncomment this next line and change 100 to whatever for number of stories in categories for Page Numbers section
    #$limitpn = "limit 100"; # limit number of stories in categories

    $numstories = $db->sql_numrows($db->sql_query("select * from ".$prefix."_stories where catid='$catid' $querylang $limitpn"));
    $numpages = ceil($numstories / $storynum);
    if ($numpages > 1) {
        opentable();
        echo "<center>$numstories "._STORIES." ($numpages "._PAGES.", $storynum "._PERPAGE.")<br>";
        if ($pagenum > 1) {
            $prevpage = $pagenum - 1;
			$leftarrow = "images/left.gif";
            echo "<a href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid&pagenum=$prevpage\">";
            echo "<img src=\"$leftarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
        **
        echo "[ ";
        for ($i=1; $i < $numpages+1; $i++) {
            if ($i == $pagenum) {
                echo "<b>$i</b>";
            ** else {
                echo "<a href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid&pagenum=$i\">$i</a>";
            **
            if ($i < $numpages) { echo " | "; ** else { echo " ]"; **
        **
        if ($pagenum < $numpages) {
            $nextpage = $pagenum + 1;
			$rightarrow = "images/right.gif";
            echo "<a href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid&pagenum=$nextpage\">";
            echo "<img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
        **
        echo "</center>";
        closetable();
    **
    # END Page Numbers in categories
    include("footer.php");
**

switch ($op) {

    case "newindex":
	if ($catid == 0 OR $catid == "") {
	    Header("Location: modules.php?name=$module_name");
	**
	theindex($catid);
    break;

    default:
    Header("Location: modules.php?name=$module_name");

**

?>
 
And here what i did.

Code:
<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2005 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if (!defined('MODULE_FILE')) {
	die ("You can't access this file directly...");
**

require_once("mainfile.php");
$module_name = basename(dirname(__FILE__));
get_lang($module_name);

$index = 1;
$categories = 1;
$cat = $catid;
automated_news();

function theindex($catid) {
# Page Numbers added $pagenum
	global $storyhome, $httpref, $httprefmax, $topicname, $topicimage, $topictext, $datetime, $user, $cookie, $nukeurl, $prefix, $multilingual, $currentlang, $db, $articlecomm, $module_name;
	if ($multilingual == 1) {
		$querylang = "AND (alanguage='$currentlang' OR alanguage='')"; /* the OR is needed to display stories who are posted to ALL languages */
	** else {
		$querylang = "";
	**
	include("header.php");
	if (isset($cookie[3])) {
		$storynum = $cookie[3];
	** else {
		$storynum = $storyhome;
	**
	$catid = intval($catid);
	# START Page Numbers
    if ($pagenum == "") { $pagenum = 1; **
    $offset = ($pagenum-1) * $storynum;
	$db->sql_query("update ".$prefix."_stories_cat set counter=counter+1 where catid='$catid'");
	$result = $db->sql_query("SELECT sid, aid, title, time, hometext, bodytext, comments, counter, topic, informant, notes, acomm, score, ratings FROM ".$prefix."_stories where catid='$catid' $querylang ORDER BY sid DESC limit $offset, $storynum");
	# END Page Numbers
	while ($row = $db->sql_fetchrow($result)) {
		$s_sid = intval($row['sid']);
		$aid = stripslashes($row['aid']);
		$title = stripslashes(check_html($row['title'], "nohtml"));
		$time = $row['time'];
		$hometext = stripslashes($row['hometext']);
		$bodytext = stripslashes($row['bodytext']);
		$comments = intval($row['comments']);
		$counter = intval($row['counter']);
		$topic = intval($row['topic']);
		$informant = stripslashes($row['informant']);
		$notes = stripslashes($row['notes']);
		$acomm = intval($row['acomm']);
		$score = intval($row['score']);
		$ratings = intval($row['ratings']);
		getTopics($s_sid);
		formatTimestamp($time);
		$subject = stripslashes(check_html($subject, "nohtml"));
		$introcount = strlen($hometext);
		$fullcount = strlen($bodytext);
		$totalcount = $introcount + $fullcount;
		$c_count = $comments;
		$r_options = "";
		if (isset($cookie[4])) { $r_options .= "&mode=$cookie[4]"; **
		if (isset($cookie[5])) { $r_options .= "&order=$cookie[5]"; **
		if (isset($cookie[6])) { $r_options .= "&thold=$cookie[6]"; **
		$story_link = "<a href=\"modules.php?name=News&file=article&sid=$s_sid$r_options\">";
		$morelink = "(";
		if ($fullcount > 0 OR $c_count > 0 OR $articlecomm == 0 OR $acomm == 1) {
			$morelink .= "$story_link<b>"._READMORE."</b></a> | ";
		** else {
			$morelink .= "";
		**
		if ($fullcount > 0) { $morelink .= "$totalcount "._BYTESMORE." | "; **
		if ($articlecomm == 1 AND $acomm == 0) {
			if ($c_count == 0) { $morelink .= "$story_link"._COMMENTSQ."</a>"; ** elseif ($c_count == 1) { $morelink .= "$story_link$c_count "._COMMENT."</a>"; ** elseif ($c_count > 1) { $morelink .= "$story_link$c_count "._COMMENTS."</a>"; **
		**
		if ($score != 0) {
			$rated = substr($score / $ratings, 0, 4);
		** else {
			$rated = 0;
		**
		$morelink .= " | "._SCORE." $rated";
		$morelink .= ")";
		$morelink = str_replace(" |  | ", " | ", $morelink);
		$sid = intval($s_sid);
		$row2 = $db->sql_fetchrow($db->sql_query("select title from ".$prefix."_stories_cat where catid='$catid'"));
		$title1 = stripslashes(check_html($row2['title'], "nohtml"));

		$title = "$title1: $title";
		themeindex($aid, $informant, $datetime, $title, $counter, $topic, $hometext, $notes, $morelink, $topicname, $topicimage, $topictext);
	**
	if ($httpref==1) {
		$referer = $_SERVER["HTTP_REFERER"];
		if ($referer=="" OR ereg("unknown", $referer) OR eregi($nukeurl,$referer)) {
		** else {
			$db->sql_query("insert into ".$prefix."_referer values (NULL, '$referer')");
		**
		$numrows = $db->sql_numrows($db->sql_query("select * from ".$prefix."_referer"));
		if($numrows==$httprefmax) {
			$db->sql_query("delete from ".$prefix."_referer");
		**
	**
    # START Page Numbers

    # Uncomment this next line and change 100 to whatever for number of stories in categories for Page Numbers section
    #$limitpn = "limit 100"; # limit number of stories in categories

    $numstories = $db->sql_numrows($db->sql_query("select * from ".$prefix."_stories where catid='$catid' $querylang $limitpn"));
    $numpages = ceil($numstories / $storynum);
    if ($numpages > 1) {
        opentable();
        echo "<center>$numstories "._STORIES." ($numpages "._PAGES.", $storynum "._PERPAGE.")<br>";
        if ($pagenum > 1) {
            $prevpage = $pagenum - 1;
			$leftarrow = "images/left.gif";
            echo "<a href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid&pagenum=$prevpage\">";
            echo "<img src=\"$leftarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
        **
        echo "[ ";
        for ($i=1; $i < $numpages+1; $i++) {
            if ($i == $pagenum) {
                echo "<b>$i</b>";
            ** else {
                echo "<a href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid&pagenum=$i\">$i</a>";
            **
            if ($i < $numpages) { echo " | "; ** else { echo " ]"; **
        **
        if ($pagenum < $numpages) {
            $nextpage = $pagenum + 1;
			$rightarrow = "images/right.gif";
            echo "<a href=\"modules.php?name=News&file=categories&op=newindex&catid=$catid&pagenum=$nextpage\">";
            echo "<img src=\"$rightarrow\" align=\"absmiddle\" border=\"0\" hspace=\"10\"></a>";
        **
        echo "</center>";
        closetable();
    **
    # END Page Numbers in categories
	include("footer.php");
**

switch ($op) {

	case "newindex":
	if ($catid == 0 OR $catid == "") {
		Header("Location: modules.php?name=$module_name");
	**
	theindex($catid);
	break;

	default:
	Header("Location: modules.php?name=$module_name");

**

?>

Ok seems ok all here is the pic.
matrux - PHP-NUKE Serious, need a litle help with coding - RaGEZONE Forums



But whats the problem that if u are trying to push e.g. page 2 it goes to index page one hxxp://miniwarez.ltfreedom.com/ u can try yourselfves . :excl: so can u say what i need to do :blink: cuz im not PHP COder thanx for helping


I Attachment files.

http://rapidshare.de/files/5877535/MYworking7.8.rar.html here is my

http://rapidshare.de/files/5878010/working7.0.zip.html here is 7.0 working
 
i need to add pages number on my site and i asking your help.
u see that the latest and the alst version of news pages list is for nuke 7.0and mine nuke is 7.8 so the php-codes are a little different and i need some help with coding i did the most of job but.. its not working
 
Last edited:
We are still not quite understanding you. If you are not proficient at English, please type what ever you're trying to tell us in your native language in a translater (eg Google Language Tools) then translate it to English and post it here.

[N]asser` ~ Out
 
PHP-Nuke is quite easy to work with jsut try looking in the setup panel or search for plugins. If you need further help I think you should try asking help at a PHP-Nuke forum. They might be easier to help you.
 
Back