The Arcive of vBulletin Modifications Site. |
|
Details »»
|
|||||||||||||||||||||||||
How do you do this?
I want a PHP file that will go directly to a template And the template will use stuff from the database like amount of posts and newest member, sessionhash-ed links etc. The file would do nothing apart from display the thing in the template! What the PHP code? I tried one, and it went to the template, but did not display any variable stuff, eg - it said "Registered Members: threads in total | posts in total You last visited: 03-25-2001 02:22 PM. The time now is 02:22 PM. . Welcome to our newest member, ." That was just using this code: Code:
<?
$templatesused = "newtemplate";
require("./global.php");
eval("dooutput(\"".gettemplate("newtemplate")."\");");
?>
How do I do it??? Thanx in advance Show Your Support
|
|||||||||||||||||||||||||
| Comments |
|
#2
|
|||
|
|||
|
when you're included php file generates some variables like
$newestmember etc.. Then you can reference to them in the template So if you have: <? $templatesused = "newtemplate"; require("./global.php"); $bla = "123"; eval("dooutput(\"".gettemplate("newtemplate")."\") ;"); ?> Then you can reference to $bla in your template....Or if you have a separate php file which contains $bla and you include this file before evaluating the template you can do exact the same thing... Evaluate does just evaluating the content of a template as if it was php code...so every $variable in the template is parsed with their corresponding variable... |
|
#3
|
|||
|
|||
|
Thanx for ya help
What I now need to know is how to enter variable details like amount of members and connecting to the database.... |
|
#4
|
|||
|
|||
|
if you include global.php you don't need to connect to the database....
use a code like this: $query = "SELECT <fields> FROM <tables>"; $result = $DB_site->query($query); while($row = $DB_site->fetch_array($result)) { doSomeStuff(); } |
![]() |
|
|