Create a little plugin for index
| Harker |
|
|---|---|
|
Hi Aiwass, I am going to try to explain but I manage not very well in English. In fact, I already use 'recentitems' other leave in the design. Actually, i use the plugin 'News' and i also parametrized him to see 4 news. For the design of my website, I need both. (news & my_plug[mininews]) You know how to see on the image what I wish to make That's why I wish to make this plugin, to show 4 right images
Added 36 minutes later: Later of numerous copy/paste, I finally managed to show what I wished \o/ To be frank, I have no idea of why it works. This is what I modified : mininews.index.php
/* ====================
[BEGIN_COT_EXT]
Hooks=index.tags
Tags=index.tpl:{MININEWS}
[END_COT_EXT]
==================== */
defined('COT_CODE') or die('Wrong URL');
$ttt = new XTemplate(cot_tplfile('mininews.index', '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");
/* === Hook - Part1 === */
$extp = cot_getextplugins('mininews.index.tags');
/* ===== */
foreach ($sql->fetchAll() as $row)
{
$ttt->assign(array(
'PAGESS_ALIAS' => htmlspecialchars($row['page_alias']),
'PAGESS_TITLE' => htmlspecialchars($row['page_title']),
'PAGESS_AVATAR' => $row['page_avatar']
));
/* === Hook - Part2 === */
foreach ($extp as $pl)
{
include $pl;
}
/* ===== */
$ttt->parse('MININEWS');
}
$t->assign('MININEWS', $ttt->text('MININEWS'));
This post was edited by Harker (2014-05-04 21:46, 11 years ago)
|