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 |
#32
|
||||
|
||||
Sorry but is this relevant to the hack?
|
#33
|
|||
|
|||
Also, where do I input the code to center the banners on the forum home page? Do I just use this code: <div style="text-align:center;">
<a href......>banner</a> </div> ??? PLEASE let me know as well! |
#34
|
||||
|
||||
Well I use the phpinclude_start template:
Code:
ob_start(); require("/home/sites/avforums/public_html/page_top.php"); $forum_heading = ob_get_contents(); ob_end_clean(); Code:
$forum_heading |
#35
|
|||
|
|||
After a couple of weeks of using this mod, and everything working OK, Today I logged to my forums, and I am getting the following error message at the top of FORUMHOME.
Warning: file_get_contents(): URL file-access is disabled in the server configuration in /index.php on line 59 Warning: file_get_contents(http://www.mydomain.com/forums/banners.php): failed to open stream: no suitable wrapper could be found in /index.php on line 59 |
#36
|
||||
|
||||
Sounds like there has been some kind of configuration change.
If you access the URL in your browser rather than in the file_get_contents, does it work? |
#37
|
|||
|
|||
Yes, it works.
|
#38
|
||||
|
||||
The message
Quote:
If it worked previously, check (with your hosts) whether the configuration of the server has changed in some way. |
#39
|
||||
|
||||
Quote:
PHP Code:
|
#40
|
||||
|
||||
Adding to my post, above, re URL file-access is disabled in the server configuration:
I found this is because my server has the PHP option allow_url_fopen disabled, thus preventing accessing the file via http. For importing static html, the solution in the above post was fine. But one of my import files was a php file that generated some variable text depending on the date. When accessing this directly instead of as an http import, all I got was the static php code, not the RESULT of running the php code. The support folks at the server suggested using their installed cURL library in place of get_file_contents(). The following modification to this hack in forumdisplay.php is now working for me: PHP Code:
|
#41
|
|||
|
|||
Quote:
It seams, this is not the case for my server. I see the text of the .php file, not the results of execution. What I should ask my host to change? |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|