The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Show Thread Description :(
I have this code:
<script language="" type="text/javascript"> var name1 = new String(); var title1 = new String(); for (x = 0; x < 4; x++){ name1 = threads[x].poster; if (name1.length > 13){ name1 = name1.slice(0,9) + "…"; } title1 = threads[x].title; if (title1.length > 28){ title1 = title1.slice(0,25) + "…"; } document.writeln("<a href=\"http://www.habbohotelforum.net/showthread.php?t="+threads[x].threadid+"\" target=\"_blank\" class=\"forumtitle\">"+title1+" »</a><br /><div style=\"padding-bottom: 5px;\"><em>+description+(Posted by "+name1+")</em></div>");} </script> I'm trying to add the description about 26 characters of the first post please. I'm having problems. Also i'm using 3.8.7 SP2 Thank you for any help provided. |
#2
|
|||
|
|||
and the problem would be?
|
Благодарность от: | ||
MikeJDance |
#3
|
|||
|
|||
It's not picking up the post, just the title and the Poster
|
#4
|
|||
|
|||
a screenshot or a link
|
#5
|
|||
|
|||
|
#6
|
|||
|
|||
Are you using external.php with type=js? The output doesn't include any info from the post. You would need to modify external.php or else come up with another way to get the post text.
|
#7
|
|||
|
|||
yes i am mate. What could i put in it for it to get the text?
|
#8
|
|||
|
|||
In external.php around line 409, try replacing the entire "if type is js" block with this:
Code:
if ($vbulletin->GPC['type'] == 'JS') { // javascript output $output = " function thread(threadid, title, poster, threaddate, threadtime, preview) { this.threadid = threadid; this.title = title; this.poster = poster; this.threaddate = threaddate; this.threadtime = threadtime; this.preview = preview; } "; $output .= "var threads = new Array(" . sizeof ($threadcache) . ");\r\n"; if (!empty($threadcache)) { require_once(DIR . '/includes/class_bbcode_alt.php'); foreach ($threadcache AS $threadnum => $thread) { $thread['title'] = addslashes_js(htmlspecialchars_uni($thread['prefix_plain']) . $thread['title']); $thread['poster'] = addslashes_js($thread['postusername']); $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list($vbulletin->options['bburl'] . '/')); $preview = $plaintext_parser->parse($thread['message'], $thread['forumid']); unset($plaintext_parser); if (strlen($preview) > 23) $preview = substr($preview, 0, 23) . "..."; $preview = addslashes_js($preview); $output .= "\tthreads[$threadnum] = new thread($thread[threadid], '$thread[title]', '$thread[poster]', '" . addslashes_js(vbdate($vbulletin->options['dateformat'], $thread['dateline'])) . "', '" . addslashes_js(vbdate($vbulletin->options['timeformat'], $thread['dateline'])) . "', '" . $preview . "');\r\n"; } } } Then you should be able to use thread[x].preview in your js code. You might want to comment out the existing if block so you can easily bring it back if needed. BTW, I put the length limiting code in the php so you don't need to check in your js. Or if you'd rather have it in the js you can of course remove that line from the php. |
#9
|
|||
|
|||
Quote:
--------------- Added [DATE]1335461255[/DATE] at [TIME]1335461255[/TIME] --------------- I've changed external.php code to: Code:
if ($vbulletin->GPC['type'] == 'JS') { // javascript output $output = " function thread(threadid, title, poster, threaddate, threadtime, preview) { this.threadid = threadid; this.title = title; this.poster = poster; this.threaddate = threaddate; this.threadtime = threadtime; this.preview = preview; } "; $output .= "var threads = new Array(" . sizeof ($threadcache) . ");\r\n"; if (!empty($threadcache)) { require_once(DIR . '/includes/class_bbcode_alt.php'); foreach ($threadcache AS $threadnum => $thread) { $thread['title'] = addslashes_js(htmlspecialchars_uni($thread['prefix_plain']) . $thread['title']); $thread['poster'] = addslashes_js($thread['postusername']); $plaintext_parser = new vB_BbCodeParser_PlainText($vbulletin, fetch_tag_list($vbulletin->options['bburl'] . '/')); $preview = $plaintext_parser->parse($thread['message'], $thread['forumid']); unset($plaintext_parser); if (strlen($preview) > 23) $preview = substr($preview, 0, 23) . "..."; $preview = addslashes_js($preview); $output .= "\tthreads[$threadnum] = new thread($thread[threadid], '$thread[title]', '$thread[poster]', '" . addslashes_js(vbdate($vbulletin->options['dateformat'], $thread['dateline'])) . "', '" . addslashes_js(vbdate($vbulletin->options['timeformat'], $thread['dateline'])) . "', '" . $preview . "');\r\n"; } } } Code:
<script language="" type="text/javascript"> var name1 = new String(); var title1 = new String(); for (x = 0; x < 4; x++){ if (name1.length > 13){ name1 = name1.slice(0,9) + "…"; } preview1 = thread[x].preview; if (preview1.length > 26){ preview1 = preview1.slice(0,25) + "…"; preview1 = thread[x].preview; } if (title1.length > 26){ title1 = title1.slice(0,25) + "…"; } document.writeln("<a href=\"http://www.habbolandforum.net/showthread.php?t="+threads[x].threadid+"\" target=\"_blank\">"+title1+"</a><br /><div style=\"padding-bottom: 5px;\"><em>"+preview1+"</em></div>");} </script> It just shows nothing. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|