Visualizzazione dei risultati da 1 a 5 su 5
  1. #1

    Problema con script CMS

    Ciao a tutti sono nuovo di questo forum,
    sto realizzando un CMS in php anzi lo avrei ultimato ma
    sono bloccato da un bug dello script che ho messo sotto il
    messaggio del browser è

    Parse error: parse error, unexpected T_LNUMBER, expecting T_VARIABLE or '$' in C:\Programmi\xampp\htdocs\outputfunctions.php on line 18

    ma io non trovo errori.....

    <?php
    function trimBody($theText, $lmt=500, $s_chr="\n", $s_cnt=2) {
    $pos=0;
    $trimmed=FALSE;
    for ($i=1;$i<=$s_cnt; $i++){
    if($tmp=strpos($theText, $s_chr, $pos+1)) {
    $pos=$tmp;
    $trimmed=TRUE;
    } else {
    $pos=strlen($theText) -1;
    $trimmed=FALSE;
    break;
    }
    }
    $theText=substr($theText, 0, $pos);

    //questa sotto è la riga errata secondo Apache....
    if (strlen($theText) > $1mt) {
    $theText=substr($theText, 0, $1mt);
    $theText=substr($theText, 0, strrpos($theText,''));
    $trimmed=TRUE;
    }
    if ($trimmed) $theText .='...';
    return $theText;
    }

    function outputStory($article, $only_snippet=FALSE) {
    global $conn;

    if ($article) {
    $sql="SELECT ar.*, usr.name".
    "FROM cms_articles ar ".
    "LEFT OUTER JOIN cms_users usr ".
    "ON ar.author_id=usr.user_id ".
    "WHERE ar.article_id=".$article;
    $result=mysql_query($sql, $conn);

    if($row=mysql_fetch_array($result)) {
    echo "<h3>" . htmlspecialchars($row['title']) . "</h3>\n";

    echo "<h5><div class=\"byline\">By: ".
    htmlspecialchars($row['name']) .
    "</div>";
    echo "<div class=\"pubdate\">";
    if($row['is_published'] ==1) {
    echo date("F j,Y", strtotime($row['date_published']));
    }else{
    echo "not yet published...";
    }
    echo "</div></h5>\n";
    if ($only_snippet) {
    echo "

    \n";
    echo nl2br(htmlspecialchars(trimBody($row['body'])));
    echo "</p>\n";
    echo "<h4><a href=\"viewarticle.php?article=" .
    $row['article_id'] . "\">Full story...</a></h4>
    \n";
    }else{
    echo "

    \n";
    echo nl2br(htmlspecialchars($row['body']));
    echo "</p>\n";
    }
    }
    }
    }

    function showComments($article, $showLink=TRUE) {
    global $conn;
    if ($article) {
    $sql="SELECT is_published ".
    "FROM cms_articles ".
    "WHERE article_id=" .$article;
    $result=mysql_query($sql, $conn)
    or die('Could not look up comments; ' .mysql_error());

    $row=mysql_fetch_array($result);
    $is_published=$row['is_published'];

    $sql="SELECT co.*, usr.name, usr.email, ".
    "FROM cms_comments co ".
    "LEFT OUTER JOIN cms_users usr ".
    "ON co.comment_user=usr.user_id ".
    "WHERE co.article_id=" . $article .
    " ORDER BY co.comment_date DESC";
    $result=mysql_query($sql, $conn)
    or die ('Could not look up comments; '. mysql_error());

    if($showLink) {
    echo "<h4>" . mysql_num_rows($result) . " Comments";
    if (isset($_SESSION['user_id']) and $is_published) {
    echo " /<a href=\"comment.php?article=" . $_GET['article'] .
    "\">Add one</a>";
    }
    echo "</h4>\n";
    }

    if (mysql_num_rows($result)) {
    echo "<div class=\"scroller\">\n";
    while ($row=mysql_fetch_array($result)) {
    echo "<span class=\"commentName\">" .
    htmlspecialchars($row['name']) .
    "</span><span class=\"commentDate\"> (" .
    date("1 F j,Y H:i", strtotime($row['comment_date'])) .
    ")</span>\n";
    echo "<p class=\"commentText\">\n" .
    nl2br(htmlspecialchars($row['comment'])) .
    "\n</p>\n";
    }
    echo"</div>\n";
    }
    echo"
    \n";
    }
    }
    ?>


    se avete una idea mi potreste dare una mano?

    Grazie mille Antonio

    P.S. scusate se lo script è troppo lungo.....

  2. #2
    Up

  3. #3
    Niente? nessuno che abbia idee anche pareri?
    Grazie

  4. #4
    MAGICO HTML.IT SONO ANDATO A STUDIARMI LA LEZIONE......
    E ADESSO NON SOLO IL MIO CMS VA MA SO USARE ANCHE LA LIBRERIA mysqli
    WOWOWOWOWOWWOWOWOWOWOWOW


  5. #5
    Grazie sopratutto a Giuseppe Farina!!!!!!!!!!!!!!

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved.