The Arcive of vBulletin Modifications Site. |
|
|
#1
|
|||
|
|||
|
Hello Again,
Does anyone happen to know the best method to have random quotes displayed everytime a page in vBulletin is refreshed? An image of where I have setup for the quotes to be displayed is as follows: http://i.imgur.com/29KA8Fk.png?1 And the code for that is: Code:
<table class="tcat" cellpadding="4" cellspacing="0" border="0" width="100%" align="center" style="border-top:1px solid $stylevar[tborder_bgcolor]; border-bottom:1px solid $stylevar[tborder_bgcolor]">
<tr>
<td height="1" bgcolor="$stylevar[tcat_bgcolor]">
</td>
<tr>
<td align="center" bgcolor="$stylevar[select_bgcolor]">
<font face="verdana,arial,helvetica" size="1" ><i>"Quote Text."</i> - <b>Quote Author</font>
</td>
<tr>
<td height="1" bgcolor="$stylevar[tcat_bgcolor]">
</td>
</table></table>
</div>
|
|
#2
|
||||
|
||||
|
What I would do is define a 2D array of quotes, where each element of the array contains a quote and the author, and then generate a random number between 1 and the length of the array (inclusive), then pass the selected array element to your template.
|
|
#3
|
|||
|
|||
|
How would I interface that with a vbulletin template though? Like there are plenty of random tutorials out there that involve php code, but I don't know how to integrate that into a vBulletin template so its a little confusing, you know?
|
|
#4
|
||||
|
||||
|
You could use a global plugin hook, and I believe in vB 3 you don't even need to register the variables in your template.
I don't have time right now, but if you want, I will look into creating a vB 3.8.x product to do this.
|
|
#5
|
|||
|
|||
|
So you can use the plugin in much the same way as I did to define the $quotemain for the footer template, right?
Code:
eval('$quotemain= "' . fetch_template('quotes_main') . '";');
eval('$quotetext= "' . fetch_template('quotes_text') . '";');
--------------- Added [DATE]1491083304[/DATE] at [TIME]1491083304[/TIME] --------------- Quote:
Code:
<script type="text/javascript" src="clientscript/quotes_database.js"></script> <script type="text/javascript" src="clientscript/quotes_call.js"></script> PHP Code:
PHP Code:
http://i.imgur.com/WKaQou4.png?1 -Sara |
|
#6
|
||||
|
||||
|
Use this.... edit to your liking
I have an edited version of it on my site. https://vborg.vbsupport.ru/showthrea...highlight=tips |
|
#7
|
|||
|
|||
|
Quote:
|
![]() |
|
|
| X vBulletin 3.8.12 by vBS Debug Information | |
|---|---|
|
|
More Information |
|
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|