Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.0 > vBulletin 3.0 Full Releases

Reply
 
Thread Tools
Insert HTML or (pre-processed!) PHP file above specific forum Details »»
Insert HTML or (pre-processed!) PHP file above specific forum
Version: 1.00, by Spinball Spinball is offline
Developer Last Online: Oct 2023 Show Printable Version Email this Page

Version: 3.0.3 Rating:
Released: 08-02-2004 Last Update: Never Installs: 24
Supported
 

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

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #2  
Old 08-03-2004, 08:22 AM
Spinball's Avatar
Spinball Spinball is offline
 
Join Date: Feb 2002
Location: Telford, England
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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:
<?php
$banners 
= array (
        
"banner1.gif|link1.pl|Alt text for banner 1|0|468|60",
        
"banner2.gif|link2.pl|Alt text for banner 2|0|468|60",
        
"banner3.gif|link3.pl|Alt text for banner 3|0|468|60",
        
"banner4.gif|link4.pl|Alt text for banner 4|0|468|60"
);
$banner $banners[mt_rand(0,sizeof($banners) - 1)];
list(
$imgsrc,$myurl,$alttext,$border,$width,$height) = explode ('|',$banner);
echo(
"<A HREF=\"http://www.yourdomain.com/cgi-bin/$myurl\" TARGET = \"_blank\"><IMG src=\"http://www.yourdomain.com/adverts/banners/$imgsrc?" mt_rand(1,999) . "\" border=\"$border\" width=\"$width\" height = \"$height\" alt=\"$alttext\"></A>");
?>
Notes:
  1. banner1.gif to banner4.gif are the names of the banner files
  2. the banner files exist in the /adverts/banners/ folder on your website (change this to whatever you want)
  3. link1.pl to link4.pl are simple perl scripts which open up the target websites (see below)
  4. the perl scripts are in your cgi-bin folder
  5. the 0|468|60 are the border width (0=no border), banner width and banner height for each banner. Mine are all the same - no border and 468x60.
  6. using _blank for the target makes the new websites open in a new window. Remove the TARGET = \"_blank\" bit if you want it to open in the same window

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/";
Oh and adding
PHP Code:
mt_rand(1,999
on to the end of the name of the image helps ensure that people's cache doesn't open up old versions of banners.
--------------------------------------------------------------------------------------------------
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
Reply With Quote
  #3  
Old 08-03-2004, 10:20 AM
jluerken's Avatar
jluerken jluerken is offline
 
Join Date: Aug 2003
Location: Germany
Posts: 1,016
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #4  
Old 08-03-2004, 10:49 AM
Spinball's Avatar
Spinball Spinball is offline
 
Join Date: Feb 2002
Location: Telford, England
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Yes it will.
Instructions added into the text file August 7 2004.
Reply With Quote
  #5  
Old 08-05-2004, 09:16 PM
msu's Avatar
msu msu is offline
 
Join Date: Feb 2002
Location: Asia
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thanx for this cool hack , and it will be great if you make it for vbulletin 2.x.x people

Reply With Quote
  #6  
Old 08-07-2004, 08:38 PM
Spinball's Avatar
Spinball Spinball is offline
 
Join Date: Feb 2002
Location: Telford, England
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by msu
thanx for this cool hack , and it will be great if you make it for vbulletin 2.x.x people

This will work with vB2, you'll just need to find the right places to put the php code and which template to edit and where within that template.
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.
Reply With Quote
  #7  
Old 08-07-2004, 09:07 PM
msu's Avatar
msu msu is offline
 
Join Date: Feb 2002
Location: Asia
Posts: 46
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

thank you again
Reply With Quote
  #8  
Old 08-08-2004, 02:38 PM
hukgwai's Avatar
hukgwai hukgwai is offline
 
Join Date: Oct 2001
Location: NYC
Posts: 14
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #9  
Old 08-08-2004, 03:05 PM
Spinball's Avatar
Spinball Spinball is offline
 
Join Date: Feb 2002
Location: Telford, England
Posts: 705
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by hukgwai

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?
Yeah - you're right - I've updated it, thanks.
Is this the source of your error?
If not what is the line at 372 in your file?
Reply With Quote
  #10  
Old 08-13-2004, 02:35 PM
xxxGiJoe xxxGiJoe is offline
 
Join Date: Jul 2004
Posts: 4
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Works GREAT!!!

http://wolfgaming.net/wgn/vB/forumdisplay.php?f=161
Reply With Quote
Reply

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

Forum Jump


All times are GMT. The time now is 11:55 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.04534 seconds
  • Memory Usage 2,308KB
  • Queries Executed 23 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)bbcode_html
  • (2)bbcode_php
  • (2)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (10)post_thanks_box
  • (10)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (10)post_thanks_postbit_info
  • (9)postbit
  • (10)postbit_onlinestatus
  • (10)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete