问题描述:

I have small project in which i am working with tables inside tabs. In the last table I am trying to call news.php file which will show all the news inside table but no results is showing here. Can anyone know where i am doing wrong? ANd how to call news.php file inside div ? Thanks.

Here is my code:

<?php

// -- REGISTER ERSTELLEN -------------------------------------------------------

$page['register-fahrzeuge'] = array(

1 => array( 'Fahrzeug','aktiv',$page['script'],'',''),

0 => array( 'Edit-Fahrzeug','aktiv',$page['script'],'',''),

);

$page['register-news'] = array(

1 => array( 'News','aktiv',$page['script'],'',''),

);

// -- HTML AUSGEBEN ------------------------------------------------------------

$page['content'] .= '

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

<tr>

<td>

<div>'.CreateRegister($page['register-news']).'</div>

'.CreateMessage().'

<div class="cont-liste-verlauf register">

<?php

require ("news.php");

?>

</div>

</td>

</tr>

</table>';

?>

网友答案:

You need to do this:

$page['content'] .= '

<table width="538" cellspacing="0" cellpadding="0" border="0" >
    <tr>
        <td>
            <div>'.CreateRegister($page['register-news']).'</div>
            '.CreateMessage().'
            <div class="cont-liste-verlauf register">'.require ("news.php").' </div>
        </td>
    </tr>
</table>';

You cann't use <?php tag inside a <?php tag again so remove this

网友答案:

I was making mistake in defining php file. Here is the answer:

$page['content'] .= '

<table width="538" cellspacing="0" cellpadding="0" border="0" >
    <tr>
        <td>
            <div>'.CreateRegister($page['register-news']).'</div>
            '.CreateMessage().'
            <div class="cont-liste-verlauf register">'.require ("news.php").' </div>
        </td>
    </tr>
</table>';
网友答案:

Change your code as follows,

<?php
// -- REGISTER ERSTELLEN -------------------------------------------------------

$page['register-fahrzeuge'] = array(
    1   => array( 'Fahrzeug','aktiv',$page['script'],'',''),
    0   => array( 'Edit-Fahrzeug','aktiv',$page['script'],'',''),   
);

$page['register-news'] = array(
    1   => array( 'News','aktiv',$page['script'],'',''),
);



// -- HTML AUSGEBEN ------------------------------------------------------------
$page['content'] .= '

<table width="538" cellspacing="0" cellpadding="0" border="0" >
    <tr>
        <td>
            <div>'.CreateRegister($page['register-news']).'</div>
            '.CreateMessage().'
            <div class="cont-liste-verlauf register">'.

                require ("news.php").'

            </div>
        </td>
    </tr>
</table>';
?>
相关阅读:
Top