![]() |
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 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 |
You can't use PHP in templates, you need to output the contents of the PHP to the templates via variables and such.
|
I would also suggest asking for support from the backlinks site, as this is their code, they can tell you what to do.
|
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.
|
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?
|
No.
|
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. :) |
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 |
Quote:
|
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 |
Best thing to do is to study a mod from here that does something similar.
|
Try this: create a plugin using hook location forumhome_start and code like this:
Code:
ob_start(); Next, edit the FORUMHOME template and insert {vb:raw backlinks} where you want it to appear. Edit: if you want step by step instructions for creating a plugin, see the vbulletin manual here: http://www.vbulletin.com/en/manual/ . First select your vb version from the dropdown menu, then search for "plugin" and select "Adding or Editing a Plugin" from the results. It's pretty easy, you just have to paste the code I posted, then paste yours in at the comment and remove the <?php and ?>, then fill in the other form fields as needed (see the manual page for that). If you don't know what to put for something, you can probably leave the default. |
Quote:
|
Yeah, sorry, it's just that the manual pages show in a frame so the browser url just goes to the manual home page. But I think this will work: http://www.vbulletin.com/docs/html/main/add_plugin
|
As most of other users said, you can't add PHP code to the template. But you can easily add templates in a PHP file. The results will be exactly what you want.
1.- Create 2 templates. One for header and one for footer: a] For Header (is just as example): HTML Code:
<template name="php_header" templatetype="template" date="" username="" version=""> HTML Code:
<template name="php_footer" templatetype="template" date="" username="" version=""> Code:
// Header Block Code:
// Footer Block Nick |
All times are GMT. The time now is 05:53 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 | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|