![]() |
Random hex color
Hello,
I have some PHP code that generates a random hex color code. I would like to incorporate it for use in vbulletin (it has to be server side). In a normal PHP file, the output is something like $randomcolor. Does anyone know how to get that to be displayed properly within VB using the plugin system (if that's the proper way to do it)? |
Stick the PHP code in a new plugin using the "global_start" hook. $randomnumber should then be available to use in most templates.
|
Best way is to put the code in a plugin for global_start and then call the variable you are using for it wherever you want to use it.
|
wow, fast replies, many thanks.
Is it simply called with $randomnumber ? Or does it need some {} or [] ? |
Quote:
|
OK, the code I plan on using is from here:
http://www.zend.com/tips/tips.php?id=243&single=1 My rendition is below: Code:
<? |
Okay, in your plugin, do NOT include the PHP tags (<? and ?>). Everything else looks okay - be sure to add the # in front of $randomcolor when you use it. And no, you won't need any []s or {}s.
|
OK, thanks again for the quick reply. I'm trying to use it in the postbit_legacy to display in posts, but nothing is showing.
Should I call it differently for there? |
Quote:
PHP Code:
If you want them all the same: postbit_display_complete PHP Code:
|
Fantastic! My deepest thanks. I'm actually using as part of an included JS script that needs an image border color and it works well now! Thanks!
|
All times are GMT. The time now is 09:27 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|