The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
How to add php code into vb4 template?
How to add php code into vbulletin 4 template?
i want it only on the index page (forums listing) the php code to add: Code:
<?php // THE FOLLOWING BLOCK IS USED TO RETRIEVE AND DISPLAY LINK INFORMATION. // PLACE THIS ENTIRE BLOCK IN THE AREA YOU WANT THE DATA TO BE DISPLAYED. // MODIFY THE VARIABLES BELOW: // The following variable defines whether links are opened in a new window // (1 = Yes, 0 = No) $OpenInNewWindow = "1"; // # DO NOT MODIFY ANYTHING ELSE BELOW THIS LINE! // ---------------------------------------------- $BLKey = "***"; if(isset($_SERVER['SCRIPT_URI']) && strlen($_SERVER['SCRIPT_URI'])){ $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_URI'].((strlen($_SERVER['QUERY_STRING']))?'?'.$_SERVER['QUERY_STRING']:''); } if(!isset($_SERVER['REQUEST_URI']) || !strlen($_SERVER['REQUEST_URI'])){ $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'].((isset($_SERVER['QUERY_STRING']) && strlen($_SERVER['QUERY_STRING']))?'?'.$_SERVER['QUERY_STRING']:''); } $QueryString = "LinkUrl=".urlencode(((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=='on')?'https://':'http://').$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']); $QueryString .= "&Key=" .urlencode($BLKey); $QueryString .= "&OpenInNewWindow=" .urlencode($OpenInNewWindow); if(intval(get_cfg_var('allow_url_fopen')) && function_exists('readfile')) { @readfile("http://www.backlinks.com/engine.php?".$QueryString); } elseif(intval(get_cfg_var('allow_url_fopen')) && function_exists('file')) { if($content = @file("http://www.backlinks.com/engine.php?".$QueryString)) print @join('', $content); } elseif(function_exists('curl_init')) { $ch = curl_init ("http://www.backlinks.com/engine.php?".$QueryString); curl_setopt ($ch, CURLOPT_HEADER, 0); curl_exec ($ch); if(curl_error($ch)) print "Error processing request"; curl_close ($ch); } else { print "It appears that your web host has disabled all functions for handling remote pages and as a result the BackLinks software will not function on your web page. Please contact your web host for more information."; } ?> vBulletin Admin area / Plugins & Products / Add New Plugin As a Hook location you can use navbits_complete and it should load the php code on all pages of the forum including index. To show it only on thread pages, use "fetch_foruminfo" Plugin is Active = yes As a PHP code, do NOT enter <?php ?>, you should add code right away |
#2
|
||||
|
||||
You can't use PHP in templates, you need to output the contents of the PHP to the templates via variables and such.
|
#3
|
||||
|
||||
I would also suggest asking for support from the backlinks site, as this is their code, they can tell you what to do.
|
#4
|
|||
|
|||
The easiest way is to make a plugin for this. Add the code to the plugin, bind it to the right hook location, assign it to a template variable and display it where needed.
|
#5
|
|||
|
|||
im really noob and not programmer to do it "plugin way", there would have to be some step by step tutorial to follow, and i dont want to waste whole afternoon doing it. Can i include some .php file into template?
|
#6
|
||||
|
||||
No.
|
#7
|
|||
|
|||
Quote:
There is no method to include a PHP file directly into a template. One of the niceties of the vBulletin template system is it just might save you from yourself. Like including PHP in a way that you you shouldn't and allowing your board to be exploitable or compromised. |
#8
|
|||
|
|||
i mentioned my code already before.
So what is the step by step easiest process to add it to the index.php page (forum.php) as i already mentioned |
#9
|
|||
|
|||
I really need to get my eyes fixed. Sorry bud, somehow I missed the code being posted. I didn't realize that you posted the very well known "backlinks" code.
|
#10
|
|||
|
|||
So i know i cant add php code into template.
How can i let some php code be shown or executed on vbulletin forum, example index, header of footer? even dirty way? thanks |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|