Hello, I have added "latest threads" on my homepage: ( no in /forum)
But xattachments (thumbs of Xthreads) don't work.
I have edited index.php in this way, but nothing:
Code:
// Latest forum discussions2
if($mybb->settings['portal_showdiscussions'] != 0 && $mybb->settings['portal_showdiscussionsnum']) {
$altbg = alt_trow();
$threadlist = '';
$piccount=4;
$query = $db->query("
SELECT a.updatetime, a.uploadtime, a.attachname, a.filename, a.thumbs, t.*
FROM ".TABLE_PREFIX."xtattachments a
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=a.tid)
WHERE t.visible=1 AND a.thumbs!=' ' AND t.showinportal='1' AND t.closed NOT LIKE 'moved|%' AND t.fid IN ('128')
GROUP BY a.tid
ORDER BY t.dateline DESC
LIMIT 0, $piccount
");
|
I have this path error:
How can I resolve?
Thank you in advance
You haven't posted all your edits.
(11-07-2013 11:46 AM)ZiNgA BuRgA Wrote: [ -> ]You haven't posted all your edits.
You mean global templates?
portal_latestthreads2
Code:
<div class="thead"><strong>{$lang->latest_threads}</strong></div>
<div>
{$threadlist}
</div>
<br />
|
portal_latestthreads_thread2
Code:
<div class="custhovfordisplay" style="padding: 4px 0px 7px 0px;">
<a href="{$mybb->settings['bburl']}/{$thread['threadlink']}" title="{$thread['subject']}"><strong>{$thread['subject']}</strong></a></div>
<div class="sfondogrigio">
<div class="float_left">
<div align="center" style="height:80px;">
<a href="{$thread['threadlink']}">
<img src="{$GLOBALS['threadfields']['portalimg']['url']}/thumb80x80" width="{$GLOBALS['threadfields']['portalimg']['thumbs']['80x80']['w']}" height="{$GLOBALS['threadfields']['portalimg']['thumbs']['80x80']['h']}" alt="{$thread['subject']}" class="attachment" />
</a>
</div>
</div>
<div class="textright">
<ul>
<li><a href="{$thread['lastpostlink']}">Risposta di: </a>{$lastposterlink}</li>
<li>{$lastpostdate} alle {$lastposttime}</li>
</ul>
</div>
</div>
|
index.php
Code:
// Latest forum discussions2
if($mybb->settings['portal_showdiscussions'] != 0 && $mybb->settings['portal_showdiscussionsnum'])
{
$altbg = alt_trow();
$threadlist = '';
$piccount=4;
$query = $db->query("
SELECT a.updatetime, a.uploadtime, a.attachname, a.filename, a.thumbs, t.*
FROM ".TABLE_PREFIX."xtattachments a
LEFT JOIN ".TABLE_PREFIX."threads t ON (t.tid=a.tid)
WHERE t.visible=1 AND a.thumbs!=' ' AND t.showinportal='1' AND t.closed NOT LIKE 'moved|%' AND t.fid IN ('128')
GROUP BY a.tid
ORDER BY t.dateline DESC
LIMIT 0, $piccount
");
while($thread = $db->fetch_array($query))
{
$forumpermissions[$thread['fid']] = forum_permissions($thread['fid']);
// Make sure we can view this thread
if($forumpermissions[$thread['fid']]['canview'] == 0 || $forumpermissions[$thread['fid']]['canviewthreads'] == 0 || $forumpermissions[$thread['fid']]['canonlyviewownthreads'] == 1 && $thread['uid'] != $mybb->user['uid'])
{
continue;
}
$lastpostdate = my_date($mybb->settings['dateformat'], $thread['lastpost']);
$lastposttime = my_date($mybb->settings['timeformat'], $thread['lastpost']);
// Don't link to guest's profiles (they have no profile).
if($thread['lastposteruid'] == 0)
{
$lastposterlink = $thread['lastposter'];
}
else
{
$lastposterlink = build_profile_link($thread['lastposter'], $thread['lastposteruid']);
}
if(my_strlen($thread['subject']) > 25)
{
$thread['subject'] = my_substr($thread['subject'], 0, 25) . "...";
}
$thread['subject'] = htmlspecialchars_uni($parser->parse_badwords($thread['subject']));
$thread['threadlink'] = get_thread_link($thread['tid']);
$thread['lastpostlink'] = get_thread_link($thread['tid'], 0, "lastpost");
eval("\$threadlist .= \"".$templates->get("portal_latestthreads_thread2")."\";");
$altbg = alt_trow();
}
if($threadlist)
{
// Show the table only if there are threads
eval("\$latestthreads2 = \"".$templates->get("portal_latestthreads")."\";");
}
}
|
Sorry and thank you
You're never evaluating $threadfields anywhere. Of course it won't work - your PHP code doesn't even have a mention of $threadfields.
The general gist of things is to have something like
PHP Code:
$url = get_xta_url($thread);
|
and use {$url} in templates, although that doesn't solve everything. I'm just not really in the mood for custom coding at the moment...