Un Evento Unico. 5 Sale. 27 Interventi. SEO, SOCIAL, E-Commerce, Mobile, Turismo.
CLICCA QUI e SCOPRI DI PIù X Chiudi
 
Forum GT: Condividiamo idee e conoscenza Forum GT: Condividiamo idee e conoscenza


Condividi questo contenuto nei Social Network:
Ti stiamo aspettando: Registrati subito e gratis. Entra a far parte di una delle comunità più attive in Italia. Se hai dimenticato i tuoi dati li puoi recuperare subito.


Vai indietro   Forum per Webmaster: Condividiamo Idee e Conoscenza > Sviluppo e Gestione siti web > Php - Mysql
Benvenuto! Forum Regole FAQ Lista utenti Calendario Segna come letti


Rispondi
 
LinkBack Strumenti di discussione
Vecchio 07-09-07, 06:49   #1 (permalink)
User
 
L'avatar di Darkel
 
Data di registrazione: Sep 2007
Messaggi: 49
vorrei un Limite di News in Home

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)..

Il Pannello che uso per le news è Article Manager (scaricabile)..


Quello sottostante è il codice del file config.php

Codice:
 
<?
$summary_template = "t_summary.html";
$article_template = "t_article.html";
$max_summary = 5;
$max_latest = 5; 
$password = "test";
?>
Quest altro è il file del pannello news.php

Codice:
 
<?
include ("template.inc");
include ("config.php");
$summary_template = "t_summary.html";
$article_template = "t_article.html";
$max_summary = 5;
function summary_page ($subject, $date, $summary, $article_id)
{
global $summary_template;
$t = new Template();
$t->set_file("SummaryPage", $summary_template);
$article_url = "article_".$article_id.".html";
$date =  nl2br($date);
$summary = nl2br($summary); 
$t->set_var(  array(
"subject" => $subject,
"date" => $date,
"summary" => $summary,
"article_url" => $article_url
));
$t->parse("Summary", "SummaryPage");
return $t->get_var("Summary");
}
function main_page ($subject, $date, $summary, $article_id, $body)
{
global $article_template;
$t = new Template();
$t->set_file("ArticlePage", $article_template);
$article_url = "article_".$article_id.".html";
$date = nl2br($date);
$summary = nl2br($summary);
$body = nl2br($body);
$t->set_var( array(
"subject" => $subject,
"date" => $date,
"summary" => $summary,
"body" => $body,
"article_url" => $article_url
));
$t->parse("Article", "ArticlePage");
return $t->get_var("Article"); 
}
function add_article($filename, $news)
{
if(file_exists($filename)){
$fh =  fopen($filename, "r");
$old_news = fread($fh, filesize($filename));
 fclose($fh); 
}
/* TODO: Multipage articles
preg_match_all("<!--ARTICLE PAGE=(\d*)-->", $old_news, $matches;
 
if( count($matches[0]) >= $max_summary){
$oldfilename = $filename.($matches[0][0]+1);
} 
*/
$fh = fopen($filename, "w");
$news =  stripslashes($news);
fwrite($fh, "\n<!--ARTICLE-->\n$news $old_news");
fclose($fh);
}
?>
<?
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 "<p> Article has been added! <p>";
}else{
echo "<p><b> Password is wrong! </b>";
}
}
?>
Questo il codice del file latest.php
Codice:
 
<?
require('config.php'); 
$filename = "article_summary.html";
#- open article summaries
if(file_exists($filename)){
$fh = fopen($filename, "r");
$old_news = fread($fh, filesize($filename));
fclose($fh);
}
 
#- get first five article
$articles =  explode("<!--ARTICLE-->", $old_news);
$i=0;
foreach ( $articles as $article ){
if(count($articles)>$i){
if($max_latest >= $i++){
print $article;
}
}
}
?>
*Ho evidenziato,quelli che secondo me potrebbero essere passi da variare..

Ho già provato a cambiare qualche voce in precedenza,ma con nessun risultato..
Qualcuno puo dirmi come fare?

Grazie,anticipatamente
Darkel non in linea   Rispondi citando
Rispondi
Tags: , , , , , , , ,



Strumenti di discussione

Regole di scrittura
Non puoi postare nuove discussioni
Non puoi rispondere alle discussioni
Non puoi allegare file
Non puoi editare i tuoi post

BB code is Attivo
smilies è Attivo
[IMG] il codice è Attivo
Il codice HTML è Disattivato
Trackbacks are Attivo
Pingbacks are Attivo
Refbacks are Disattivato
Vai al forum



Tutti gli orari sono GMT +3. Attualmente sono le 15:51.




Forum GT - © 2004-2009 GT idea S.r.l P.iva 02418200800 - Privacy/Disclaimer

SEO by vBSEO 3.2.0 ©2008, Crawlability, Inc.