Author |
Message |
pan
Involved


Joined: Jul 25, 2006
Posts: 354
|
Posted:
Wed May 27, 2009 7:06 pm |
|
How do I get content to be sorted alphabetically? |
Last edited by pan on Fri May 29, 2009 11:07 pm; edited 1 time in total |
|
|
 |
ToolBox
Regular


Joined: Mar 16, 2005
Posts: 74
|
Posted:
Wed May 27, 2009 9:50 pm |
|
one of monolithic stag-flation is content module.
In fact, to expand contents module is to flourish phpnuke sites.
but, only a few concern it, disappointedly.
Anyways, such sort is simply:
Try to follow:
Code:
#
# ------- [ OPEN ] -------
#
<nuke-root>/modules/Content/index.php
#
# ------ [ FIND ] ---------
#
$numrows2 = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_pages WHERE cid!='0' AND active='1'"));
# comments: in list_pages () function
#
# ------ [ INLINE, FIND ] --------
#
cid!='0' AND active='1'
#
# ------- [ AFTER, ADD ] --------
#
DESC ORDER BY `title`
|
Testing and fixing my handy codes are yours.
I have no localmachine to test, but that MODie codes are enough to sate your code hungry. |
|
|
|
 |
pan

|
Posted:
Wed May 27, 2009 10:33 pm |
|
|
|
 |
duck
Involved


Joined: Jul 03, 2006
Posts: 273
|
Posted:
Wed May 27, 2009 11:52 pm |
|
look for the line near that that says $db->sql_fetchrow and make the change there. |
|
|
|
 |
jakec
Site Admin

Joined: Feb 06, 2006
Posts: 3048
Location: United Kingdom
|
Posted:
Thu May 28, 2009 12:30 am |
|
You might want to consider the Content Plus module, because I believe this has it included already along with some other nice features. If you are using RN is should be in the latest package as an addon, or alternatively it can be downloaded here: http://slaytanic.sourceforge.net |
|
|
|
 |
pan

|
Posted:
Thu May 28, 2009 5:02 pm |
|
duck wrote: | look for the line near that that says $db->sql_fetchrow and make the change there. |
where am i supposed to insert it?
Can someone please make this clear for me?
Code:}
function list_pages() {
global $prefix, $db, $sitename, $admin, $multilingual, $module_name, $admin_file;
include_once('header.php');
title($sitename . ': ' . _PAGESLIST);
OpenTable();
echo '<p class="title" align="center">' . _LISTOFCONTENT . ' ' . $sitename . ':</p>';
$result = $db->sql_query('SELECT * FROM ' . $prefix . '_pages_categories');
$numrows = $db->sql_numrows($result);
$numrows2 = $db->sql_numrows($db->sql_query('SELECT * FROM ' . $prefix . '_pages WHERE cid!=\'0\' AND active=\'1\''));
if ($numrows > 0 AND $numrows2 > 0) {
echo '<p class="content" align="center"><b>' . _CONTENTCATEGORIES . '</b></p>'
. '<table border="1" align="center" width="95%">';
while ($row = $db->sql_fetchrow($result)) {
$cid = intval($row['cid']);
$title = check_html($row['title'], 'nohtml');
$description = check_html($row['description'], '');
$numrows3 = $db->sql_numrows($db->sql_query('SELECT * FROM ' . $prefix . '_pages WHERE cid=\'' . $cid . '\''));
if ($numrows3 > 0) {
echo '<tr><td valign="top"> <a href="modules.php?name=' . $module_name . '&pa=list_pages_categories&cid=' . $cid . '">' . $title . '</a> </td><td align="left">' . $description . '</td></tr>';
}
}
echo '</table><p class="content" align="center"><b>'
. _NONCLASSCONT . '</b></p>';
|
|
|
|
|
 |
jestrella
Moderator

Joined: Dec 01, 2005
Posts: 593
Location: Santiago, Dominican Republic
|
Posted:
Thu May 28, 2009 7:26 pm |
|
|
|
 |
duck

|
Posted:
Thu May 28, 2009 7:50 pm |
|
pan wrote: | duck wrote: | look for the line near that that says $db->sql_fetchrow and make the change there. |
where am i supposed to insert it?
Can someone please make this clear for me?
Code:}
function list_pages() {
global $prefix, $db, $sitename, $admin, $multilingual, $module_name, $admin_file;
include_once('header.php');
title($sitename . ': ' . _PAGESLIST);
OpenTable();
echo '<p class="title" align="center">' . _LISTOFCONTENT . ' ' . $sitename . ':</p>';
$result = $db->sql_query('SELECT * FROM ' . $prefix . '_pages_categories' DESC ORDER BY `title`);
$numrows = $db->sql_numrows($result);
$numrows2 = $db->sql_numrows($db->sql_query('SELECT * FROM ' . $prefix . '_pages WHERE cid!=\'0\' AND active=\'1\''));
if ($numrows > 0 AND $numrows2 > 0) {
echo '<p class="content" align="center"><b>' . _CONTENTCATEGORIES . '</b></p>'
. '<table border="1" align="center" width="95%">';
while ($row = $db->sql_fetchrow($result)) {
$cid = intval($row['cid']);
$title = check_html($row['title'], 'nohtml');
$description = check_html($row['description'], '');
$numrows3 = $db->sql_numrows($db->sql_query('SELECT * FROM ' . $prefix . '_pages WHERE cid=\'' . $cid . '\''));
if ($numrows3 > 0) {
echo '<tr><td valign="top"> <a href="modules.php?name=' . $module_name . '&pa=list_pages_categories&cid=' . $cid . '">' . $title . '</a> </td><td align="left">' . $description . '</td></tr>';
}
}
echo '</table><p class="content" align="center"><b>'
. _NONCLASSCONT . '</b></p>';
| |
Look at the 6th Line inside the function that reads $result =
That's where you make the change.
But I agree using Content Plus would likely be a better choice |
|
|
|
 |
pan

|
Posted:
Thu May 28, 2009 10:22 pm |
|
i don't want content plus, i just wanted it sorted alphabetically
that still isn't working for me |
|
|
|
 |
jestrella

|
Posted:
Thu May 28, 2009 10:32 pm |
|
changing the orderby from sql statement to ORDER BY title ASC will do the trick... |
|
|
|
 |
pan

|
Posted:
Thu May 28, 2009 11:07 pm |
|
Not sure why but that didn't work either.
wtffff
This is my whole file:
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. */
/************************************************************************/
/* Additional security & Abstraction layer conversion */
/* 2003 chatserv */
/* http://www.nukefixes.com -- http://www.nukeresources.com */
/************************************************************************/
/************************************************************************/
/* Additional code clean-up, performance enhancements, and W3C and */
/* XHTML compliance fixes by Raven and Montego. */
/************************************************************************/
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);
$pagetitle = '- ' . $module_name;
if (!isset($page)) {
$page = '';
}
if (!isset($pa)) {
$pa = '';
}
switch ($pa) {
case 'showpage':
showpage($pid, $page);
break;
case 'list_pages_categories':
list_pages_categories($cid);
break;
default:
list_pages();
break;
}
die();
// Only functions beyond this point
function showpage($pid, $page = 0) {
global $prefix, $db, $sitename, $admin, $module_name;
include_once('header.php');
OpenTable();
$pid = intval($pid);
$mypage = $db->sql_fetchrow($db->sql_query('SELECT * FROM ' . $prefix . '_pages WHERE pid=\'' . $pid . '\''));
$myactive = intval($mypage['active']);
$mytitle = check_html($mypage['title'], 'nohtml');
$mysubtitle = check_html($mypage['subtitle'], 'nohtml');
$mypage_header = check_html($mypage['page_header'], 'nocheck');
$mytext = check_html($mypage['text'], 'nocheck');
$mypage_footer = check_html($mypage['page_footer'], 'nocheck');
$mysignature = check_html($mypage['signature'], 'nocheck');
$mydate = $mypage['date'];
$mycounter = intval($mypage['counter']);
echo '<table border="0" cellspacing="0" cellpadding="10" width="100%"><tr><td>';
if (($myactive == 0) AND (!is_admin($admin))) {
echo 'Sorry... This page doesn\'t exist.';
} else {
//montego: number of reads should only be made once the entire content text has been read, right?!
// $db->sql_query("UPDATE ".$prefix."_pages SET counter=counter+1 WHERE pid='$pid'");
$date = explode(' ', $mydate);
echo '<p class="title">' . $mytitle . '</p>'
. '<p class="content">' . $mysubtitle . '</p>';
$contentpages = explode('[--pagebreak--]', $mytext);
$pageno = count($contentpages);
if (empty($page) || $page < 1) $page = 1;
if ($page > $pageno) $page = $pageno;
$arrayelement = (int)$page;
$arrayelement--;
if ($pageno > 1) {
echo '<p>' . _PAGE . ': ' . $page . '/' . $pageno . '</p>';
}
if ($page == 1) {
echo '<div align="justify">' . nl2br($mypage_header) . '</div><br /><br />';
}
echo '<div align="justify">' . $contentpages[$arrayelement] . '</div><br /><br />';
$next_page = '';
if ($page < $pageno) {
$next_pagenumber = $page+1;
if ($page != 1) {
$next_page.='- ';
}
$next_page.='<a href="modules.php?name=' . $module_name . '&pa=showpage&pid=' . $pid . '&page=' . $next_pagenumber . '">' . _NEXT . ' (' . $next_pagenumber . '/' . $pageno . ')</a> <a href="modules.php?name=' . $module_name . '&pa=showpage&pid=' . $pid . '&page=' . $next_pagenumber . '"><img src="images/right.gif" border="0" alt="' . _NEXT . '" title="' . _NEXT . '" /></a>';
}
if ($page == $pageno) {
echo '<div align="justify">' . nl2br($mypage_footer) . '</div>';
}
if ($page <= 1) {
$previous_page = '';
} else {
$previous_pagenumber = $page-1;
$previous_page = '<a href="modules.php?name=' . $module_name . '&pa=showpage&pid=' . $pid . '&page=' . $previous_pagenumber . '"><img src="images/left.gif" border="0" alt="' . _PREVIOUS . '" title="' . _PREVIOUS . '" /></a> <a href="modules.php?name=' . $module_name . '&pa=showpage&pid=' . $pid . '&page=' . $previous_pagenumber . '">' . _PREVIOUS . ' (' . $previous_pagenumber . '/' . $pageno . ')</a>';
}
echo '<p align="center">' . $previous_page . ' ' . $next_page . '</p>';
if ($page == $pageno) {
if (!is_admin($admin)) $db->sql_query('UPDATE ' . $prefix . '_pages SET counter=counter+1 WHERE pid=\'' . $pid . '\''); //Added here by montego - also admin should not boost the reads
echo '<p align="right">' . nl2br($mysignature) . '</p>'
. '<p align="right">' . _COPYRIGHT . ' ' . $sitename . ' ' . _COPYRIGHT2 . '</p>'
. '<p align="right"><font class="tiny">' . _PUBLISHEDON . ': ' . $date[0] . ' (' . $mycounter . ' ' . _READS . ')</font></p>'
. '<p align="center">' . _GOBACK . '</p>';
}
}
echo '</td></tr></table>';
CloseTable();
include_once('footer.php');
}
function list_pages() {
global $prefix, $db, $sitename, $admin, $multilingual, $module_name, $admin_file;
include_once('header.php');
title($sitename . ': ' . _PAGESLIST);
OpenTable();
echo '<p class="title" align="center">' . _LISTOFCONTENT . ' ' . $sitename . ':</p>';
$result = $db->sql_query('SELECT * FROM ' . $prefix . '_pages_categories');
$numrows = $db->sql_numrows($result);
$numrows2 = $db->sql_numrows($db->sql_query('SELECT * FROM ' . $prefix . '_pages WHERE cid!=\'0\' AND active=\'1\''));
if ($numrows > 0 AND $numrows2 > 0) {
echo '<p class="content" align="center"><b>' . _CONTENTCATEGORIES . '</b></p>'
. '<table border="1" align="center" width="95%">';
while ($row = $db->sql_fetchrow($result)) {
$cid = intval($row['cid']);
$title = check_html($row['title'], 'nohtml');
$description = check_html($row['description'], '');
$numrows3 = $db->sql_numrows($db->sql_query('SELECT * FROM ' . $prefix . '_pages WHERE cid=\'' . $cid . '\''));
if ($numrows3 > 0) {
echo '<tr><td valign="top"> <a href="modules.php?name=' . $module_name . '&pa=list_pages_categories&cid=' . $cid . '">' . $title . '</a> </td><td align="left">' . $description . '</td></tr>';
}
}
echo '</table><p class="content" align="center"><b>'
. _NONCLASSCONT . '</b></p>';
}
echo '<p>';
$result4 = $db->sql_query('SELECT pid, title, subtitle, clanguage FROM ' . $prefix . '_pages WHERE active=\'1\' AND cid=\'0\' ORDER BY date');
while ($row4 = $db->sql_fetchrow($result4)) {
$pid = intval($row4['pid']);
$title = stripslashes(check_html($row4['title'], 'nohtml'));
$subtitle = stripslashes(check_html($row4['subtitle'], 'nohtml'));
$clanguage = $row4['clanguage'];
if ($multilingual == 1) {
$the_lang = '<img src="images/language/flag-' . $clanguage . '.png" hspace="3" border="0" height="10" width="20" alt="" />';
} else {
$the_lang = '';
}
if (!empty($subtitle)) {
$subtitle = ' (' . $subtitle . ')';
} else {
$subtitle = '';
}
if (is_admin($admin)) {
echo '<strong><big>·</big></strong> ' . $the_lang . ' <a href="modules.php?name=' . $module_name . '&pa=showpage&pid=' . $pid . '">' . $title . '</a> ' . $subtitle . ' [ <a href="' . $admin_file . '.php?op=content_edit&pid=' . $pid . '">' . _EDIT . '</a> | <a href="' . $admin_file . '.php?op=content_change_status&pid=' . $pid . '&active=1">' . _DEACTIVATE . '</a> | <a href="' . $admin_file . '.php?op=content_delete&pid=' . $pid . '">' . _DELETE . '</a> ]<br />';
} else {
echo '<strong><big>·</big></strong> ' . $the_lang . ' <a href="modules.php?name=' . $module_name . '&pa=showpage&pid=' . $pid . '">' . $title . '</a> ' . $subtitle . '<br />';
}
}
echo '</p>';
if (is_admin($admin)) {
$result5 = $db->sql_query('SELECT pid, cid, title, subtitle, clanguage FROM ' . $prefix . '_pages WHERE active=\'0\' ORDER BY date');
echo '<p class="content" align="center"><b>' . _YOURADMINLIST . '</b></p><p>';
while ($row5 = $db->sql_fetchrow($result5)) {
$pid = intval($row5['pid']);
$cid = intval($row5['cid']);
$title = stripslashes(check_html($row5['title'], 'nohtml'));
$subtitle = stripslashes(check_html($row5['subtitle'], 'nohtml'));
$clanguage = $row5['clanguage'];
if ($multilingual == 1) {
$the_lang = '<img src="images/language/flag-' . $clanguage . '.png" hspace="3" border="0" height="10" width="20" alt="" />';
} else {
$the_lang = '';
}
if (!empty($subtitle)) {
$subtitle = ' (' . $subtitle . ') ';
} else {
$subtitle = ' ';
}
echo '<strong><big>·</big></strong> ' . $the_lang . ' <a href="modules.php?name=' . $module_name . '&pa=showpage&pid=' . $pid . '">' . $title . '</a> ' . $subtitle . ' [ <a href="' . $admin_file . '.php?op=content_edit&pid=' . $pid . '">' . _EDIT . '</a> | <a href="' . $admin_file . '.php?op=content_change_status&pid=' . $pid . '&active=0">' . _ACTIVATE . '</a> | <a href="' . $admin_file . '.php?op=content_delete&pid=' . $pid . '">' . _DELETE . '</a> ]<br />';
}
echo '</p>';
}
CloseTable();
include_once('footer.php');
}
function list_pages_categories($cid) {
global $prefix, $db, $sitename, $admin, $multilingual, $module_name, $admin_file;
include_once('header.php');
title($sitename . ': ' . _PAGESLIST);
OpenTable();
echo '<p class="title" align="center">' . _LISTOFCONTENT . ' ' . $sitename . ':</p>';
$cid = intval($cid);
$result = $db->sql_query('SELECT pid, title, subtitle, clanguage FROM ' . $prefix . '_pages WHERE active=\'1\' AND cid=\'' . $cid . '\' ORDER BY `title` ASC');
echo '<p>';
while ($row = $db->sql_fetchrow($result)) {
$pid = intval($row['pid']);
$title = check_html($row['title'], 'nohtml');
$subtitle = check_html($row['subtitle'], 'nohtml');
$clanguage = $row['clanguage'];
if ($multilingual == 1) {
$the_lang = '<img src="images/language/flag-' . $clanguage . '.png" hspace="3" border="0" height="10" width="20" alt="" />';
} else {
$the_lang = '';
}
if (!empty($subtitle)) {
$subtitle = ' (' . $subtitle . ')';
} else {
$subtitle = '';
}
if (is_admin($admin)) {
echo '<strong><big>·</big></strong> ' . $the_lang . ' <a href="modules.php?name=' . $module_name . '&pa=showpage&pid=' . $pid . '">' . $title . '</a> '
. $subtitle . ' [ <a href="' . $admin_file . '.php?op=content_edit&pid=' . $pid . '">'
. _EDIT . '</a> | <a href="' . $admin_file . '.php?op=content_change_status&pid=' . $pid . '&active=1">'
. _DEACTIVATE . '</a> | <a href="' . $admin_file . '.php?op=content_delete&pid=' . $pid . '">'
. _DELETE . '</a> ]<br />';
} else {
echo '<strong><big>·</big></strong> ' . $the_lang . ' <a href="modules.php?name=' . $module_name . '&pa=showpage&pid=' . $pid . '">' . $title . '</a> ' . $subtitle . '<br />';
}
}
echo '</p>';
if (is_admin($admin)) {
$result2 = $db->sql_query('SELECT pid, title, subtitle, clanguage FROM ' . $prefix . '_pages WHERE active=\'0\' AND cid=\'' . $cid . '\' ORDER BY date');
echo '<p align="center"><b>' . _YOURADMINLIST . '</b></p><p>';
while ($row2 = $db->sql_fetchrow($result2)) {
$pid = intval($row2['pid']);
$title = stripslashes(check_html($row2['title'], 'nohtml'));
$subtitle = stripslashes(check_html($row2['subtitle'], 'nohtml'));
$clanguage = $row2['clanguage'];
if ($multilingual == 1) {
$the_lang = '<img src="images/language/flag-' . $clanguage . '.png" hspace="3" border="0" height="10" width="20" alt="" />';
} else {
$the_lang = '';
}
if (!empty($subtitle)) {
$subtitle = ' (' . $subtitle . ') ';
} else {
$subtitle = ' ';
}
echo '<strong><big>·</big></strong> ' . $the_lang . ' <a href="modules.php?name=' . $module_name . '&pa=showpage&pid=' . $pid . '">' . $title . '</a> '
. $subtitle . ' [ <a href="' . $admin_file . '.php?op=content_edit&pid=' . $pid . '">'
. _EDIT . '</a> | <a href="' . $admin_file . '.php?op=content_change_status&pid=' . $pid . '&active=0">'
. _ACTIVATE . '</a> | <a href="' . $admin_file . '.php?op=content_delete&pid=' . $pid . '">'
. _DELETE . '</a> ]<br />';
}
echo '</p>';
}
echo '<p align="center">' . _GOBACK . '</p>';
CloseTable();
include_once('footer.php');
}
?>
|
|
|
|
|
 |
jakec

|
Posted:
Fri May 29, 2009 12:12 am |
|
bluerace wrote: | Pan, so sorry, I don't want to reply in here any longer for this issue. That's why I posted it in the site.
If we keep talking in here, then it will look like "personal forum." |
bluerace, sorry what do you mean by this? Surely it makes sense to finish providing help here so it is easier for people to find it in the future? |
|
|
|
 |
pan

|
Posted:
Fri May 29, 2009 12:20 am |
|
I've tried everything everyone has suggested but nothing has worked...
??? |
|
|
|
 |
duck

|
Posted:
Fri May 29, 2009 1:20 am |
|
Have you cleared your Cache after making the changes? |
|
|
|
 |
Raven
Site Admin/Owner

Joined: Aug 27, 2002
Posts: 17088
|
Posted:
Fri May 29, 2009 6:31 am |
|
bluerace wrote: | Pan, so sorry, I don't want to reply in here any longer for this issue. That's why I posted it in the site.
If we keep talking in here, then it will look like "personal forum." |
Bluerace,
While we appreciate your willingness to help in our forums, when someone posts a question in these forums and the conversation is being dealt with in these forums then these forums are the proper place for all conversations unless the user decides to end it. Directing the conversation to a different site, especially when it is apparent that you just added it to your site based on this user's question in these forums, is not proper netiquette . I have removed your original posts. Hopefully this was just a mistake on your part and we need not have any other issues . |
|
|
|
 |
pan

|
Posted:
Fri May 29, 2009 4:45 pm |
|
duck wrote: | Have you cleared your Cache after making the changes? |
yes, i did this with everything everyone has told me to try
Still it doesn't work. Now I can't try what bluerace said because raven deleted it!!! |
|
|
|
 |
jestrella

|
Posted:
Fri May 29, 2009 8:33 pm |
|
mmmmmmmmmmmmm, help to help you
the problem is that the content you got at your site is uncategorized
find this line withing list_pages function...
Code:$result4 = $db->sql_query('SELECT pid, title, subtitle, clanguage FROM ' . $prefix . '_pages WHERE active=\'1\' AND cid=\'0\' ORDER BY date');
|
replace it with...
Code:$result4 = $db->sql_query('SELECT pid, title, subtitle, clanguage FROM ' . $prefix . '_pages WHERE active=\'1\' AND cid=\'0\' ORDER BY title ASC');
|
|
|
|
|
 |
pan

|
Posted:
Fri May 29, 2009 11:05 pm |
|
YAY!
THAT FIXED IT!!
Woo hoo thanks again everyone! |
|
|
|
 |
jakec

|
Posted:
Sat May 30, 2009 1:30 am |
|
Nice one jestrella.
 |
|
|
|
 |
Raven

|
Posted:
Sat May 30, 2009 7:15 am |
|
Pan wrote: | Now I can't try what bluerace said because raven deleted it!!! |
I had good reason. Apology accepted  |
|
|
|
 |
|