Page 2 of 3
Posted: Wed 23. Mar 2005, 03:09
by ndtoan13
Thanks Vio, now I can display list page like << 1 2 3 >> and the link for number 2 is
Code: Select all
http://../index.php?c15&cur_page=2
(cur_page is pg in your code, I have changed to understand easily)
I think your pager function is to split pages when there are too many article in a catalog, am I wrong?
But why it does not match my data: I have 3 article in a catalog News, and change
Code: Select all
$template_default["record_per_page"] = 2;
to forge it split into 2 pages, but it display as default :
+ Content of article 1 with a link more.. in the end
+ 2 links of the others article
and page list << 1 2 3 >> at the end of page (I put tag {LISTPAGES} right after tag {CONTENT}) But when I press number 2 it only change the number to bold (as pager function does).
So how to split content into 2 pages? E.g:
Do the same as above, it should display in page 1:
+ Content of article 1 with a link more.. in the end
+ 1 link to the next article
And page 2 have the link for the last article?
How to do this????
Thank for all!
Posted: Fri 25. Mar 2005, 19:07
by vio
okie, check ur message
Posted: Sat 26. Mar 2005, 04:14
by ndtoan13
Thanks again, now it runs well!! I have a mistake with your code!! (I change variable's name in your code to understand easier and make some error!! Now I have corrected it!)
Posted: Sat 20. Aug 2005, 22:07
by deanloh
Has anyone got this hack working in latest version 1.2.5?
I installed it and ended up with this error:
Code: Select all
Fatal error: Call to undefined function: pager() in /home/phpwcms/public_html/include/inc_front/front.func.inc.php on line 819
When I looked into the code of front.func.inc.php, this is what line 819 says:
Code: Select all
$lstpg = pager($pg,$pglen,$num_recs,$qrystr);
What have I missed?
Posted: Wed 1. Feb 2006, 12:15
by nekket
Mmmmmh

I need this replacement tag for my website running phpwcms 1.2.5...
Anyone here who knows it's working or not?
Posted: Wed 22. Mar 2006, 13:08
by peri
Does it work with the new version?
If not- what kind of changes are necessary?
thx
Posted: Wed 22. Mar 2006, 13:51
by nekket
Hm ... i can't find any source files for this mod any more ... dead links

really don't works with 1.2.6 !?
Posted: Fri 16. Jun 2006, 13:10
by yoshi01
hallo zusammen..
nach versuch, scheitern und ebenso fruchtloser suche nach hinweisen oder antworten im forum, starte ich den versuch eines topics.
für ein aktuelles projekt könnte ich die funktion des listpages-rep-tag sehr gut gebrauchen.
ich gebe zu, phpwcms noch lange nicht durchschaut zu haben und wurstle mich noch oft genug "vom rücken durch die brust ins auge".
dennoch:
- kann mir jmd bestätigen, dass mit der aktuellen version dieser tag nicht mehr funktioniert?
- kann mir jmd dabei helfen, ihn zum funktionieren zu bringen?
- oder kann mich jmd erleuchten und mir eine alternative hierzu aufzeigen?
auch reply freut sich und ist ebenso dankbar dafür,
yoshi
-------------------------------------------------------------------------------------
i'll try to summon this in english:
it really seems, that the rep-tag listpages won't work with the actual phpwmcs-release; also the support for this tag seems to be shut-down.
i would be pleased about..
- a confirm, that listpages won't work with v1.2.6
- a hint to get listpages working with v1.2.6
- a hint for an alternative to listpages for v1.2.6
-------------------------------------------------------------------------------------
ps:
wenn ihr mir teaser-ex nahelegen wollt, müsstet ihr weit ausholen um mir das zu erläutern.. ebenso würde ich wert darauf legen, das aussehen der paginierung vollständig anzupassen.
if you consider to recommend teaser-ex, please do very detailed.. i'd completely style the pagination of listed pages for my own purposes
thanks in advance..
yoshi
Posted: Fri 16. Jun 2006, 13:38
by nekket
- kann mir jmd bestätigen, dass mit der aktuellen version dieser tag nicht mehr funktioniert?
es funktioniert. Siehe z.B.
http://www.kcomp.net/cms2/index.php?ref ... _webdesign
- kann mir jmd dabei helfen, ihn zum funktionieren zu bringen?
Grundsätzlich ja - ich bin nur gerade unterwegs. Spätestens Anfang nächster Woche kann ich dir dazu was schreiben.
- oder kann mich jmd erleuchten und mir eine alternative hierzu aufzeigen?
unnötig, siehe oben

Posted: Fri 16. Jun 2006, 17:58
by yoshi01
war das ein grösserer akt?
Posted: Fri 16. Jun 2006, 18:29
by nekket
ich weiß gar nicht mehr genau. glaub da war irgendwas, was aber wohl an meiner eigenen doofheit lag
Ich hab da irgendwas an einer Datei mal geändert gehabt, das ganze liegt aber auf dem PC in der Agentur und da bin ich halt bis Montag nicht...
Ich schau mal, vielleicht komme ich morgen auch schon dazu.
hmm..
Posted: Sat 17. Jun 2006, 19:29
by yoshi01
ich habs auch probiert.. wie geschrieben leider ohne erfolg.
ist ja gut beschrieben, stück für stück..
die variante, die funktion fest in eines conf-files zu schreiben ging dann auch nicht. ich bin stecken geblieben mit dem selben fehler wie dean loh - das die funktion offensichtlich nicht mehr tut im aktuellen wcms..
aber evtl. ist ja das step-by-step schon nicht ganz korrekt!?
wäre nett, wenn du mir damit weiterhelfen könntest.
Posted: Sat 17. Jun 2006, 20:35
by nekket
OK versuchts mal damit:
1.) Das muss in die config.inc.php:
Code: Select all
// Number record per page
$template_default["record_per_page"] = 4;
Hier wird eingestellt, wieviele Artikel pro Seite angezeigt werden sollen.
2.) in der config.inc.php muss nun noch folgendes aktiviert sein:
Code: Select all
$phpwcms["allow_ext_init"] = 1; //allow including of custom external scripts at frontend initialization
3.) Erstellt eine Datei "listpages" im Ordner "phpwcms_template/inc_script/frontend_init" mit folgendem Inhalt:
Code: Select all
<?
function pager( $pg, $pglen, $cnt, $q ) {
/*
Input :
$pg: Current page
$pglen: Number of items on a page
$cnt: Total number of items
$q: Query string (optional)
Output:
List pages
*/
$pages = ceil($cnt/$pglen);
if ( $pages == 1 ) return;
$lst_pgs = "<div class=\"clear\"><p></p></div><div align='center'>";
if ( $pg > 1 )
$lst_pgs .= "<a style='text-decoration: none' href='index.php?".$q."&pg=".($pg-1)."'><<</a> ";
// echo
for ( $i = 1; $i <= $pages; $i++ ) {
if ( $i == $pg )
{ $lst_pgs .= "<b>$i</b> ";
$lst_pgshead .= "<b>$i</b> ";}
else $lst_pgs .= "<a <a style='text-decoration: none' href='index.php?".$q."&pg=$i'>$i</a> ";
}
if ( $pg < $pages) {
if ($pg == 1) {$nxtpg =2;} else {$nxtpg = $pg+1;}
$lst_pgs .= "<a style='text-decoration: none' href='index.php?".$q."&pg=".$nxtpg."'>>></a></div> ";
}
return $lst_pgs;
return $lst_pgshead;
}
?>
4.) Erstellt eine Datei "listpages.php" im Ordner "phpwcms_template/inc_script/frontend_render" mit folgendem Inhalt:
Code: Select all
<?
if (!$_GET["id"]) {$content["all"] = str_replace('{LISTPAGES}', $lstpg, $content["all"]);}
else {$content["all"] = str_replace('{LISTPAGES}', "", $content["all"]);}?>
5.) in eurem Template, fügt
an die Stelle, wo die Seiten aufgezählt werden sollen.
6.) Rest wie im ersten Beitrag beschrieben:
#-----[ OPEN ]---------------------------------------
#
include/inc_front/front.func.inc
//rewrite the function get_actcat_articles_data
Code: Select all
function get_actcat_articles_data ($act_cat_id, $dbcon) {
//returns the complete active and public article data as array (basic infos only)
//so it is reusable by many functions -> lower db access
$data = array();
$ao = get_order_sort($GLOBALS['content']['struct'][ $act_cat_id ]['acat_order']);
$sql = "SELECT *, UNIX_TIMESTAMP(article_tstamp) AS article_date FROM ".DB_PREPEND."phpwcms_article ";
$sql .= "WHERE article_cid=".intval($act_cat_id);
// VISIBLE_MODE: 0 = frontend (all) mode, 1 = article user mode, 2 = admin user mode
switch(VISIBLE_MODE) {
case 0: $sql .= " AND article_public=1 AND article_aktiv=1";
break;
case 1: $sql .= " AND article_uid=".$_SESSION["wcs_user_id"];
break;
//case 2: admin mode no additional neccessary
}
$sql .= " AND article_deleted=0 AND article_begin < NOW() AND article_end > NOW() ";
$sql .= "ORDER BY ".$ao[2];
//start hack by Viet Son//
$result_ts = mysql_query($sql, $dbcon);
$num_recs = mysql_num_rows($result_ts);
mysql_free_result($result_ts);
$pglen = $GLOBALS["template_default"]["record_per_page"];
if ($num_recs > $rec_page){
$pg = $_GET["pg"];
if(!$pg || $pg == 1){$start = 0;$pg = 1;}
else{$offset = $pg-1; $start = ($offset * $pglen); }
$sql1 = "SELECT acat_alias FROM ".DB_PREPEND."phpwcms_articlecat WHERE acat_id=".$act_cat_id.";";
if($result1 = mysql_query($sql1, $dbcon))
{
if($row = mysql_fetch_row($result1)) {$qrystr = $row[0];}
}//mysql_free_result($result1);
$lstpg = pager($pg,$pglen,$num_recs,$qrystr);
$GLOBALS["lstpg"]= $lstpg;
$sql .= " LIMIT $start,$pglen";
} else {$sql .=";";}
//END page list hack/////
if($result = mysql_query($sql, $dbcon)) {
while($row = mysql_fetch_assoc($result)) {
$data[$row["article_id"]] = array(
"article_id" => $row["article_id"],
"article_cid" => $row["article_cid"],
"article_title" => $row["article_title"],
"article_subtitle" => $row["article_subtitle"],
"article_keyword" => $row["article_keyword"],
"article_summary" => $row["article_summary"],
"article_redirect" => $row["article_redirect"],
"article_date" => $row["article_date"],
"article_username" => $row["article_username"],
"article_sort" => $row["article_sort"],
"article_notitle" => $row["article_notitle"],
"article_created" => $row["article_created"],
"article_image" => unserialize($row["article_image"]),
"article_timeout" => $row["article_cache"],
"article_nosearch" => $row["article_nosearch"]
);
}
mysql_free_result($result);
}
return $data;
}
#
# OPEN include/inc_front/content.func.inc
#
#
# ADD after <?php this line
#
Eventuell hab ich noch irgendwo was verändert, was ich jetzt nicht mehr weiß. Probiert's einfach mal

das regelt!
Posted: Mon 19. Jun 2006, 10:28
by yoshi01
jawoll - das funktioniert, tausend dank!
wenngleich es auf wundersame weise nicht sofort ging; bzw. bei einzelnen categorien erst "nach einer kurzen weile".. so merkwürdig das auch klingt.
es sind tatsächlich ein paar abweichungen zur ursprungsmethode - aber nekkets post beschreibt, wie man {LISTPAGES} mit 1.2.6 zum laufen bringt.
--- english summary ---
the post above describes a proper solution to get {LISTPAGES} working with phpwcms 1.2.6 - tried & tested.
---
also danke nochmal..

Posted: Fri 7. Jul 2006, 11:10
by cyrano
Hallo Nicolas,
da Du das RT installiert hast eine Frage dazu:
das Rt {LISTPAGES} splittet nur dann, wenn mehrere Artikel in einer Strukturebene sind?
Oder splittet das auch einen einzigen Artikel, der z.B. zu lang ist in mehrere Teile?
Danke für kurzes Feedback.