<div id="post_[+postid+]" class="forum_message"> <a href="[+forumlink+]/showthread.php?p=[+postid+]">[+threadtitle+] ([+replycount+])</a> <span id="user">[+lastposter+] [+postdate+]</span> <p>/[+forum+]</p> [+shortmessage+] </div> <br /> - in the same css styles, you can format this particular paragraph using the .forum_message p {} selector. Well, then insert the placeholder trimmed forum message. Personally, I did not need it, but I did it - the template engine will successfully process it and replace it with an empty space. <? php
global $ modx, $ vbulletin;
$ forumlink = 'http: // URLTOYOUFORUM';
$ forum_base = (empty ($ vbulletin-> config ['Database'] ['dbname']))? 'FORUMBASE': $ vbulletin-> config ['Database'] ['dbname'];
// here it is necessary to clarify: most likely the base of the forum and the site is different, therefore we need to know the name of the forum base
$ forum_prefix = (empty ($ vbulletin-> config ['Database'] ['tableprefix']))? 'vb_': $ vbulletin-> config ['Database'] ['tableprefix'];
$ count = (empty ($ count) || ($ count <2))? 10: $ count; // number of messages for output, default 10
$ sql = 'SELECT t.title as topic, t.lastpostid, t.lastpost, t.lastposter, t.forumid, t.replycount, t.dateline, f.title as forum
FROM `'. $ Forum_base.'` ``. $ Forum_prefix.'thread` t, `'. $ Forum_base.'`` `. $ Forum_prefix.'forum` f
WHERE t.`visible` = 1
AND t.`open` = 1
AND f.forumid = t.forumid
AND t.forumid NOT
IN (
SELECT forumid
FROM `'. $ Forum_base.'`.``. $ Forum_prefix.'forumpermission`
)
ORDER BY t.lastpost DESC
LIMIT '. $ Count.'; ';
$ res = $ modx-> db-> query ($ sql);
$ txt = ";
while ($ f_res = $ modx-> db-> getRow ($ res, 'assoc')) {
// elements of the array are called quite understandable to themselves
$ txt. = $ modx-> parseChunk ('forum_last_messages',
array (
'forumlink' => $ forumlink,
'postid' => $ f_res ['lastpostid'],
'threadtitle' => $ f_res ['topic'],
'replycount' => $ f_res ['replycount'],
'lastposter' => $ f_res ['lastposter'],
'forum' => $ f_res ['forum'],
'postdate' => date ("H: i", $ f_res ['lastpost']) // date format
),
'[+',
'+]'
);
}
return $ txt;
?>
Source: https://habr.com/ru/post/93943/
All Articles