The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
RESOLVED: Vbulletin Variable / Array names in Javascript?
*warning* javascript/php noob here. I'm in the process of learning, but would *HIGHLY* appreciate some help on this. The bolded code is what I'm editing:
(note I'm using wz_tooltip.js, a javascript tooltip and the how to display active threads on forum home Code:
<script type="text/javascript" src="/js/tooltips/wz_tooltip.js"></script> <if condition="$vbulletin->options['externaljs']"> <!-- show latest active threads --> <table class="tborder" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" border="0" width="100%" align="center"> <tbody> <tr> <td class="thead" colspan="2"> <a style="float:$stylevar[right]" href="#top" onclick="return toggle_collapse('forumhome_external')"><img id="collapseimg_forumhome_external" src="$stylevar[imgdir_button]/collapse_thead$vbcollapse[collapseimg_forumhome_external].gif" alt="" border="0" /></a> <a href="search.php?$session[sessionurl]do=getnew">Latest Active Threads</a> </td> </tr> </tbody> <tbody id="collapseobj_forumhome_external" style="$vbcollapse[collapseobj_forumhome_external]"> <tr> <td class="alt1" width="100%"> <div class="smallfont"> <script type="text/javascript" src="external.php?type=js"></script> <script language="" type="text/javascript"> <!-- for (var x in threads) { document.writeln("<img class=\"inlineimg\" src=\"$stylevar[imgdir_button]/lastpost.gif\" alt=\"\" border=\"0\" /> <a onmouseover=\"Tip('<b>Thread Title:</b> $threadinfo[title]<br/> <b>Last Post Time:</b> $gnpdate<br/> <b>Username of Last Poster:</b>$threadinfo[musername]<br/> <b>Preview of Thread:</b>$threadinfo[preview]')\" onmouseout=\"UnTip()\" href=\"showthread.php?t="+threads[x].threadid+"\">"+threads[x].title+"</a><br />"); } //--> </script></div> </td> </tr> </tbody> <!-- show latest active threads --> </table> <br /> </if> |
#2
|
|||
|
|||
Wow, *there's* a cool puzzle. Anyway, too cool for me maybe because I don't see anything wrong. I can't remember, if you view the HTML source will you see the part that comes from a document.write? The only other thing I can think of is to simplify it, just put in <a onmouseover="Tip('foo')" ... and then add stuff back in gradually.
|
#3
|
|||
|
|||
Viewing source with ('Some Text') as the mouseover:
Code:
<!-- for (var x in threads) { document.writeln("<img class=\"inlineimg\" src=\"images/buttons/lastpost.gif\" alt=\"\" border=\"0\" /> <a onmouseover=\"Tip('Some text')\" onmouseout=\"UnTip()\" href=\"showthread.php?t="+threads[x].threadid+"\">"+threads[x].title+"</a><br />"); } //--> </script> Code:
<!-- for (var x in threads) { document.writeln("<img class=\"inlineimg\" src=\"images/buttons/lastpost.gif\" alt=\"\" border=\"0\" /> <a onmouseover=\"Tip('')\" onmouseout=\"UnTip()\" href=\"showthread.php?t="+threads[x].threadid+"\">"+threads[x].title+"</a><br />"); } //--> |
#4
|
|||
|
|||
I think that could only happen if $gnpdate had no value.
|
#5
|
|||
|
|||
What's interesting to note is that a variable like $bbuserinfo[musername] works!
None of the variables directly related to the individual thread though are working. Is there a way I could go about assigning them proper values? |
#6
|
|||
|
|||
I don't know what $gnpdate is supposed to be. Is it set in the same php file that the template is eval'd in?
|
#7
|
|||
|
|||
Oops, I got confused there for a second. I've been trying various plugins throughout the day and I thought that was a default vbulletin variable.
I'm trying to display the date of the last post of a thread. So when you mouse over the thread link, it will display "Last Post: 10 minutes ago". How would I go about defining that? |
#8
|
|||
|
|||
Just the date, or those other thread fields? Anyway, if you look in forumdisplay.php you'll see how the thread info is read from the database, then I think includes/functions_forumdisplay.php has functions for formatting that data. If you search in there for 'dateline' you'll find where it uses the function vbdate() to do the formatting.
It depends on which .php file you're displaying, but it looks like in general $threadinfo is set by global.php if the url has a threadid. In forumdisplay it's displaying many threads in a loop, and it looks like within that loop it's using $thread. So if your stuff is being call from there you might find that $thread[postdate] and $thread[posttime] are already set. |
#9
|
|||
|
|||
Both $thread[postdate] and $thread[posttime] show up as nothing. There seems to be no association with those variables and the thread link itself. Maybe I have to read it from the database? (I have no idea how I'd do that )
|
#10
|
|||
|
|||
Well, where are you getting the thread titles? What's the url of the page you are working on (not the domain name, but everything after that)?
|
Thread Tools | |
Display Modes | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|