Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 01 Apr 2017, 20:30
Alice Alice is offline
 
Join Date: Mar 2013
Real name: Alice
Random Quotes

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:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

Hopefully, someone out there is able to provide some insight. Thank you,
Reply With Quote
  #2  
Old 01 Apr 2017, 20:44
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
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.
__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #3  
Old 01 Apr 2017, 20:48
Alice Alice is offline
 
Join Date: Mar 2013
Real name: Alice
Originally Posted by MarkFL View Post
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.
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?
Reply With Quote
  #4  
Old 01 Apr 2017, 20:52
MarkFL's Avatar
MarkFL MarkFL is offline
 
Join Date: Feb 2014
Real name: Mark
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.
__________________
Former vBulletin.org Staff Member



Support for my products (as well as updates/new product publishing) has been moved to MHB - vBulletin Products and TAZ - Add-ons
Reply With Quote
  #5  
Old 01 Apr 2017, 20:53
Alice Alice is offline
 
Join Date: Mar 2013
Real name: Alice
So you can use the plugin in much the same way as I did to define the $quotemain for the footer template, right?


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

It might be a good idea. I know so many people still use 3.8.x, heck I still know someone who still uses 2.3.x LOL!

--------------- Added 01 Apr 2017 at 21:48 ---------------

Originally Posted by MarkFL View Post
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.
Okay, so I got somewhere with this. In the quotes_main template (which is called in the footer template as &quotemain), I added:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

The contents of the quotes_database.js is:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

And the contents of quotes_call.js is:


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

And this is how it shows up on my forum:

http://i.imgur.com/WKaQou4.png?1

-Sara

Last edited by Alice; 01 Apr 2017 at 21:49.
Reply With Quote
  #6  
Old 01 Apr 2017, 22:02
blind-eddie's Avatar
blind-eddie blind-eddie is offline
 
Join Date: Apr 2006
Real name: Tim
Use this.... edit to your liking
I have an edited version of it on my site.

http://www.vbulletin.org/forum/showt...highlight=tips
__________________
LONG LIVE 3.8 SERIES
National Arcade Competition Club- NACC All arcade edits will work on vb4.
Check out my heavily modified ibproarcade with over 50,000 games for you, free of charge!
Exclusive arcade addons, edits and skins were made by stangger5 owner of Next Level Arcade
Reply With Quote
  #7  
Old 02 Apr 2017, 02:44
Alice Alice is offline
 
Join Date: Mar 2013
Real name: Alice
Originally Posted by blind-eddie View Post
Use this.... edit to your liking
I have an edited version of it on my site.

http://www.vbulletin.org/forum/showt...highlight=tips
Thank you so much for your contribution. I've actually already implemented what I included above and it works splendidly
Reply With Quote
Reply

Similar Threads
Thread Thread Starter Forum Replies Last Post
Show Thread Enhancements Better Quotes - Round Quotes Sofia vBulletin 3.8 Template Modifications 79 14 Aug 2010 10:48



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 11:32.

Layout Options | Width: Wide Color: