Page 1 sur 1

Appel de variable defaillant

Posté : 29 janv. 2012, 00:02
par thiryn
Bonjour/Bonsoir.
J'ai créé un site sous Nuked Klan, mais lors de la modification du code source de celui-ci je rencontre des problèmes pourtant tout bête.
par exemple dans cette partie de code là:
function classe($sid, $nb_subcat)
    {
        global $nuked, $theme, $bgcolor1, $bgcolor2, $bgcolor3;

        if ($_REQUEST['op'] == "classe")
        {

            echo "<br /><div style=\"text-align: center;\"><big><b>" . _SECTIONS . "</b></big></div>\n"
            . "<div style=\"text-align: center;\"><br />\n"
            . "[ <a href=\"index.php?file=Sections\" style=\"text-decoration: underline\">" . _INDEXSECTIONS . "</a> | ";

            if ($_REQUEST['orderby'] == "news")
            {
                echo _NEWSART . " | ";
            } 
            else
            {
                echo "<a href=\"index.php?file=Sections&op=classe&orderby=news\" style=\"text-decoration: underline\">" . _NEWSART . "</a> | ";
            } 

            if ($_REQUEST['orderby'] == "count")
            {
                echo _TOPART . " | ";
            } 
            else
            {
                echo "<a href=\"index.php?file=Sections&op=classe&orderby=count\" style=\"text-decoration: underline\">" . _TOPART . "</a> | ";
            } 

            echo "<a href=\"index.php?file=Suggest&module=Sections\" style=\"text-decoration: underline\">" . _SUGGESTART . "</a> ]</div><br />\n";
        } 

        $nb_max = $nuked['max_sections'];
        if (!$_REQUEST['p']) $_REQUEST['p'] = 1;
        $start = $_REQUEST['p'] * $nb_max - $nb_max;

        if ($sid != "") $where = "WHERE S.secid = '" . $sid . "'";
	else $where = "";

        if ($_REQUEST['orderby'] == "name")
        {
            $order = "ORDER BY S.title";
        } 

        else if ($_REQUEST['orderby'] == "count")
        {
            $order = "ORDER BY S.counter DESC";
        } 

        else if ($_REQUEST['orderby'] == "note")
        {
            $order = "ORDER BY note DESC";
        } 

        else
        {
            $_REQUEST['orderby'] = "news";
            $order = "ORDER BY S.artid DESC";
        } 

        $sql = mysql_query("SELECT S.artid, S.title, S.date, S.counter, S.content,  AVG(V.vote) AS note  FROM " . SECTIONS_TABLE . " AS S LEFT JOIN " . VOTE_TABLE . " AS V ON S.artid = V.vid AND V.module = 'Sections' " . $where . " GROUP BY S.artid " . $order);
        
		$nb_art = mysql_num_rows($sql);

        if ($nb_art > 1 && $sid != "")
        {
            echo "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\">\n"
            . "<tr><td align=\"right\"><small>" . _ORDERBY . " : ";

            if ($_REQUEST['orderby'] == "news") echo "<b>" . _DATE . "</b> | ";
            else echo "<a href=\"index.php?file=Sections&op=" . $_REQUEST['op'] . "&orderby=news&secid=" . $sid . "\">" . _DATE . "</a> | ";

            if ($_REQUEST['orderby'] == "count") echo "<b>" . _TOPFILE . "</b> | ";
            else echo "<a href=\"index.php?file=Sections&op=" . $_REQUEST['op'] . "&orderby=count&secid=" . $sid . "\">" . _TOPFILE . "</a> | ";

            if ($_REQUEST['orderby'] == "name") echo "<b>" . _NAME . "</b> | ";
            else echo"	<a href=\"index.php?file=Sections&op=" . $_REQUEST['op'] . "&orderby=name&secid=" . $sid . "\">" . _NAME . "</a> | ";

           if ($_REQUEST['orderby'] == "note") echo"<b>" . _NOTE . "</b>";
            else echo"	<a href=\"index.php?file=Sections&op=" . $_REQUEST['op'] . "&orderby=note&secid=" . $sid . "\">" . _NOTE . "</a>";

            echo "</small></td></tr></table>\n";
        } 

        if ($nb_art > 0)
        {
            if ($nb_art > $nb_max)
            {
                echo "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\"><tr><td>";
                $url = "index.php?file=Sections&op=" . $_REQUEST['op'] . "&secid=" . $sid . "&orderby=" . $_REQUEST['orderby'];
                number($nb_art, $nb_max, $url);
                echo "</td></tr></table>\n";
            } 

            echo "<br />";

            $sqlhot = mysql_query("SELECT artid FROM " . SECTIONS_TABLE . " ORDER BY counter DESC LIMIT 0, 10");

            $seek = mysql_data_seek($sql, $start);
            for($i = 0;$i < $nb_max;$i++)
            {
                if (list($artid, $title, $date, $counter, $content) = mysql_fetch_row($sql))
                {

                    $newsdate = time() - 604800;
                    $att = "";

                    if ($date != "" && $date > $newsdate) $att = "&nbsp;&nbsp;" . _NEW;

                    if ($content != "")
                    {
                        $content = str_replace("\r", "", $content);
                        $content = str_replace("\n", " ", $content);
                        $texte = strip_tags($content);
                        $texte = str_replace("(--pagebreak--)", "", $texte);

                        if (strlen($texte) > 150)
                        {
                            $texte = substr($texte, 0, 150) . "...";
							$texte = htmlentities($texte);
                        } 
                    } 
                    else
                    {
                        $texte = "";
                    } 

                    mysql_data_seek($sqlhot, 0);
                    while (list($id_hot) = mysql_fetch_array($sqlhot))
                    {
                        if ($artid == $id_hot && $nb_art > 1 && $counter > 9) $att .= "&nbsp;&nbsp;" . _HOT;
                    } 

                    if ($date != "") $alt = "title=\"" . _ADDTHE . "&nbsp;" . strftime("%x %H:%M", $date) . "\"";
                    else $alt = "";

                    if (is_file("themes/" . $theme . "/images/articles.gif"))
                    {
                        $img = "<img src=\"themes/" . $theme . "/images/articles.gif\" alt=\"\" " . $alt . "/>";
                    } 
                    else
                    {
                        $img = "<img src=\"modules/Sections/images/articles.gif\" alt=\"\" " . $alt . "/>";
                    } 

                    echo "<table style=\"background: " . $bgcolor3 . ";margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\" cellspacing=\"1\" cellpadding=\"0\">\n"
                    . "<tr><td><table style=\"background: " . $bgcolor2 . ";\" width=\"100%\" border=\"0\" cellspacing=\"1\" cellpadding=\"2\">\n"
                    . "<tr><td style=\"width: 100%;\">" .  $img . " <a href=\"index.php?file=Sections&op=article&artid=" . $artid . "\" <h4 class=\"title1\">" . $title . "</h4></a>" . $att . "</td>\n"
					. "<td><a href=\"#\" onclick=\"javascript:window.open('index.php?file=Sections&nuked_nude=index&op=pdf&artid=" . $artid . "','projet','toolbar=yes,location=no,directories=no,scrollbars=yes,resizable=yes')\">"
					. "<img style=\"border: 0;\"  alt=\"\" title=\"" . _PDF . "\" /></a></td></tr>\n"
					. "<tr><td>" . _AUTHOR . " : " . $autor . "\n";

                    if ($texte != "")
                    {
                        echo "<tr><td colspan=\"2\">" . $texte . "</td></tr>\n";
                    } 
					
					echo"<tr><td><div class=\"suite\"> <a href=\"index.php?file=Sections&op=article&artid=" . $artid . "\" <div class=\"title3\">" . _SUITE . "</div></a></div>";

                    echo "</td></tr></table></td></tr></table><br /><br \>\n";
                } 
            } 

            if ($nb_art > $nb_max)
            {
                echo "<table style=\"margin-left: auto;margin-right: auto;text-align: left;\" width=\"90%\"><tr><td>";
                $url = "index.php?file=Sections&op=" . $_REQUEST['op'] . "&secid=" . $sid . "&orderby=" . $_REQUEST['orderby'];
                number($nb_art, $nb_max, $url);
                echo "</td></tr></table>\n";
            } 

        } 
        else
        {
            if ($nb_subcat == 0 && $sid > 0) echo "<div style=\"text-align: center;\"><br />" . _NOARTS . "</div><br /><br />\n";
            if ($_REQUEST['op'] == "classe") echo "<div style=\"text-align: center;\"><br />" . _NOARTINDB . "</div><br /><br />\n";
        } 
    }
Je n'arrive pas à appeler la valeur de $autor (ligne 151) j'ai enlevé les modifications que j'avais faite, donc pour le moment c'est un appel de... rien du tout. En gros je voudrais savoir que mettre et où pour appeler la variable $autor.
Tout ce qui est expliqué sur le net passe par des While et c'est pas ce qu'il me faut...

Re: Appel de variable defaillant

Posté : 29 janv. 2012, 00:26
par moogli
salut,

au pif la variable n'existe pas ? (pas de déclaration dans la fonction)
y a des messages d'erreurs ?

@+

Re: Appel de variable defaillant

Posté : 29 janv. 2012, 00:37
par thiryn
Je sais que la variable n'est pas déclaré, j'ai enlevé mes tentatives de déclaration, pas de message d'erreur je voudrais justement savoir comment la déclarer :P

Re: Appel de variable defaillant

Posté : 29 janv. 2012, 01:01
par moogli
http://www.lephpfacile.com/cours/2-decl ... -variables

sinon demander aux auteurs y a surement des site spécialisé dans cette chose, le code n'étant pas standard !


@+