Witam
Chcia?bym pokaza? na stronie g?ównej news.php panel Lates Article Panel ale z rozwini?ciem tzn. tak jak wida? je w articles.php
Nie wiem od której strony to ugry??. Dzi? próbuje przerobi? ten panel tak wi?c mam standardowy kod:
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: latest_articles_panel.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
openside($locale['global_030']);
$result = dbquery(
"SELECT ta.article_id, ta.article_subject, tac.article_cat_id, tac.article_cat_access FROM ".DB_ARTICLES." ta
INNER JOIN ".DB_ARTICLE_CATS." tac ON ta.article_cat=tac.article_cat_id
".(iSUPERADMIN ? "" : "WHERE ".groupaccess('article_cat_access'))." AND article_draft='0' ORDER BY article_datestamp DESC LIMIT 0,5"
);
if (dbrows($result)) {
while($data = dbarray($result)) {
$itemsubject = trimlink($data['article_subject'], 23);
echo THEME_BULLET." <a href='".BASEDIR."articles.php?article_id=".$data['article_id']."' title='".$data['article_subject']."' class='side'>$itemsubject</a><br />\n";
}
} else {
echo "<div style='text-align:center'>".$locale['global_031']."</div>\n";
}
closeside();
?>
A mo?e ?atwiej b?dzie wyci?gn?? co? z articles.php
_______________________________________
zmiany dokonane
Uda?o mi si? zmodyfikowa? powy?szy kod do wy?wietlenia tre?ci zapowiedzi artyku?u.
W zapytaniu do bazy doda?em
"SELECT ta.article_id, ta.article_subject, [color=#006600]ta.article_snippet,[/color]
Pod
$itemsubject = trimlink($data['article_subject'], 23);
doda?em to
$data['article_snippet'] = trim(substr($data['article_snippet'],0,45));
a do wy?wietlenia doda?em
echo "<div class='new'><div class='titles'> <a href='".BASEDIR."articles.php?article_id=".$data['article_id']."' title='".$data['article_subject']."' class='side'>$itemsubject</a></div><div class='zapowiedz'>".$data['article_snippet']."</div></div>\n";
Dzia?a cudownie tak jak chcia?em.
Teraz pojawi?o si? zapytanie jak przyci?? wy?wietlanie artyku?ów do tylko jednej wybranej kategorii.
________________________
Zmiany ko?cowe Uda?o si? wszystko zrobi?
dokona?em zmiany ko?cowej w kodzie:
".(iSUPERADMIN ? "" : "WHERE ".groupaccess('article_cat_access'))." AND article_draft='0'[color=#006600] AND article_cat_id='3'[/color] ORDER BY article_datestamp DESC LIMIT 0,5"
Ko?cowa zawarto?? pliku mo?e si? komu? przyda:
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) 2002 - 2011 Nick Jones
| http://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: articles_with_snippet_panel.php
| Author: Nick Jones (Digitanium) + modyfication Patrick Rozanski K@iTO
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at http://www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
if (!defined("IN_FUSION")) { die("Access Denied"); }
openside($locale['global_030']);
$result = dbquery(
"SELECT ta.article_id, ta.article_subject, ta.article_snippet, tac.article_cat_id, tac.article_cat_access FROM ".DB_ARTICLES." ta
INNER JOIN ".DB_ARTICLE_CATS." tac ON ta.article_cat=tac.article_cat_id
".(iSUPERADMIN ? "" : "WHERE ".groupaccess('article_cat_access'))." AND article_draft='0' AND article_cat_id='3' ORDER BY article_datestamp DESC LIMIT 0,5"
);
if (dbrows($result)) {
while($data = dbarray($result)) {
$itemsubject = trimlink($data['article_subject'], 100);
//$itemsnippet = trimlink($data['article_snippet'], 150);
$data['article_snippet'] = trim(substr($data['article_snippet'],0,100));
echo "<div class='art new'><div class='titlus'> <a href='".BASEDIR."articles.php?article_id=".$data['article_id']."' title='".$data['article_subject']."' class='side'>$itemsubject</a></div><div class='text'>".$data['article_snippet']."</div></div>\n";
}
} else {
echo "<div style='text-align:center'>".$locale['global_031']."</div>\n";
}
closeside();
?>
Aby wybra? inn? kategori? artyku?ów ni? (w tym przypadku) 3, nale?y wyedytowa? t? linijk?
".(iSUPERADMIN ? "" : "WHERE ".groupaccess('article_cat_access'))." AND article_draft='0' AND article_cat_id='3' ORDER BY
a dok?adnie:
article_cat_id='3'
Edytowane przez K@iTO dnia 06.10.2011 22:44:58
|