Foren / Cotonti / Support / Plugin on index

Create a little plugin for index

Harker
#39508 4. Mai 2014, 21:10

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

http://hpics.li/3048c75

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

 

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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/* ====================
[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'));

 


Dieser Beitrag wurde von Harker (am 4. Mai 2014, 21:46, vor 11 Jahre) bearbeitet