vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   Grab Template? (https://vborg.vbsupport.ru/showthread.php?t=3321)

09-19-2000 12:59 PM

Can someone give me the command to grab a template onto my own PHP page? IE: not a vb Page...it's for a hack I'm working on...

09-19-2000 01:31 PM

This is untested, and possibly not 100% correct, but the theory is there :).

You'll need to do something like this:

Code:

<?php
require("forums/global.php");

$DB_site->query("SELECT all, of, the, things, you, want, FROM table WHERE yadda, yadda");

eval("echo(\"".gettemplate("template_name")."\");");

?>

The theory is that you'd include global.php, connect to the database, and call the template you want.

That's the best I can do off the top of my head. The code depends on what is it you want to do more than anything else.

-jim

09-19-2000 01:39 PM

I used this:

require("global.php");

$DB_site->query("SELECT * FROM template");

eval("echo(\"".gettemplate("savethread")."\");");

And got this:

Fatal error: Cannot redeclare class db_sql_vb in admin/db_mysql.php on line 6

Any idea whats wrong? I created a "savethread" template and as it turns out the global.php file is in the same directory as my file.

09-19-2000 04:48 PM

Okay, I think I know what's wrong.

In global.php up towards the top you'll see a whole bunch of function definitions. Add this somewhere in there (I added mine below "Start dovars" and above "start standarderror":
Code:

// ####### Start Save Thread Hack #####

function savethread($title="") {

// This is where you put all the variables that you use in your template

  global $header,$footer,$cssinclude,$fivelinks,$forumjump,$timezone,$bbtitle,$hometitle,
$bburl,$homeurl,$copyrighttext,$privacyurl,$contactuslink,$titleimage,$replyimage,$newthreadimage,
$closedthreadimage,$lastvisitdate,$timenow;

  makeforumjump();

  eval("\$returnval = dovars(\"".gettemplate("savethread")."\");");

  return $returnval;
}

And then in your page, you would put this:
Code:

require("global.php");

  eval("echo savethread(\"".gettemplate("savethread")."\");");

As I was typing this, I decided to try it out on my test board.

What I did was put the second code snippet into a file called savethread.php, and put it in my /forums/ directory. Then I created a simple template called "savethread", and used some of the standard variables. You can see an example here:
http://www.bronx-bombers.com/testforum/savethread.php

I think that was what you were trying to do, so I hope that helps :)

-jim

[Edited by JimF on 09-19-2000 at 01:50 PM]

09-20-2000 04:03 PM

TWTCommish - Did this work?

09-27-2000 12:24 AM

I'm sorry Jim! I never got around to it - til now.

Works great! Thanks a lot! Hopefully I'll be able to finish my pathetic exscuse for a hack now. :)

09-27-2000 12:26 AM

One quick problem: how do I integrate the two together? IE: I have some SQL queries to make here, but I can't just stick em in the template, can I? I don't think the rest of vB is like that...

The problem is whatever I have printed out shows up at the bottom, below the template...


All times are GMT. The time now is 04:50 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.03986 seconds
  • Memory Usage 1,730KB
  • 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_code_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (7)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