The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Insert HTML or (pre-processed!) PHP file above specific forum Details »» | ||||||||||||||||||||||
Insert HTML or (pre-processed!) PHP file above specific forum
Developer Last Online: Oct 2023
This is a very simple but very powerful hack for VB 3 which I've not been able to find elsewhere so decided to write.
It inserts a named external file (or files) above a specific forum (or forums). I use it to insert some HTML from HTML AND PHP (!) files above specific forums. It works perfectly on my forums with over 28,000 members. It requires editing one file and one template. The amazing thing I discovered is that if the php function used (file_get_contents) is used on a php file, the php is processed BEFORE the file contents are read into the string. The first attached image shows this hack 'including' a php file which dynamically builds a list from a database on a different server into a drop-down list box. The second image shows the inclusion of a banner and beneath it a HTML file showing latest news (which is created automatically). * Updated August 7 2004. Altered the text file to include instructions on how to insert the file at the top of your forum list *. Please note that the forum list instructions are untested. If someone uses it, please let me know if it works ok. One question, though. This hack is so simple but so powerful, howcome nobody has done it before? Or have they already? Show Your Support
|
Comments |
#2
|
||||
|
||||
How to use this hack to display rotating banners.
You can use the above hack on a php script to create any number of rotating banners above your forums (without any modification to the forum table as per other hacks). Create a .php file as follows: PHP Code:
Upload this php file to your server and have the above hack open it. If you want to display the same set of banners on several forums, just have them open this file. If you want a different set of banners you'll need to create a different version of this file for each. Other notes: The reason for calling the perl scripts is so that a hit stats package like Webtrends can count the number of times the perl scrips have been run and provide you with the number of clicks for your banners in it's report. A typical perl script would look like this: HTML Code:
#!/usr/bin/perl print "Location: http://www.targetdomain.com/"; PHP Code:
-------------------------------------------------------------------------------------------------- Give users a control panel option to change how the added information is displayed I use this hack to include different news feed above certain forums but some users wanted it displayed at the bottom or not at all. This is very easy and thanks to Colin F who helped me. First create a new user option. I'll use my installation as an example. Admin CP > User Profile Fields > Add New User Profile Field. For the Profile field type choose Single Selection Radio Buttons or Single Selection Menu whichever you prefer. I chose the latter since it looks more similar to existing multiple choice user options. Complete the new profile field information. My forum users use this profile field to decide how to display the news and I set the Options to Above threads Below threads Not shown I set the default to Yes, but No First Blank Option. And the field IS required. Lastly for the display page 'Which page displays this option?' choose Options: other. Ok, now you have the new profile field. Take a look at the list of User Profile Fields in the User Profile Field Manager to find which field your new option is. Mine was field9. Now all you have to do is edit the FORUMDISPLAY template. Below $navbar insert ------------------- <if condition="$mycustomheader AND $bbuserinfo[field9] == 'Above threads'">$mycustomheader</if> ------------------- Note that this is the original hack altered to display the $customheader information IF the user has chosen to display it above threads. -------------------- Then below ------------------------------ <!-- ############## END THREADS LIST ############## --> </if> ------------------------------- Insert ------------------------------ <if condition="$mycustomheader AND $bbuserinfo[field9] == 'Below threads'">$mycustomheader</if> ------------------------------ Note that if users have chosen the third option 'Not shown', then the $mycustomheader information is never shown |
#3
|
||||
|
||||
Is this also working for the forumhome?
I want to add a small table right unter the navbar and want to phpinclude a file there. |
#4
|
||||
|
||||
Yes it will.
Instructions added into the text file August 7 2004. |
#5
|
||||
|
||||
thanx for this cool hack , and it will be great if you make it for vbulletin 2.x.x people
|
#6
|
||||
|
||||
Quote:
I don't run vb2 any more so if someone would like to have a look and let me know, I'll add it to the instructions. |
#7
|
||||
|
||||
thank you again
|
#8
|
||||
|
||||
I recieved this error after following your instructions:
Parse error: parse error, unexpected T_CONSTANT_ENCAPSED_STRING in /home/myfolder/forums/forumdisplay.php on line 372 Is there something wrong with your file? in your instructions for setting up on forumhome, it seems to be for calling up the file in a specific forum, maybe i am missing something here? how do i have the banners show up on every page? |
#9
|
||||
|
||||
Quote:
Is this the source of your error? If not what is the line at 372 in your file? |
#10
|
|||
|
|||
|
Thread Tools | |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|