The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
||||
|
||||
Getting from plugin to forumhome .. ?
Hey all,
I've embarked on a small mod to one I already have installed - to show the number of new adverts in a section (it's not a forum and not visible from the forumhome) - so I've done the mysql queries to get what I need. The next biggest problem is, how do I get these into a template, then somewhere near the bottom of the forumhome template. I thought this was easier than I thought - but it would appear it's quite tricky! TIA Jason |
#2
|
|||
|
|||
Assign the data you want to display to a variable then use that variable in your template.
|
#3
|
||||
|
||||
I'm a little lost, it's so much different to what I'm used to, here is the code I have (it is messy but this meant it worked)
PHP Code:
|
#4
|
|||
|
|||
You need to assign out to variables, so if you have:
PHP Code:
PHP Code:
|
#5
|
||||
|
||||
Thanks - I'm still very hazy on this, done a lot of searching and I'm still really none the wiser.
The way I've visualised this now is that the database queries are pulled and put into a variable (ie - $ads_id = $row->id; - which should pull from the row 'id' then put that into the variable $ads_id) or this is how I've interpreted it to be, then the $ads_id can be reused in the template. If I've done this wrong please correct me - I'm a little unsure about the code you showed above, it makes some sense, but I have no idea where I would put the database query results. Basically - I need these variables to achieve what I need: $row['id']; - this is the id of the item $row['title']; - this is the title of the item $row['userid']; - this is the userid from the table, which is left joined to the user table, so that the username can be pulled $row['username']; - this is from the user table, so that the username can be output rather than the userid I hope this makes some sense, I'm just lost in translation between php and vbulletin! Thanks for your help, Jason |
#6
|
|||
|
|||
I was trying to avoid doing it for you but maybe you will learn more from seeing how it should be.
PHP Code:
|
#7
|
||||
|
||||
Thanks - I thought from what you said it was easier to turn the query results into variables then use those in a template - I didn't really know if that was the easiest way of doing it, in all honesty, what I did looked untidy so I didn't want to use it.
My total aim is to have this on the forumhome - in or around the what's going on box - so it blends in seamlessly - that is the next step but I think that should be fairly simple to achieve with some searching. Would what I posted above work - putting the queries into variables then passing those to a template? Thanks for your assistance, I appreciate it. Jason |
#8
|
|||
|
|||
What I would have done is make use of two different templates so you would have:
forumhome_ads: Code:
<table border="0"> <tr> <th>Title</th> <th>Username</th> </tr> $adsbits </table> Code:
<tr> <td> <a href="vbfclassifieds.php?do=showad&adid=$row[id]"> $row[title] </a> </td> <td> <a href="/member.php?u=$row[userid]"> $row[username] </a> </td> </tr> PHP Code:
|
#9
|
||||
|
||||
Thanks - I'm following more clearly now, I will go with this system as it seems much simpler - and as well I can use existing template code to make it match in with the forumhome template, that's then my final problem, how would I go about adding it to the forumhome template - I just used the $displaydata variable and it showed up perfectly, but I'm unclear on how to get another template to show inside the forumhome template ... now I'm confusing things!
Thanks for all your help, Jason |
#10
|
|||
|
|||
I don't understand what your problem is with $displaydata. You just need to use it in your forumhome template thats all. (It contains both the other templates within it. So when you put it in your forumhome template they will show up)
You may find this useful: Create your own vBulletin tables |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|