PDA

View Full Version : [HTML_function.php] its showing pending news as well


kamalrun
11-07-2006, 07:35 PM
hello guys i edit at HTML_function.php file to show text and image
its working but its also showing pending news.

please guys help me on this .....

also one more Q?

i want to show new Articles # from 5 to 12 news . where i have to edit

please ....



function short_text($text)
{
$text=strip_tags($text);
$words=explode(' ',$text);
$word_number=20;
for ($i = 0; $i < $word_number; $i++) {
$short_text .= $words[$i]. " "; }
if ($i<sizeof($words)) $short_text .="...";
return $short_text;
}


function HTML_Box_Most_Popular()
{
global $url, $tpl_folder, $lang, $cur_date;
$sql = "SELECT * FROM tblArticles WHERE category_id =25 ORDER BY created DESC LIMIT 4";
$result=mysql_query($sql) or die ("Bad query show most <br/>".$sql);

while ($row=mysql_fetch_array($result)) {
$id=HTML_show_friendly_url($row['id'],"");
$most_reading_articles.="<tr><td valign=\"top\" class=\"plainTxt\"><a href=\"{$url}{$id}\">{$row['title']}</a><br><img src=\"{$url}files/{$row['image']}\" width=\"65\" align=left border=1 style=\"padding-right: 2px;\">"; //";
$most_reading_articles.= short_text($row['body']);
$most_reading_articles.= "<span class=\"sxjh\"><a href=\"{$url}{$id}\">(more;) </a></span><p></td></tr>";
}

$filename="$tpl_folder/box_cat.tpl";
$subject=file_get_contents($filename);
$pattern=array(
'/{ROOT}/',
'/{MOST_headline_news}/',
);
$replacement=array(
$url,
$most_reading_articles,
);
$subject=preg_replace($pattern, $replacement, $subject);
return $subject;
}

andy77
11-08-2006, 07:07 AM
its working but its also showing pending news.
Probably because you didn't amend WHERE clause to get only active news, not pending... you probably need to add

WHERE status=1

kamalrun
11-15-2006, 04:15 AM
some of article don't have a image ,

if i don't put image its showing like a missing image , so how to change this code to ,

if i not put image it will hide image area , if i put it will show


please help