<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[vorrei un Limite di News in Home]]></title><description><![CDATA[<p dir="auto">Risolto il problema della configurazione del Pannello (vi ringrazio per i vostri consigli) ,mi serivirebbe sapere come posso impostare un limite al numero di news che devono apparire in primo piano nella mia Home Page (ad esempio 3)..</p>
<p dir="auto">Il Pannello che uso per le news è <a href="http://php.html.it/script/download/1189/article-manager/" rel="nofollow ugc"><strong>Article Manager</strong></a> (scaricabile)..</p>
<p dir="auto">Quello sottostante è il codice del file <em>config.php</em></p>
<pre><code>&lt;?
$summary_template = "t_summary.html";
$article_template = "t_article.html";
$max_summary = 5;
$max_latest = 5; 
$password = "test";
?&gt;
</code></pre>
<p dir="auto">Quest altro è il file del pannello <em>news.php</em></p>
<pre><code>&lt;?
[B]include ("template.inc");[/B]
[B]include ("[/B][COLOR=blue]config.php[/COLOR][B]");[/B]
[B]$summary_template = "t_summary.html";[/B]
[B]$article_template = "t_article.html";[/B]
[B][COLOR=blue]$max_summary = 5;[/COLOR][/B]
function summary_page ($subject, $date, $summary, $article_id)
{
global $summary_template;
$t = new Template();
$t-&gt;set_file("SummaryPage", $summary_template);
$article_url = "article_".$article_id.".html";
$date = nl2br($date);
$summary = nl2br($summary); 
$t-&gt;set_var( array(
"subject" =&gt; $subject,
"date" =&gt; $date,
"summary" =&gt; $summary,
"article_url" =&gt; $article_url
));
[B]$t-&gt;parse("Summary", "SummaryPage");[/B]
[B]return $t-&gt;get_var("Summary");[/B]
}
function main_page ($subject, $date, $summary, $article_id, $body)
{
global $article_template;
$t = new Template();
$t-&gt;set_file("ArticlePage", $article_template);
$article_url = "article_".$article_id.".html";
$date = nl2br($date);
$summary = nl2br($summary);
$body = nl2br($body);
$t-&gt;set_var( array(
"subject" =&gt; $subject,
"date" =&gt; $date,
"summary" =&gt; $summary,
"body" =&gt; $body,
"article_url" =&gt; $article_url
));
[B]$t-&gt;parse("Article", "ArticlePage");[/B]
[B]return $t-&gt;get_var("Article"); [/B]
[B]}[/B]
[B]function add_article($filename, $news)[/B]
[B]{[/B]
[B]if(file_exists($filename)){[/B]
[B]$fh = fopen($filename, "r");[/B]
[B]$old_news = fread($fh, filesize($filename));[/B]
[B]fclose($fh); [/B]
[B]}[/B]
[B]/* TODO: Multipage articles[/B]
[B][COLOR=blue]preg_match_all("&lt;!--ARTICLE PAGE=(\d*)--&gt;", $old_news, $matches;[/COLOR][/B]
 
[B][COLOR=blue]if( count($matches[0]) &gt;= $max_summary){[/COLOR][/B]
[B][COLOR=blue]$oldfilename = $filename.($matches[0][0]+1);[/COLOR][/B]
[B][COLOR=blue]} [/COLOR][/B]
[B][COLOR=blue]*/[/COLOR][/B]
[B][COLOR=blue]$fh = fopen($filename, "w");[/COLOR][/B]
[B][COLOR=blue]$news = stripslashes($news);[/COLOR][/B]
[B][COLOR=blue]fwrite($fh, "\n&lt;!--ARTICLE--&gt;\n$news $old_news");[/COLOR][/B]
[B][COLOR=blue]fclose($fh);[/COLOR][/B]
[B]}[/B]
[B]?&gt;[/B]
&lt;?
if(strcmp($subject, "")){ 
if(!(strcmp($passwd, $password))){ 
add_article("article_summary.html", summary_page($subject, $date, $summary, $article_id));
add_article("article_$article_id.html", main_page($subject, $date, $summary, $article_id, $body));
echo "&lt;p&gt; Article has been added! &lt;p&gt;";
}else{
echo "&lt;p&gt;&lt;b&gt; Password is wrong! &lt;/b&gt;";
}
}
?&gt;
</code></pre>
<p dir="auto">Questo il codice del file <em>latest.php</em></p>
<pre><code>[SIZE=2]&lt;?[/SIZE]
[SIZE=2]require([COLOR=blue]'config.php'[/COLOR]); [/SIZE]
[SIZE=2]$filename = "article_summary.html";[/SIZE]
[SIZE=2]#- open article summaries[/SIZE]
[SIZE=2]if(file_exists($filename)){[/SIZE]
[SIZE=2]$fh = fopen($filename, "r");[/SIZE]
[SIZE=2]$old_news = fread($fh, filesize($filename));[/SIZE]
[SIZE=2]fclose($fh);[/SIZE]
[SIZE=2]}[/SIZE]
 
[SIZE=2][B][COLOR=blue]#- get first five article[/COLOR][/B][/SIZE]
[SIZE=2][B][COLOR=blue]$articles = explode("&lt;!--ARTICLE--&gt;", $old_news);[/COLOR][/B][/SIZE]
[SIZE=2][B][COLOR=blue]$i=0;[/COLOR][/B][/SIZE]
[SIZE=2][B]foreach ( $articles as $article ){[/B][/SIZE]
[SIZE=2][B]if(count($articles)&gt;$i){[/B][/SIZE]
[SIZE=2][B]if($max_latest &gt;= $i++){[/B][/SIZE]
[SIZE=2][B]print $article;[/B][/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]}[/SIZE]
[SIZE=2]?&gt;[/SIZE]
</code></pre>
<p dir="auto">*Ho evidenziato,quelli che secondo me potrebbero essere passi da variare..</p>
<p dir="auto">Ho già provato a cambiare qualche voce in precedenza,ma con nessun risultato..:(<br />
Qualcuno puo dirmi come fare?</p>
<p dir="auto">Grazie,anticipatamente:)</p>
]]></description><link>https://dev.connect.gt/topic/45877/vorrei-un-limite-di-news-in-home</link><generator>RSS for Node</generator><lastBuildDate>Sat, 28 Nov 2026 02:57:44 GMT</lastBuildDate><atom:link href="https://dev.connect.gt/topic/45877.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 Sep 2007 03:49:16 GMT</pubDate><ttl>60</ttl></channel></rss>