• User Attivo

    su aruba c'è una cartella chiamata Public devi metterli li i files per forza


  • User

    Ti ringrazio! Provo subito...


  • User

    Funziona alla perfezione, grazie


  • User Attivo

    prego 🙂


  • User

    Vorrei sapere come faccio ad aggiungere manualmente dal php (oltre al titolo il corpo e la data) 2 nuove righe all'articolo..
    Ci ho provato,ma con qualche intoppo..
    Pannello Originale , Pannello Modificato

    Qui riporto i codici del file news.php (originale)

    
    <html>
    <body bgcolor=yellow>
    <basefont size=2 face=arial>
    <b>Add Article</b>
    <?
            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>";
      }
     }
    ?>
     
    <form action=news.php method=post>
    <table border=0>
    <tr> <td> (Password): </td><td> <input type=text name=passwd size=30> </td></tr>
    <tr> <td> Subject: </td><td> <input type=text name=subject size=30> </td></tr>
    <tr> <td> Article ID: </td><td> <input type=text name=article_id value=<? echo date("Y_m_j_is"); ?> size=30> </td></tr>
    <tr> <td> Date/Author/etc: </td><td> <textarea name=date rows=2 cols=30 wrap=soft><? echo date("M j, Y\n"); ?>Author: </textarea> </td></tr>
    <tr> <td> Summary: </td><td> <textarea name=summary rows=5 cols=30 wrap=soft></textarea> </td></tr>
    <tr> <td> Body: </td><td> <textarea name=body rows=15 cols=30></textarea> </td></tr>
    </table>
    <input type=submit name=submit value=Add>
    </form>
     
    <p>
    <a href=source.php?f=news.php>Source</a>
     
    
    

    Qui riporto i codici del file news.php (modificato)

    
    <html>
    <body bgcolor=yellow>
    <basefont size=2 face=arial>
    <b>Add Article</b>
    <?
            include ("template.inc");
            include ("config.php");
     $summary_template = "t_summary.html";
     $article_template = "t_article.html";
     $max_summary = 5;
     function summary_page ($article_id, $subject, $summary, $preview)
     {
      global $summary_template;
             $t = new Template();
             $t->set_file("SummaryPage", $summary_template);
      $article_url = "article_".$article_id.".html";
      $summary =  nl2br($summary);
                $preview =  nl2br($preview);
      $t->set_var( array(
        "subject" => $subject,
        "summary" => $summary,
                            "preview" => $preview,
        "article_url" => $article_url
        ));
      $t->parse("Summary", "SummaryPage");
      return $t->get_var("Summary");
     }
     function main_page ($subject, $date, $preview, $banner, $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);
                    $preview =  nl2br($preview);
                    $banner =  nl2br($banner);
                    $summary =  nl2br($summary);
                    $body =  nl2br($body);
                    $t->set_var( array(
                                    "subject" => $subject,
                                    "date"    => $date,
                                    "preview" => $preview,
                                    "banner" => $banner,
                                    "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, $preview, $banner, $summary, $article_id, $body));
       add_article("article_$article_id.html", main_page($subject, $date, $preview, $banner, $summary, $article_id, $body));
       echo "<p> Il tuo articolo è stato aggiunto con successo! <p>";
      }else{
       echo "<p><b> I dati inseriti non sono corretti. Perfavore inserisci nuovamente la password. </b>";
      }
     }
    ?>
     
    <form action=news.php method=post>
    <table border=0>
    <tr> <td> Password: </td><td> <input type=password name=passwd size=30> </td></tr>
    <tr> <td> Titolo: </td><td> <input type=text name=subject size=30> </td></tr>
    <tr> <td> Article ID: </td><td> <input type=text name=article_id value=<? echo date("Y_m_j_is"); ?> size=30> </td></tr>
    <tr> <td> Data/Autore: </td><td> <textarea name=date rows=2 cols=30 wrap=soft>di <b>SCRIVI IL TUO NOME</b>, <? echo date("M j, Y\n"); ?> </textarea> </td></tr>
    <tr> <td> Immagine anteprima (42x42): </td><td> <input type=text name=preview size=30></td></tr>
    <tr> <td> Immagine articolo (498x80): </td><td> <input type=text name=banner size=30></td></tr>
    <tr> <td> Sintesi: </td><td> <textarea name=summary rows=5 cols=30 wrap=soft></textarea> </td></tr>
    <tr> <td> Corpo: </td><td> <textarea name=body rows=15 cols=30></textarea> </td></tr>
    </table>
    <input type=submit name=submit value=Add>
    </form>
     
    <p>
    <a href=source.php?f=news.php>Source</a>
     
    
    

    Le nuove aggiunte che vorrei fare sono $preview, $banner

    Un Grazie anticipato..!


  • User Attivo

    ma banner e preview devono essere aggiunte da parte dell'utente? cioè da parte di chi le inserisce le carica dal suo computer?


  • User

    Possibilmente si..Ma per il momento potrei accontentarmi di far inserire un URL dell'immagine


  • User

    Up!


  • User Attivo

    dopo 5 ore già un up? per il tuo script bisogna guardarci dietro e ora io non ho tempo...


  • User

    Il fatto è che ne avevo bisogno per la fine della settimana per questo ho "Uppato"..Ciò non vuole essere sintomo di impazienza,temevo solo che il topic venisse sepolto..
    Se tu non puoi intervenire subito è ovvio che non fa niente..
    (ad ogni modo,sorry)


  • User

    Alla fine ho risolto tutto ^.^

    Mi servirebbe solo un piccolo accorgimento per il limite di news da impostare nella HomePage:
    http://www.giorgiotave.it/forum/php-mysql/50558-vorrei-un-limite-di-news-home.html

    Grazie cmq per l'attenzione dedicata a questo topic