vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   Loop through text files. (https://vborg.vbsupport.ru/showthread.php?t=53077)

Davey 05-18-2003 10:55 AM

Loop through text files.
 
I want to make a "template" set (outside of vB), where the HTML is stored in text files and evaluated thereafter.
However, I have no idea how to go about looping through the text file.
Can anyone suggest any ideas?
Possibly Xenon since you're the only PHP expert online? :p

Dave.

Gary King 05-19-2003 01:30 AM

Err no, xenon isn't the only PHP expert around here: just check out all the hack makers, and you'll get a rough idea of who the "PHP experts" really are ;)

Some quick instructions on how to go about doing this:

Place your text files in a database (you can use phpMyAdmin to insert the text files, just take a look at how vBulletin templates are).

Take a look at how the function gettemplate is. (/forum/admin/functions.php) That's what vB uses to get the templates from the database. You can copy and paste from
PHP Code:

// ###################### Start gettemplate ####################### 

until the next comment line (has several #s)
if you want, and see how that works out (be sure to change the table/column names to wherever your templates are stored.)

Then, find in functions.php
PHP Code:

// ###################### Start dooutput ####################### 

and copy and paste from there until the next comment line (it has several #s)

Then, in the actual PHP page where you want to echo the text files, type something like:

PHP Code:

<?php

eval("dooutput(\"".gettemplate('templatename')."\");");

?>

That's all there is to it!

Davey 05-19-2003 05:00 PM

I have only one word to say.
Quote:

?
Dave.

Gary King 05-19-2003 06:02 PM

If you don't understand it, then I suggest you start with something a little more simpler first ;)

Davey 05-19-2003 08:15 PM

Dude in the dooutput function it seems to show another function called dovars, which completely looses me.
Besides.
At what part of dooutput does it loop through the text file to get the lines of HTML needed to insert into the DB, which as the function gettemplate shows, it selects the template from the DB.
Where's the "inserting it into the DB"?

Dave.

Gary King 05-19-2003 08:21 PM

Quote:

Place your text files in a database (you can use phpMyAdmin to insert the text files, just take a look at how vBulletin templates are).
Make a table named template, with at least these two columns:
  • title
  • template

Insert template title name in title, and the actual template in template.


All times are GMT. The time now is 08:17 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.01079 seconds
  • Memory Usage 1,724KB
  • 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
  • (3)bbcode_php_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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