Hello to all,
I come towards you because I try to create a plugin which displays on page index. I need that he shows only the information of 4 back pages(news)
I tried some solution but I become muddled with => $t = new XTemplate(cot_tplfile.....
Here is my code:
mininews.index.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
defined( 'COT_CODE' ) or die ( 'Wrong URL' );
$t = new XTemplate(cot_tplfile( 'mininews' , 'plug' ));
$sql = $db ->query("SELECT page_alias, page_title, page_avatar
FROM $db_pages
WHERE page_cat = 'news'
ORDER BY page_id DESC
Limit 4");
while ( $row = $sql ->fetch())
{
$t ->assign( array (
'PAGESS_ALIAS' => htmlspecialchars( $row [ 'page_alias' ]),
'PAGESS_TITLE' => htmlspecialchars( $row [ 'page_title' ]),
'PAGESS_AVATAR' => $row [ 'page_avatar' ]
));
$t ->parse( 'MININEWS' );
}
|
mininews.index.tpl
1 2 3 |
<!-- BEGIN: MININEWS -->
<div>{PAGESS_ALIAS}{PAGESS_TITLE}{PAGESS_AVATAR}</div>
<!-- END: MININEWS -->
|
mininews.setup.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
defined( 'COT_CODE' ) or die ( 'Wrong URL' );
|
With this code, nothing displays and I do not manage to understand why :'(
If you have a little of time, could you help me :D