Joomla.it Forum

Non solo Joomla... => Sviluppo => : dk-wamp 29 Nov 2011, 18:59:57

: script php che non va deltutto..
: dk-wamp 29 Nov 2011, 18:59:57
salve, avrei una domanda daporvi,

il mio joomla ha un problema con uno script in php,
mettendo difatti il codice nel modulo questo sembra che ad un certo punto
si interrompa, il codice è perfettamente funzionante su una pagina .php
e legge gli ultimi post di un forum phpbb3.

vi copio il codice e quello che poi ne viene fuori:

:
<link href="/templates/allrounder-j1.6/css/template.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/templates/allrounder-j1.6/css/joomla.css" rel="stylesheet" type="text/css" media="all" />

    <link href="/templates/allrounder-j1.6/css/colors.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/templates/allrounder-j1.6/css/lvdropdown.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/templates/allrounder-j1.6/css/typo.css" rel="stylesheet" type="text/css" media="all" />
    <link href="/templates/allrounder-j1.6/css/modules.css" rel="stylesheet" type="text/css" media="all" />

<?php
$ris_query 
"SELECT topic_poster, topic_id, topic_title, username FROM phpbb_topics INNER JOIN phpbb_users ON topic_poster = user_id WHERE forum_id!=10 AND forum_id!=9 ORDER BY topic_time DESC LIMIT 7"
$db =  mysql_connect("localhost","userrrr","passssss"); 
$res mysql_db_query("nomedatabaseee",$ris_query) or die('..problema di connessione al database del forum, ACCIDERBOLINA!'); 
$num_righe mysql_num_rows($res); 
?>


<? if($num_righe > 0) { ?>

<table border="0" cellpadding="0" cellspacing="0">

<?
$i = 0;
while($i < $num_righe) {
$topic_id = mysql_result($res,$i,"topic_id");
$topic_title = mysql_result($res,$i,"topic_title");
if (strlen($topic_title)>27)
  $topic_title =  substr($topic_title,0,59) . '...';
$username = mysql_result($res,$i,"username");
$topic_poster = mysql_result($res,$i,"topic_poster");
 echo "<tr>";
echo "<td><a href=\"http://casino-zilla.com/forumcasino/viewtopic.php?t=$topic_id\" target=\"_blank\" title=\"$topic_title\" class='link_2'>$topic_title</td>";
echo "</tr>";
echo "<tr>";
echo "<td>Scritto da: <a href=\"http://casino-zilla.com/forumcasino/profile.php?mode=viewprofile&u=$topic_poster\" target=\"_blank\" title=\"$username\" class='link_2'>$username</td>";
echo "</tr>";
echo "<tr>";
echo "<td></td>";
echo "</tr>";
$i++;
}
?>
</table>
<? } else echo "Nessun  topic presente"; ?>

e quello che appare nel modulo è:

:
0) { ?> 27) $topic_title = substr($topic_title,0,59) . '...'; $username = mysql_result($res,$i,"username"); $topic_poster = mysql_result($res,$i,"topic_poster"); echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; $i++; } ?>
$topic_title
Scritto da: $username
?>


altri script più banali funzionano perfettamente, avete una qualche idea di come far funzionare
questo modulo di banane? ;(

: Re:script php che non va deltutto..
: Katmandu 30 Nov 2011, 14:54:49
hai provato ad usare i tags estesi per entrare ed uscire da php ??in pratica usare<?php if($num_righe > 0) { ?>

al posto di

<? if($num_righe > 0) { ?> mi è venuto il dubbio leggendo questohttp://www.php.net/manual/en/language.basic-syntax.phpmode.php


: Re:script php che non va deltutto..
: dk-wamp 30 Nov 2011, 17:07:55
si avevo già provato ma purtroppo sena risultati apprezzabili..

(ovvero non cambia un caaaaa..  ;)   )
: Re:script php che non va deltutto..
: mau_develop 30 Nov 2011, 17:17:27
http://www.joomla.it/articoli-della-community/4190-il-modello-mvc-in-joomla.html

M.