vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Creating PHP files that go directly to templates (https://vborg.vbsupport.ru/showthread.php?t=12292)

TAW 03-25-2001 05:22 PM

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

03-25-2001 05:47 PM

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...

03-25-2001 05:53 PM

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....

03-25-2001 05:55 PM

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();
}


All times are GMT. The time now is 12:51 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.01048 seconds
  • Memory Usage 1,714KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete