The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
......
|
|
#2
|
||||
|
||||
|
Is this code *you* wrote? And if not, do you have permission from the author to post it? If not, you may NOT post it here.
|
|
#3
|
|||
|
|||
|
Quote:
Look around and see if it's anywhere on this board or anywhere else unless I posted it. If you can assist then I would be very happy. |
|
#4
|
||||
|
||||
|
Most likely what you need to change are the templates and the syntax to render the templates. Cellarius wrote a really good article that you may be interested in - [vB4] Rendering templates and registering variables - a short guide
|
|
#5
|
|||
|
|||
|
Quote:
Code:
<?xml version="1.0" encoding="ISO-8859-1"?>
<product productid="pblatestthreads" active="1">
<title>PB Latest Threads</title>
<description>Show the latest threads with transition effects.</description>
<version>1.0</version>
<url />
<versioncheckurl />
<dependencies>
</dependencies>
<codes>
</codes>
<templates>
<template name="pb_latestthreads_area" templatetype="template" date="1237182817" username="admin" version="1.0"><![CDATA[<table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center">
<tr>
<td class="tcat">Latest Threads</td>
</tr>
<tr>
<td class="alt1">
<div id='mid'>
<div id='slideshow'>
<div class="pbslide_container">
<div class="pbslide_inner" >
$pblatest_bigblocks
</div>
<div class="pbslide_bottombar">
$pblatest_smallblocks
</div>
</div><br/>
<script type="text/javascript">
var timeouts=new Array();
var curframe=1;
var start_frame=1;
var end_frame=$pblimit;
var oldframe=$pblimit;
var TimeToFade = 700;
var delay=5000;
pbstart_slideshow(delay);
</script>
</div>
</div>
</td>
</tr>
</table>
]]></template>
<template name="pb_latestthreads_bigblock" templatetype="template" date="1237182417" username="admin" version="1.0"><![CDATA[ <div class="pbslide_innerbox" $pbstyle id="pbslide$pbcount">
<div class="pbslide_innercontent" >
<a href="showthread.php?t=$pbthreadid">$pbthreadtitle</a><br/>
<span>by $pbthreadstarter - $pbthreaddate</span><br/>
$pbpagetext
</div>
</div>]]></template>
<template name="pb_latestthreads_smallblock" templatetype="template" date="1237420070" username="admin" version="1.0"><![CDATA[ <div class="pbslide_titles">
<img $pbimage id="pbslide_b$pbcount" style="border:0;padding:0px;margin:0px;" alt=""/>
<a href="showthread.php?goto=newpost&t=$pbthreadid" class="smallfont" title="$pbpagetext">$pbthreadtitle2</a>
- Last Post: $pblastposttime by $pblastposter >> Replies: $pbreplies >> Views: $pbviews
</div>]]></template>
</templates>
<plugins>
<plugin active="1" executionorder="5">
<title>pb_latestthreads_cache</title>
<hookname>cache_templates</hookname>
<phpcode><![CDATA[global $globaltemplates;
$globaltemplates = array_merge($globaltemplates, array('pb_latestthreads_bigblock','pb_latestthreads_smallblock','pb_latestthreads_area'));]]></phpcode>
</plugin>
<plugin active="1" executionorder="5">
<title>pb_latestthreads_global</title>
<hookname>global_setup_complete</hookname>
<phpcode><![CDATA[global $vbulletin;
$pbwhere=$vbulletin->options['pb_latest_whereto'];
if($pbwhere==0 or ($pbwhere==1 and THIS_SCRIPT=='index')or ($pbwhere==2 and THIS_SCRIPT=='forumdisplay') or ($pbwhere==3 and((THIS_SCRIPT=='index')or (THIS_SCRIPT=='forumdisplay')))){
$pbforumids=$forumids;
// forum permissions
$pbforumpermissions = array();
foreach($vbulletin->forumcache AS $pbforum)
{
$pbforumpermissions[$pbforum["forumid"]] = fetch_permissions($pbforum['forumid']);
if ((!($pbforumpermissions[$pbforum["forumid"]] & $vbulletin->bf_ugp_forumpermissions['canview'])) OR (!($pbforum['options'] & $vbulletin->bf_misc_forumoptions['active']) AND !$vbulletin->options['showprivateforums'] AND !in_array($vbulletin->userinfo['usergroupid'], array(5,6,7))))
{
$pbforumids .= ','.$pbforum['forumid'];
}
}
if ($vbulletin->options['pbslide_exclude']!='' and isset($vbulletin->options['pbslide_exclude']))
{
$pbforumids .= ','.$vbulletin->options['pbslide_exclude'];
}
$pbforumids = substr($pbforumids, 1);
if ($pbforumids!='')
{
$pblatest_and = "thread.forumid NOT IN($pbforumids)";
$pblatest_and_1 = "forum.forumid NOT IN($pbforumids)";
}
// converts options to nice variables
$pblimit = $vbulletin->options['pbslide_numthreads'];
// query to get the last posts
$pbquery = $vbulletin->db->query_read("
SELECT
thread.forumid as forumid, thread.visible, thread.title as thread_title, thread.threadid as threadid, thread.postusername as username, thread.postuserid as userid, thread.dateline as date, thread.lastposter as lastposter, thread.lastpost as lastpost, thread.replycount as replies, thread.views as views,
forum.title as forum_title,
post.postid, post.pagetext as pagetext
FROM " . TABLE_PREFIX . "post as post
LEFT JOIN " . TABLE_PREFIX . "thread as thread on (thread.firstpostid = post.postid)
LEFT JOIN " . TABLE_PREFIX . "forum as forum on (thread.forumid = forum.forumid)
WHERE thread.visible = 1 AND $pblatest_and AND $pblatest_and_1
ORDER BY thread.lastpost DESC
LIMIT $pblimit"
);
// reset variables
$pbcount = 0;
$pblatest_bigblocks = '';
$pblatest_smallblocks='';
while ($pbrow = $vbulletin->db->fetch_array($pbquery))
{
// allow to use alternate color in rows
// strips the bbcode out of the post
$pbrow['pagetext'] = strip_bbcode($pbrow['pagetext'], $stripquotes = true, $fast_and_dirty = false, $showlinks = true);
// adds the cutoff ... with substr
$pbrow['pagetext'] = substr($pbrow['pagetext'], 0, $vbulletin->options['pbslide_cutoff']) . '...';
$pbthreadtitle2 = substr($pbrow['thread_title'], 0, $vbulletin->options['pbslide_cutoff_titles']) . '...';
// convert pagetext to nice looking variable
$pbpagetext = $pbrow['pagetext'];
$pbthreadstarter = $pbrow['username'];
$pbuserid = $pbrow['userid'];
$pbforumid = $pbrow['forumid'];
$pbthreadid = $pbrow['threadid'];
$pbforumtitle = $pbrow['forum_title'];
$pbthreadtitle = $pbrow['thread_title'];
$pbthreaddate = vbdate($vbulletin->options['dateformat'], $pbrow['date'], true)." at ".vbdate($vbulletin->options['timeformat'], $pbrow['date']);
$pblastposttime = vbdate($vbulletin->options['dateformat'], $pbrow['lastpost'], true)." at ".vbdate($vbulletin->options['timeformat'], $pbrow['lastpost']);
$pblastposter=$pbrow['lastposter'];
$pbviews=$pbrow['views'];
$pbreplies=$pbrow['replies'];
// increments the counter +1
$show['latest_break'] = $pbcount++;
if($pbcount==1){
$pbstyle="";
$pbimage="src=\"images/button.png\"";
}
else{
$pbstyle="style=\"display:none;opacity:0;filter:alpha(opacity =0)\"";
$pbimage="src=\"images/button2.png\"";
}
//eval('$pblatest_bigblocks .= "' . fetch_template('pb_latestthreads_bigblock') . '";');
$templater->register('pb_latestthreads_bigblock', $pblatest_bigblocks);
$pblatest_bigblocks = $templater->render();
//eval('$pblatest_smallblocks .= "' . fetch_template('pb_latestthreads_smallblock') . '";');
templater->register('pb_latestthreads_smallblock', $pblatest_smallblocks);
$pblatest_smallblocks = $templater->render();
}
// free the query
$vbulletin->db->free_result($pbquery);
//eval('$PBLatestThreads = "' . fetch_template('pb_latestthreads_area') . '";');
$templater = vB_Template::create('mytemplate');
$templater->register('pb_latestthreads_area', $PBLatestThreads);
$PBLatestThreads = $templater->render();
}
else{
$PBLatestThreads ='';
}]]></phpcode>
</plugin>
</plugins>
<phrases>
<phrasetype name="vBulletin Settings" fieldname="vbsettings">
<phrase name="setting_pb_latest_whereto_desc" date="1239304462" username="admin" version="1.0"><![CDATA[Where do you want to display the latest threads.]]></phrase>
<phrase name="setting_pb_latest_whereto_title" date="1239304462" username="admin" version="1.0"><![CDATA[Where to show?]]></phrase>
<phrase name="setting_pbslide_cutoff_desc" date="1237179560" username="admin" version="1.0"><![CDATA[Number of characters before the pagetext gets off]]></phrase>
<phrase name="setting_pbslide_cutoff_title" date="1237179560" username="admin" version="1.0"><![CDATA[Post text cutoff]]></phrase>
<phrase name="setting_pbslide_cutoff_titles_desc" date="1237179573" username="admin" version="1.0"><![CDATA[The amount of characters displayed before thread titles are cutoff.]]></phrase>
<phrase name="setting_pbslide_cutoff_titles_title" date="1237179573" username="admin" version="1.0"><![CDATA[Title Cutoff]]></phrase>
<phrase name="setting_pbslide_exclude_desc" date="1237179585" username="admin" version="1.0"><![CDATA[Put the forum ID's of the forums you want to exclude seperated by commas]]></phrase>
<phrase name="setting_pbslide_exclude_title" date="1237179585" username="admin" version="1.0"><![CDATA[Exclude Forums]]></phrase>
<phrase name="setting_pbslide_numthreads_desc" date="1237183072" username="admin" version="1.0"><![CDATA[The number of threads to display.]]></phrase>
<phrase name="setting_pbslide_numthreads_title" date="1237183072" username="admin" version="1.0"><![CDATA[Number of Threads]]></phrase>
<phrase name="settinggroup_pbslide_latestthreads" date="1237175444" username="admin" version="1.0"><![CDATA[PB Latest Threads]]></phrase>
</phrasetype>
</phrases>
<options>
<settinggroup name="pbslide_latestthreads" displayorder="65535">
<setting varname="pbslide_exclude" displayorder="10">
<datatype>free</datatype>
<defaultvalue>1</defaultvalue>
</setting>
<setting varname="pbslide_cutoff" displayorder="20">
<datatype>number</datatype>
<defaultvalue>100</defaultvalue>
</setting>
<setting varname="pbslide_cutoff_titles" displayorder="30">
<datatype>number</datatype>
<defaultvalue>20</defaultvalue>
</setting>
<setting varname="pbslide_numthreads" displayorder="40">
<datatype>number</datatype>
<defaultvalue>5</defaultvalue>
</setting>
<setting varname="pb_latest_whereto" displayorder="50">
<datatype>free</datatype>
<optioncode>select:piped
0|Everywhere
1|ForumHome Only
2|ForumDisplay Only
3|ForumDisplay and ForumHome</optioncode>
</setting>
</settinggroup>
</options>
<helptopics>
</helptopics>
<cronentries>
</cronentries>
<faqentries>
</faqentries>
</product>
|
|
#6
|
||||
|
||||
|
You also need to change the template syntax as noted in the article here:
Quote:
|
|
#7
|
|||
|
|||
|
Thanks allot. Forgive me for being a novice but I have no idea where those are to go in the code or what to change.
|
|
#8
|
||||
|
||||
|
They are variables. So, instead of $my_variable, you would use {vb:raw my_variable}
|
|
#9
|
|||
|
|||
|
Quote:
--------------- Added [DATE]1263084199[/DATE] at [TIME]1263084199[/TIME] --------------- I tried all that I can. It's not working. can someone make the edits needed for me and post it here please? --------------- Added [DATE]1263084258[/DATE] at [TIME]1263084258[/TIME] --------------- Thanks for your help but this looks like it's notworking for me. I just don't know how. |
|
#10
|
||||
|
||||
|
In the code given above, I see lots of variables used in the template that are not registered, like $pbstyle, $pbthreadid, $pbthreadtitle etc. Basically none of the variables you use in the template are registered. Please read the tutorial Lynne linked you to again, especially the part about "Save into a variable for later use in custom template".
For $threadid for example, you need to register the variable for your bigblock template and for your smallblock template: PHP Code:
Now you can call $threadid in your template pb_latestthreads_bigblock by inserting {vb:raw threadid}. To be able to call the variable you saved the template into ($pblatest_bigblock) in your pb_latestthreads_area template, you again need to register it: Your code there: PHP Code:
IT would look something like that: PHP Code:
Basically: - bigblock template: register every variable you want to use inside this template, save into variable - smallblock template: register every variable you want to use inside this template, save into variable - area template: register every variable you want to use inside this template, including the variables you saved bigblock and smallblock templates into; save area template into variable, then preregister this variable for use in existing template |
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|