WCM Forum

WCM Forum (http://www.wcm.at/forum/index.php)
-   Programmierung (http://www.wcm.at/forum/forumdisplay.php?f=17)
-   -   hilfe bei php-skript (http://www.wcm.at/forum/showthread.php?t=113502)

catch17 27.10.2003 13:45

hilfe bei php-skript
 
hallo leute,

spiel gerne mit php-skripten herum (reines try and error- hab (noch) keinen tau wie des funkt;)) und hab hier eine funktion die ich gerne erweitern möchte - is sicher ganz leicht wenn mans weiß

function get_list($weight = 2, $section_id = 0, $section_dir = "") {
global $tbl_name;
global $now_datetime;
global $page_postdate;
global $page_list;

$query = "SELECT ID, title, post_date FROM $tbl_name
WHERE status = 1
AND post_date <= '$now_datetime'
AND weight <= '$weight'
AND section_id = '$section_id'
AND ( expire_date > '$now_datetime' OR expire_date = '')
ORDER BY post_date DESC
";
$result = mysql_query($query);
$string = "";
while ($row = mysql_fetch_object($result)) {
$title = stripslashes($row->title);
$page_postdate = $row->post_date;
$id = $row->ID;
// Set date format for list
$page_postdate = format_datelong($page_postdate);
$string = $string . "
<a href=\"";
if ($section_dir != "") {
$string = $string
. $section_dir . "/";
}
$string = $string . "item.php?id="
. $id . "\">" . $title . " </a>"
. "

\n";
}
$page_list = $string . "";
}


---möchte jetzt das nicht nur die (aktiven) Titel ausgegeben werden, sondern auch der inhalt von feld "summary" (is kurzbeschreibung)unterhalb jedes zugehörigen Titels - wo muß ich was einfügen damit des wirksam wird :confused:

bitte helfts ma weiter und postets mir die paar zeilen;)

dub 27.10.2003 14:52

PHP-Code:

function get_list($weight 2$section_id 0$section_dir "") {
global 
$tbl_name;
global 
$now_datetime;
global 
$page_postdate;
global 
$page_list;

$query "SELECT ID, title, post_date, summary FROM $tbl_name 
WHERE status = 1
AND post_date <= '$now_datetime' 
AND weight <= '$weight'
AND section_id = '$section_id'
AND ( expire_date > '$now_datetime' OR expire_date = '')
ORDER BY post_date DESC
"
;
$result mysql_query($query); 
$string "";
while (
$row mysql_fetch_object($result)) {
$title stripslashes($row->title);
$page_postdate $row->post_date
$id $row->ID;
$summary $row->summary;
// Set date format for list
$page_postdate format_datelong($page_postdate); 
$string $string 
[b]<a href=\""
;
if (
$section_dir != "") { 
$string $string 
$section_dir "/";
}
$string $string "item.php?id=" 
$id "\">" $title " </a>" 
"[/b]
 \n"
;
}
$page_list $string "";


Die Änderung im Detail:

PHP-Code:

$query "SELECT ID, title, post_date, summary FROM $tbl_name WHERE status = 1 AND post_date <= '$now_datetime' AND weight <= '$weight' AND section_id = '$section_id' AND ( expire_date > '$now_datetime' OR expire_date = '') ORDER BY post_date DESC"

PHP-Code:

while ($row mysql_fetch_object($result)) {
   
$title stripslashes($row->title);
   
$page_postdate $row->post_date
   
$id $row->ID;
   
$summary $row->summary

#Hannes#

catch17 27.10.2003 14:59

besten dank einstmal :) :) - werds abends/nächtens probieren -

dub 27.10.2003 15:17

np

#Hannes#


Alle Zeitangaben in WEZ +2. Es ist jetzt 20:29 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
© 2009 FSL Verlag