开发者

Php question about news menu plugin that may not be displayed

开发者 https://www.devze.com 2023-01-22 08:32 出处:网络
I am not realy a php programmer myself, so any help would be appreciated. I run a website on cms e107.

I am not realy a php programmer myself, so any help would be appreciated. I run a website on cms e107.

Now I have installed a menu plugin called "Recent news menu" This will display the latest news articles in the selected menu area on the site.

Now my problem is that it also displays news that is set to "Not display" (see picture)

Php question about news menu plugin that may not be displayed

Can anyone help how to get this not displayed?

Here is all the code:

<?php
global $sql2, $tp;
$caption = "Recent new开发者_JAVA百科s";
$no_news = "No news items";
$eol_separator = "</td></tr>";
$sol_separator = "<tr><td style='width:0%;text-align:left;'>";
$qry = "SELECT news_id, news_title FROM #news WHERE news_render_type = 0 ORDER BY news_id DESC LIMIT 0,5";

if($sql2->db_Select_gen($qry))
{
 $n_text = "<table style='width:100%;'>";
 while ($row = $sql2->db_Fetch())
 {
  $title = $tp->toHTML($row['news_title']);
  $n_text .=$sol_separator ."<a href='".e_HTTP."news.php?item.".$row['news_id']."'>".$title."</a>".$eol_separator;
 }
 $n_text .= "</table>";
}
else
{
 $n_text = $no_news;
}
$ns->tablerender($caption, $n_text);


Since the code of this plugin doesn't look very good in general, I guess you might not want to use this plugin and look for a better one... but in case you want to use this plugin you could adjust the db query so that the items, which are not ment to be displayed are not selected. Something like this:

$qry = "SELECT news_id, news_title 
        FROM #news 
        WHERE news_render_type = 0 
            AND display = 1
        ORDER BY news_id DESC 
        LIMIT 0,5";

Depending on how the display information is stored, you might need to make it AND display > 0.

0

精彩评论

暂无评论...
验证码 换一张
取 消