PDA

View Full Version : Some basics of vB3(mini howto)


Zachery
09 Jan 2004, 04:16
Some basics of vB3(mini howto)
also some basic php junk
the most important thing if you want to make pages based on templates or anything of the such would be to first know how to "

connect" to vbulletin, and then learn how to call and eval templates. so lets take a look at the most BASIC page we can do

<?php
// ## Changes Directory so it can accesss vBulletin IF we are outside the forums folder, if not this is not nessary ##
chdir("./forums");

// ## Error Reporting ( we use error reporting in php so we can control the display of error messages
// ## we will use this because all vBulletin files follow the same error reporting rules) ##
error_reporting(E_ALL & ~E_NOTICE);

// ## this action here cache's the templates so that everytime their needed a querry wont be needed to run
// ## the names in there are just the template names :), there must be a comma after everyone but the last ##
$globaltemplates = array(
'main'
);

// ## Grabs global.php this grabs vbulletins global.php so we can use the most basic of vBulletins functions ##
require_once("./global.php");

// ## this calls to print out one main template ##
eval('print_output("' . fetch_template('main') . '");');
?>


So theres a basic file, if your going to make one, that would i think be the mininum needed. now if you are going to be making

somthing abit more advanced. suchas calling more than one template, or doing an action it becomes abit more complicated



<?php
// ## Changes Directory so it can accesss vBulletin IF we are outside the forums folder, if not this is not nessary ##
chdir("./forums");

// ## Error Reporting ( we use error reporting in php so we can control the display of error messages
// ## we will use this because all vBulletin files follow the same error reporting rules) ##
error_reporting(E_ALL & ~E_NOTICE);

// ## this here defines the "this_script" function, which if you use template conditionals, it will come in handy :) ##
define('THIS_SCRIPT', 'page');

// ## this action here cache's the templates so that everytime their needed a querry wont be needed to run
// ## the names in there are just the template names :), there must be a comma after everyone but the last ##
$globaltemplates = array(
'main',
'big',
'small'
);

// ## Grabs global.php this grabs vbulletins global.php so we can use the most basic of vBulletins functions ##
require_once("./global.php");

// ## ok this next set of lines "eval"'s our templates so they can be called inside the template we will print out ##
eval('$big = "' . fetch_template('big') . '";');
eval('$small = "' . fetch_template('small') . '";');

// ## this calls to print out one main template ##
eval('print_output("' . fetch_template('main') . '");');
?>




// ## if were going to use actions and their templates
// ## arnt used anywhere else in the file but the actions we add this
// ## under $globaltemplates = array();
// ## where small is would be the action name
// ## and other is the template used ##
$actiontemplates = array(
'small' => array(
'other'
)
);
// ## this is a action, and it can be added before the final
// ## eval('print_output("' . fetch_template('main') . '");');
// ## anything done before this request can be called inside the template
// ## so lets say if you evalled the template big, as $bit, it can be called
// ## here with other. ##
if ($_REQUEST['do'] == 'small')
{
eval('print_output("' . fetch_template('other') . '");');
}


one more note

if your going to write a script that is ALL actions you should add somthing like this right after the call to gobal.php

if (empty($_REQUEST['do']))
{
$_REQUEST['do'] == 'small';
}


this will ensure that if the usergoes to foo.php instead of foo.php?do=small they will still see the correct page :)

Mini Tut by Faranth
(with some help from Brad.loo fixing my silly newbie mistakes :) )

Hobbes
09 Jan 2004, 04:24
...Nice....good for n00bs like me :)

paddysplace
09 Jan 2004, 04:36
Quality work there Faranth. DEFINITELY a good resource for those wanting to make a custom page but don't know where to start! This might inspire me to chime in myself and write up a few mini tutorials. Keep up the good work bro! Cheers!

Regards,
Patrick

Apoco
09 Jan 2004, 04:40
...Nice....good for n00bs like me :)I agree you really need it hobbierz :-p, rofl, jk GreatJob Faranthierz!!

Link14716
09 Jan 2004, 05:01
Yeah, nice job. ^^ :)

Brad
09 Jan 2004, 05:33
Just a little note, if you are going to be writing scripts that are a bit more advanced. Sometimes you will need to retrive information from vBulletin datastore templates, to do so add this above the call to global.php

// get special data templates from the datastore
$specialtemplates = array(
'smiliecache',
'bbcodecache'
);

That will pull the smilie and bbcodecache which would be needed if you where say, pulling post information from the database (think news scripts). If you need to pull something from the datastore look in the vBulletin file that emulates what you would like to do and find out what it is pulling from the datastore.

Zachery
09 Jan 2004, 06:24
Just a little note, if you are going to be writing scripts that are a bit more advanced. Sometimes you will need to retrive information from vBulletin datastore templates, to do so add this above the call to global.php

// get special data templates from the datastore
$specialtemplates = array(
'smiliecache',
'bbcodecache'
);

That will pull the smilie and bbcodecache which would be needed if you where say, pulling post information from the database (think news scripts). If you need to pull something from the datastore look in the vBulletin file that emulates what you would like to do and find out what it is pulling from the datastore.
thanks brad :)

MindTrix
09 Jan 2004, 16:12
Handy // Confusing tips there :) Thanks

Zachery
09 Jan 2004, 16:16
confusing?

MindTrix
09 Jan 2004, 16:34
If you want too be ;)

Zachery
09 Jan 2004, 16:49
/me is now confused :(

MindTrix
09 Jan 2004, 17:18
Yup that was my main aim :) Lol, nah i meant at first that it was confusing because i was reading too fast, and still scratching up on the ol' PHP

Zachery
09 Jan 2004, 17:19
Yup that was my main aim :) Lol, nah i meant at first that it was confusing because i was reading too fast, and still scratching up on the ol' PHP
you worried me for a moment :P

:) hope it helped

Floris
09 Jan 2004, 17:50
you worried me for a moment :P

:) hope it helped
Good job faranth, looks complete and hopefully helps some noobs :)

Zachery
10 Jan 2004, 03:28
Nice jobs, could you make a mini guide for making templates?
whatcha mean? templates are simple to make, its just html >.<

Brad
10 Jan 2004, 06:22
Hi, I notcied one error with the action templates call. It should be:

$actiontemplates = array(
'small' => array(
'other'
)
);

:)

Zachery
10 Jan 2004, 06:23
whatchu talkin about foo :P

Mr. HillBilly
10 Jan 2004, 07:32
Thanks much for the guide!

I made a page, first time I've ever done it.

http://ph33rnet.com/uc.php

rrottman
11 Jan 2004, 20:49
Faranth, any hint:
I copied the first code block (the very easy one :-) ) and tried it: Nothing gets displayed. Any hint?

rrottman
11 Jan 2004, 20:52
I created a new, empty file. This is all and exactly what's in there:


<?php
chdir("./forum");
error_reporting(E_ALL & ~E_NOTICE);
$globaltemplates = array('main');
require_once("./global.php");
eval('print_output("' . fetch_template('main') . '");');
?>


It's saved as index.php in the website root, while vB sits in /forum.
If I open http://www.mydomain.com in a browser, this is what I receive:


<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1"></HEAD>
<BODY></BODY></HTML>


Any idea?
For troubleshooting I replaced the print_output with:

echo fetch_template('main');

and received an empty string, too.

Please help.

rrottman
11 Jan 2004, 21:00
@Faranth:
Additionally, you say that

$globaltemplates = array('main');

is for caching templates? How does this work? To me it appears as if you just declare a local array? The fetch_template function in functions.php does not reference any var named $globaltemplates. Could you possibly explain why you init this array in the page?

And I'm still not getting the template :-(

THANKS FOR BEING PATIENT WITH ME! :-)

rrottman
11 Jan 2004, 21:03
Some more troubleshooting steps it now appears as if the fetch_template does not return any content. It's empty... hmm... HELP!

Zachery
11 Jan 2004, 21:14
Some more troubleshooting steps it now appears as if the fetch_template does not return any content. It's empty... hmm... HELP!
sorry ive been working on stuff, you can wait more than 3 min for a nother post too ;D

yes $globaltemplates cach's the template

do you HAVE a template called main in the database?

rrottman
11 Jan 2004, 21:22
Faranth, my capitalized "help" was in no way ment to offend you in any way. It's just I was in such a despair...

Do I have a template called "main"... honestly, I don't know. Maybe. Is there any standard template, comming with the clean default vB3 RC2 install I could test instead?

And: I understood that you were saying that the $globaltemplates array is done to cache templates but I don't know how it does so. Is there a GLOBAL variable named $globaltemplates in the vB system? I mean, if I put this statement at the top of my script, all it does is create an array with a single string value but how does this "instruct" vb to cache a template?

Zachery
11 Jan 2004, 21:25
lol thats most lily your problem you dont have another tempalte atm lol ^^


make a new template called main and add anything you like to it :)

rrottman
11 Jan 2004, 21:29
And one more question, Faranth (sorry, knowing that you're online is just too attractive.. :-) ):

Why do I have to use eval(...). Couldn't I just do a

$output = fetch_template(...);
echo $output;

?

Zachery
11 Jan 2004, 21:31
why two lines?

eval('print_output("' . fetch_template('main') . '");');

one simple line, plus this is how its done for all files in vb

rrottman
11 Jan 2004, 21:34
Hmm. I see. I might not have asked my question the right way. (I'm not a native English speaker. Sorry again.)

I was wondering why to use the eval() at all?
Why not:

echo fetch_template("FORUMHOME");

but instead:

eval('echo "'.fetch_template(...).'");');

So my main question was: Why do we use eval here? Is it, because templates might contain php code, too? or vars?

(Btw.: You were right with the "main" template. If I replace it with e.g. FORUMHOME, it works great.)

I still do not understand how the declaration of the local variable $globaltemplates helps caching...

Zachery
11 Jan 2004, 21:35
ah yes, actually , if conditions are inlaid php :) all of the tempaltes are stored in php format to boot

VodkaFish
12 Jan 2004, 21:35
If I slap your (longer) example into a blank .php page and use the shell_blank as my template (unchanged); I get an "object expected" error when the page tries to run this script:<script type="text/javascript">
<!--
// Main vBulletin Javascript Initialization
vBulletin_init();
//-->
</script>

* The page I wrote was in a different directory, so I used this:
chdir("../forums");

Zachery
12 Jan 2004, 21:37
If I slap your (longer) example into a blank .php page and use the shell_blank as my template (unchanged); I get an "object expected" error when the page tries to run this script:<script type="text/javascript">
<!--
// Main vBulletin Javascript Initialization
vBulletin_init();
//-->
</script>

* The page I wrote was in a different directory, so I used this:
chdir("../forums");
you know i also ran into that problem(with other things) i think its somthing with the header include but im not sure >.<

VodkaFish
13 Jan 2004, 16:56
<script type="text/javascript">
<!--
var SESSIONURL = "";
var IMGDIR_MISC = "images/misc";
// -->
</script>

<script type="text/javascript" src="clientscript/vbulletin_global.js"></script>
<script type="text/javascript" src="clientscript/vbulletin_menu.js"></script>
Well, this was in my header, and why the errors are probably showing. Seems the script locations aren't automatically changed. Probably just a header edit needed.

I put this in my forums directory and it was error-free.

However - despite the nav (with the user cp/register, faqs, etc.) being included in the shell, I still don't see that. Am I missing some other include?

NTLDR
13 Jan 2004, 17:06
If your not using Gamma you should prefix all the JS includes with $vboptions[bburl]/ to make sure they get included properly if you have pages outside of the forums directory.

Zachery
13 Jan 2004, 17:08
doh! i knew i forgot about sumthing, thanks NTLDR :)

VodkaFish
13 Jan 2004, 19:07
Surely, easy fix... but how do I get that main/top nav into my page?

Zachery
13 Jan 2004, 19:52
Surely, easy fix... but how do I get that main/top nav into my page?
try

eval('$front_header = "' . fetch_template('header') . '";');

VodkaFish
13 Jan 2004, 23:25
Isn't that already called by shell_blank though?


$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$pagetitle</title>
$headinclude
</head>
<body>
$header
$navbar

$html

$footer
</body>
</html>

VodkaFish
16 Jan 2004, 05:39
To follow up my own question, I needed this within my code:
eval('$navbar = "' . fetch_template('navbar') . '";');
I find that weird, since I didn't need the header or footer, etc. but I needed to call the navbar.

However - links, etc. were all wrong since the navbar template isn't pathed correctly (would need to add $vboptions[bburl]/ in many places I'm assuming).

Just thought I'd update.

Zachery
16 Jan 2004, 05:40
yeap you would

Ryan Ashbrook
16 Jan 2004, 16:24
Is it hard to set permissions for a page, if not, how would I do that?

I want to restrict usergroups to this page.

NTLDR
16 Jan 2004, 16:28
The following will show the no permission message to users who arn't in group 1, 2 or 3 (remove the ! to make it show if they are in 1, 2 or 3). Just replace 1, 2, 3 will a comma sperated list of usergroups to match your needs.

if (!in_array($bbuserinfo['usergroupid'], array(1, 2, 3))) {
print_no_permission();
}

Ryan Ashbrook
16 Jan 2004, 16:38
Thanks, it works perfectly. :)

VodkaFish
18 Jan 2004, 23:07
The following will show the no permission message to users who arn't in group 1, 2 or 3 (remove the ! to make it show if they are in 1, 2 or 3). Just replace 1, 2, 3 will a comma sperated list of usergroups to match your needs.

if (!in_array($bbuserinfo['usergroupid'], array(1, 2, 3))) {
print_no_permission();
}

That works for me. However - the login displayed does not (pathing issues). I looked around, found the print_no_permission() function and followed it to these templates:
username_loggedin
username_loggedout

So I fixed the pathing on each of them - yet I still can't get it to go correctly.

I know I'm missing it somewhere else - does anyone know where?

NTLDR
18 Jan 2004, 23:18
The STANDARD_ERROR template contains the majority of the HTML for the no permission screen that you'll need to edit :)

VodkaFish
18 Jan 2004, 23:19
Oh, one other thing - I pathed the navbar correctly (made it a separate template actually, just in case I f'd something up, but it appears right.

The only thing throwing me off is the logout javascript:

<script type="text/javascript">
<!--
function log_out()
{
ht = document.getElementsByTagName("html");
ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
if (confirm('$vbphrase[sure_you_want_to_log_out]'))
{
return true;
}
else
{
ht[0].style.filter = "";
return false;
}
}
//-->
</script>


It will not fade color in IE anymore.

Obviously a very minor issue.

Another minor issue I am having is that my tables within my template go too wide (don't have this problem on my forums within the forum directory). I was able to tweak percentages to pixels for a temporary fix, but if anyone knows what this vague problem may be, thought I'd mention it as well; my post above is my big concern right now though :ermm:

VodkaFish
18 Jan 2004, 23:22
The STANDARD_ERROR template contains the majority of the HTML for the no permission screen that you'll need to edit :)
Awesome, that was it. Please give yourself a secondary title of booty-kicker. Thank you :)

Mijae
31 Jan 2004, 17:49
Awesome, that was it. Please give yourself a secondary title of booty-kicker. Thank you :)
I've been trying to get my gallery to work all day long...if I put the template calling at the end of the file, it will load the images ABOVE the header...if I add the template calling before the images, nothing will load after the header...

Its driving me mad...here is my thread (http://www.vbulletin.org/forum/showthread.php?t=60991)

I also tried editing another gallery script, but I ended up with the same problems, images would only load above header, but nothing would load under it.

Zachery
31 Jan 2004, 21:43
it looks like your hard coding the file, this howto deals more with using the template system directly

Mijae
01 Feb 2004, 18:01
it looks like your hard coding the file, this howto deals more with using the template system directly
Seems so, so there is no way to add footer/header templates to hard coded page then?

Zachery
01 Feb 2004, 20:52
Im sure there is, but i dont know how to do it really

gmarik
03 Feb 2004, 06:18
Cool, waiting for further instructions.

mossyuk
04 Feb 2004, 12:58
im confused - how do i make the navbar i have included in my page change to show your status as logged in?

Gio Takahashi
11 Feb 2004, 02:35
im confused - how do i make the navbar i have included in my page change to show your status as logged in?
This is nice stuff here Faranth, very useful.

I do have a question, how do I have "Who is online" show the location.

IE:

Gio "Unknown"
main.php

To

Gio Test Page
test.php

Zachery
11 Feb 2004, 02:48
I THINK i know how to do that, but i need to double check somthing ^_^

Dark_Wizard
11 Feb 2004, 11:46
This is nice stuff here Faranth, very useful.

I do have a question, how do I have "Who is online" show the location.

IE:

Gio "Unknown"
main.php

To

Gio Test Page
test.php

This would all be done in the ./includes/functions_online.php file. I'll let Faranth finish this up as it is his "HowTo" thread. ;)

AndrewD
11 Feb 2004, 16:39
What is the recommended way to install/upgrade the series of templates used with a hack? (I know htl deals with this but...) Installing the templates manually is a pain and error prone, as is asking the user to go to the admin cp and upload the xml file.

How does one create a new template group?

I imagine one has to install/overwrite the templates in the base style(s). As a hack is being developed (and templates changed), one also has to be sure that any modified templates in the main and other styles are flagged.

I'm sure that tips on these points would be most welcome.

Sent1nel
11 Feb 2004, 17:55
Edit: Sorry I got told off for posting in the wrong forum.

I fixed the problem and to simply make a new page which utilises existing stylesheets and headers, technically all you need to do is:

1. Create Custom Template with everything you Require - Ensure you include your header, footer etc references, shown below.

{htmldoctype}
<html>
<head>
<title> Blah </title>
$headinclude
</head>
<body>
$header

BLAHBLAHBLAHBALH

$footer

</body>
</html>

2. In your new page - use the below code to invoke your template. (My Custom template was called "blah").

<?php
$templatesused = "blah";
include("./global.php");
eval("dooutput(\"".gettemplate("blah")."\");");
?>

Tony.

Zachery
12 Feb 2004, 02:23
Edit: Sorry I got told off for posting in the wrong forum.

I fixed the problem and to simply make a new page which utilises existing stylesheets and headers, technically all you need to do is:

1. Create Custom Template with everything you Require - Ensure you include your header, footer etc references, shown below.

{htmldoctype}
<html>
<head>
<title> Blah </title>
$headinclude
</head>
<body>
$header

BLAHBLAHBLAHBALH

$footer

</body>
</html>

2. In your new page - use the below code to invoke your template. (My Custom template was called "blah").

<?php
$templatesused = "blah";
include("./global.php");
eval("dooutput(\"".gettemplate("blah")."\");");
?>

Tony.
Your methdo should only work for vB2 $templateused is no longer a valid varible in vB3

tehste
17 Feb 2004, 22:24
Hi, I am making a mod and im new to VB but Im a fast learner.

I want to load a template called (test) inside test i want to put rows from a db table (test) with value1|value2|value3 i want to print the 3values for each row in the table and display them in the html defined in the (test2) template... and then load the rest of the (test) template. Is this possible?

Another question is: Would cases be suitable rather than all the ifs? or are ifs better?
thanks for help.

kontrabass
16 Mar 2004, 15:43
Sorry for the stupid question -

How does one pass a variable from a php script TO the template?

I've got a file, page.php, that includes the basic instructions in the first post in this thread, ending with (eval('print_output("' . fetch_template('my_template') . '");');

It works great - 'my_template' contains $header, some html, $footer, and it renders the page as expected.

However, in page.php I also define a variable $output = "some output"; I put $output in 'my_template' but it does not print out "some output" as expected.

Again sorry I'm probalby out of my legue here but if there's an easy way to do this please let me know!

TIA!

AN-net
19 Mar 2004, 11:22
question on action templates, can u define wut u mean by actions more precisely im a lil confused.

Zachery
19 Mar 2004, 11:23
like.

search.php?do=getnew

is a vB3 action, and it does a specific / more refined / predetermined function

AN-net
19 Mar 2004, 12:09
k
so something like
blah.php?do=redirect
is one?

Tradjick
02 Apr 2004, 22:03
Thanks Faranth! I read the whole thread and now I understand a little more how the whole thing is working :)

The "actions", are they all included in one php file? But I guess not, they must be spread evywhere. To list all these actions, is the way to do that to Ctrl-F through all the files and search for "do=" ???

And also, where are all the functions, do we simply need to require global.php for all the functions beeing available?

Noobish cheers :nervous:

:)

JamesFrost
18 May 2004, 08:08
Really useful 'hack' (or guide, whatever). Got my first VB based page up and running in no time at all.

thanks a lot :D.

Randomlove
28 May 2004, 13:31
Hi Zachery,
I tested the first & second examples but I keep getting the following lines in my browser:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=windows-1252"></HEAD>
<BODY></BODY></HTML>

I went and changed couple of things and came up with this version:

<?php
// ## Changes Directory so it can accesss vBulletin IF we are outside the forums folder, if not this is not nessary ##
chdir("./vb3");

// ## Error Reporting ( we use error reporting in php so we can control the display of error messages
// ## we will use this because all vBulletin files follow the same error reporting rules) ##
error_reporting(E_ALL & ~E_NOTICE);

// ## this here defines the "this_script" function, which if you use template conditionals, it will come in handy :) ##
define('THIS_SCRIPT', 'page');

// ## this action here cache's the templates so that everytime their needed a querry wont be needed to run
// ## the names in there are just the template names :), there must be a comma after everyone but the last ##
$globaltemplates = array(
'header',
'navbar',
'footer'
);

// ## Grabs global.php this grabs vbulletins global.php so we can use the most basic of vBulletins functions ##
require_once("./global.php");

// ## ok this next set of lines "eval"'s our templates so they can be called inside the template we will print out ##
eval('$header = "' . fetch_template('header') . '";');
eval('$navbar = "' . fetch_template('navbar') . '";');
eval('$footer = "' . fetch_template('footer') . '";');

?>

Now I get a totally blank page :).

Please help.

R.L. :)

Zachery
28 May 2004, 13:48
You didnt print any templates...

your missing the most important line

eval('print_output("' . fetch_template('TEMPLATE') . '");');

You just made some varibles, you didnt tell the script to display a template i suggest trying generic shell

eval('print_output("' . fetch_template('GENERIC_SHELL') . '");');

Randomlove
28 May 2004, 14:12
Got it! It worked :)

Thanks Zachery.

Casparian
05 Jun 2004, 03:57
Seems so, so there is no way to add footer/header templates to hard coded page then?
Has anyone figured out if it's possible?

I have a lot of content outside of my forums which I'd love to be able to include the header and footer from the template on! This way I could update the style of my whole site, forums and static content, through the admincp.

I've tried almost everything I can think of, if someone has a simple test page they can show me I'd be really, really greatful :)

lichtflits
21 Jun 2004, 17:41
how can a do one code for ?do= and thene whene i make a new template i can do ?do=test and so that i can do it at's mutch as i want. please help my. :d

Dean C
21 Jun 2004, 18:18
You simply put:


if($_REQUEST['do'] == 'test')
{
template call here....
}


:)

lichtflits
21 Jun 2004, 19:36
yea but that is only for one page.

I want samthing that is a code that is so that whene i add a template called test ,game or whatever i can do ?do= whene i made the template.

marcjd
28 Jun 2004, 05:38
I sure would appreciate some help with this question. I apologize if it has been answered in this thread, I just can't figure out how to do the simple little thing I want.

Basically I have a search bar and a google ad, etc. I want these in my headers but from time to time change the html code of them. I would much prefer to have them saved as templates and simply change those couple templates instead of the header in each style. I created a template for the Google Search bar and tried using $GoogleSearch in my header. Of course that didn't work...silly me. :)

I would really appreciate how to simply call custom templates in the header, footer, etc. Thank you very much! :)

Slapyo
28 Jun 2004, 19:29
The only thing throwing me off is the logout javascript:

<script type="text/javascript">
<!--
function log_out()
{
ht = document.getElementsByTagName("html");
ht[0].style.filter = "progid:DXImageTransform.Microsoft.BasicImage(grayscale=1)";
if (confirm('$vbphrase[sure_you_want_to_log_out]'))
{
return true;
}
else
{
ht[0].style.filter = "";
return false;
}
}
//-->
</script>


It will not fade color in IE anymore.

i am having the same problem. the code is exactly the same, copy/pasted, and i put onclick="return log_out()" in my logout link. i get the popup to ask if they want to logout, but i don't get the grayscale page.

it works fine when i am on the message board, but on my index page, there is no fade. anyone know what's goin on, or have this working on a non-vb page?

Slapyo
28 Jun 2004, 19:47
acutally, i just figured it out.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

put that at the top of your page.

lichtflits
23 Jul 2004, 20:59
Duse any one now how to use <?php include("$id.htm" ?> in vb.

Zachery
29 Jul 2004, 10:22
Duse any one now how to use <?php include("$id.htm" ?> in vb.
use the phpinclude template

Blue Moose Aaron
31 Jul 2004, 05:30
Any idea why my code isn't working? I'm sure (as a novice) I have to be doing something wrong. What I'm trying to do is get a page up thats going to display information put into my database. Its an episode guide. It runs fine alone, but I'm in the process of making my entire site template based.

Here is the template$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle] - Donate</title>
$headinclude
</head>
<body>
$header

<table border="0" cellspacing="0"



width="100%" cellpadding="0">
<tr>
<td width="100%">
<table border="0" cellspacing="0"



width="100%"

cellpadding="0">
<tr>

<td width="24" id="top"> <img border="0" src="images/smallville/left_top.jpg" width="24" height="6" /></td>

<td width="100%"

background="images/smallville/top.jpg"> <img border="0" src="images/smallville/top.jpg" width="2" height="6" /></td>

<td width="19" align="right"> <img border="0" src="images/smallville/right_top.jpg" width="19" height="6" /></td>
</tr>
<tr>
<td width="24">
<p align="left"> <img border="0" src="images/smallville/left_corner.jpg" width="24" height="19" /></p></td>
<td width="100%"

background="images/smallville/top_mid.jpg">
<b><font face="Verdana" size="1" color="#CC9966">Smallville
Episode Guide</font></b></td>
<td width="19" align="right">
<p> <img border="0" src="images/smallville/right_corner.jpg" width="19" height="19" /></p></td>
</tr>
<tr>
<td width="24">
<p align="left"> <img border="0" src="images/smallville/left_second.jpg" width="24" height="16" /></p></td>
<td id="top" width="100%"

background="images/smallville/second_mid.jpg">
<p align="left"> <b><font face="Verdana" size="1" color="#CC9966">
$id - $episode_name</font></b></p></td>
<td width="19" align="right">
<p> <img border="0" src="images/smallville/right_second.jpg" width="19" height="16" /></p></td>
</tr>
<tr>
<td width="24" valign="baseline"

background="images/smallville/left_mid.jpg">
<p align="left"> <img border="0" src="images/smallville/left_mid.jpg" width="24" height="5" /></p></td>
<td width="100%" bgcolor="#000000">
<table border="0" cellspacing="0"



width="100%"

cellpadding="4">
<tr>
<td width="100%" valign="top">
<table border="0" cellspacing="0" width="100%" cellpadding="3">
<tr>
<td width="100%">
<p align="left"> <font face="Verdana" size="1" color="#CC9966">
$episode_description
</font></p></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="19" valign="baseline"

background="images/smallville/right_mid.jpg">
<p align="right"> <img border="0" src="images/smallville/right_mid.jpg" width="19" height="5" /></p></td>
</tr>
<tr>

<td width="24" valign="baseline"> <img border="0" src="images/smallville/left_maroon_bottom.jpg" width="24" height="13" /></td>
<td width="100%" id="top"

background="images/smallville/maroon_mid.jpg" valign="bottom">

<p align="center"><font size="1" face="Verdana">&nbsp;</font></p></td>
<td width="19" valign="baseline">
<p align="right"> <img border="0" src="images/smallville/right_maroon_bottom.jpg" width="19" height="13" /></p></td>
</tr>
<tr>
<td width="24">
<p align="left"> <img border="0" src="images/smallville/left_bottom.jpg" width="24" height="18" /></p></td>
<td width="100%"

background="images/smallville/bottom.jpg">
<p align="left"> <img border="0" src="images/smallville/bottom.jpg" width="3" height="18" /></p></td>
<td width="19" align="right">
<p> <img border="0" src="images/smallville/right_bottom.jpg" width="19" height="18" /></p></td>
</tr>
<tr>

<td width="24" id="top"> <img border="0" src="images/smallville/left_top.jpg" width="24" height="6" /></td>

<td width="100%"

background="images/smallville/top.jpg"> <img border="0" src="images/smallville/top.jpg" width="2" height="6" /></td>

<td width="19" align="right"> <img border="0" src="images/smallville/right_top.jpg" width="19" height="6" /></td>
</tr>
<tr>
<td width="24">
<p align="left"> <img border="0" src="images/smallville/left_corner.jpg" width="24" height="19" /></p></td>
<td width="100%"

background="images/smallville/top_mid.jpg">
<b><font face="Verdana" size="1" color="#CC9966">Extras</font></b></td>
<td width="19" align="right">
<p> <img border="0" src="images/smallville/right_corner.jpg" width="19" height="19" /></p></td>
</tr>
<tr>
<td width="24">
<p align="left"> <img border="0" src="images/smallville/left_second.jpg" width="24" height="16" /></p></td>
<td id="top" width="100%"

background="images/smallville/second_mid.jpg">
<p align="left"> <b><font face="Verdana" size="1" color="#CC9966">Original
Air Date</font></b></p></td>
<td width="19" align="right">
<p> <img border="0" src="images/smallville/right_second.jpg" width="19" height="16" /></p></td>
</tr>
<tr>
<td width="24" valign="baseline"

background="images/smallville/left_mid.jpg">
<p align="left"> <img border="0" src="images/smallville/left_mid.jpg" width="24" height="5" /></p></td>
<td width="100%" bgcolor="#000000">
<table border="0" cellspacing="0"



width="100%"

cellpadding="4">
<tr>
<td width="100%" valign="top">
<table border="0" cellspacing="0" width="100%" cellpadding="3">
<tr>
<td width="100%">
<font face="Verdana" size="1" color="#CC9966">
$air_date</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="19" valign="baseline"

background="images/smallville/right_mid.jpg">
<p align="right"> <img border="0" src="images/smallville/right_mid.jpg" width="19" height="5" /></p></td>
</tr>
<tr>

<td width="24" valign="baseline"> <img border="0" src="images/smallville/con_left.jpg" width="24" height="17" /></td>
<td width="100%" background="images/smallville/con_middle.jpg">
<b><font face="Verdana" size="1" color="#CC9966">Music</font></b></td>

<td width="19" valign="baseline"> <img border="0" src="images/smallville/con_right.jpg" width="19" height="17" /></td>
</tr>
<tr>
<td width="24" valign="baseline"

background="images/smallville/left_mid.jpg">
<p align="left"> <img border="0" src="images/smallville/left_mid.jpg" width="24" height="5" /></p></td>
<td width="100%" bgcolor="#000000">
<table border="0" cellspacing="0"



width="100%"

cellpadding="4">
<tr>
<td width="100%" valign="top">
<table border="0" cellspacing="0" width="100%" cellpadding="3">
<tr>

<td width="100%"> <font face="Verdana" size="1" color="#CC9966">
$music</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="19" valign="baseline"

background="images/smallville/right_mid.jpg">
<p align="right"> <img border="0" src="images/smallville/right_mid.jpg" width="19" height="5" /></p></td>
</tr>
<tr>

<td width="24" valign="baseline"> <img border="0" src="images/smallville/con_left.jpg" width="24" height="17" /></td>
<td width="100%" background="images/smallville/con_middle.jpg">
<b><font face="Verdana" size="1" color="#CC9966">Guest Stars</font></b></td>

<td width="19" valign="baseline"> <img border="0" src="images/smallville/con_right.jpg" width="19" height="17" /></td>
</tr>
<tr>

<td width="24" valign="baseline"

background="images/smallville/left_mid.jpg"> <img border="0" src="images/smallville/left_mid.jpg" width="24" height="5" /></td>
<td width="100%" bgcolor="#000000">
<table border="0" cellspacing="0" width="100%" cellpadding="4">
<tr>
<td width="100%">
<table border="0" cellspacing="0" width="100%" cellpadding="3">
<tr>

<td width="100%"> <font face="Verdana" size="1" color="#CC9966">
$guest_stars</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>

<td width="19" valign="baseline"

background="images/smallville/right_mid.jpg"> <img border="0" src="images/smallville/right_mid.jpg" width="19" height="5" /></td>
</tr>
<tr>

<td width="24" valign="baseline"> <img border="0" src="images/smallville/con_left.jpg" width="24" height="17" /></td>
<td width="100%" background="images/smallville/con_middle.jpg">
<b><font color="#CC9966" size="1" face="Verdana">Written By</font></b></td>

<td width="19" valign="baseline"> <img border="0" src="images/smallville/con_right.jpg" width="19" height="17" /></td>
</tr>
<tr>

<td width="24" valign="baseline"

background="images/smallville/left_mid.jpg"> <img border="0" src="images/smallville/left_mid.jpg" width="24" height="5" /></td>
<td width="100%" bgcolor="#000000">
<table border="0" cellspacing="0" width="100%" cellpadding="4">
<tr>
<td width="100%">
<table border="0" cellspacing="0" width="100%" cellpadding="3">
<tr>
<td width="100%">
<font face="Verdana" size="1" color="#CC9966">
$written_by
</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>

<td width="19" valign="baseline"

background="images/smallville/right_mid.jpg"> <img border="0" src="images/smallville/right_mid.jpg" width="19" height="5" /></td>
</tr>
<tr>

<td width="24" valign="baseline"> <img border="0" src="images/smallville/con_left.jpg" width="24" height="17" /></td>
<td width="100%" background="images/smallville/con_middle.jpg">
<b><font face="Verdana" size="1" color="#CC9966">Directed By</font></b></td>

<td width="19" valign="baseline"> <img border="0" src="images/smallville/con_right.jpg" width="19" height="17" /></td>
</tr>
<tr>

<td width="24" valign="baseline"

background="images/smallville/left_mid.jpg"> <img border="0" src="images/smallville/left_mid.jpg" width="24" height="5" /></td>
<td width="100%" bgcolor="#000000">
<table border="0" cellspacing="0" width="100%" cellpadding="4">
<tr>
<td width="100%">
<table border="0" cellspacing="0" width="100%" cellpadding="3">
<tr>
<td width="100%">
<font face="Verdana" size="1" color="#CC9966">
$directed_by
</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>

<td width="19" valign="baseline"

background="images/smallville/right_mid.jpg"> <img border="0" src="images/smallville/right_mid.jpg" width="19" height="5" /></td>
</tr>
<tr>

<td width="24" valign="baseline"> <img border="0" src="images/smallville/left_maroon_bottom.jpg" width="24" height="13" /></td>
<td width="100%" id="top"

background="images/smallville/maroon_mid.jpg" valign="bottom">

<p align="center"><font size="1" face="Verdana">&nbsp;</font></p></td>
<td width="19" valign="baseline">
<p align="right"> <img border="0" src="images/smallville/right_maroon_bottom.jpg" width="19" height="13" /></p></td>
</tr>
<tr>
<td width="24">
<p align="left"> <img border="0" src="images/smallville/left_bottom.jpg" width="24" height="18" /></p></td>
<td width="100%"

background="images/smallville/bottom.jpg">
<p align="left"> <img border="0" src="images/smallville/bottom.jpg" width="3" height="18" /></p></td>
<td width="19" align="right">
<p> <img border="0" src="images/smallville/right_bottom.jpg" width="19" height="18" /></p></td>
</tr>

</table>
</td>
</tr>
</table>



$footer
</body>
</html>

Here is the file<?php

// ####################### SET PHP ENVIRONMENT ###########################

error_reporting( E_ALL & ~E_NOTICE );

// #################### DEFINE IMPORTANT CONSTANTS #######################

define( 'NO_REGISTER_GLOBALS', 1 );

define( 'THIS_SCRIPT', 'test' );

// ################### PRE-CACHE TEMPLATES AND DATA ######################

// get special phrase groups

$phrasegroups = array();

// get special data templates from the datastore

$specialtemplates = array();

// pre-cache templates used by all actions

$globaltemplates = array( 'episode_guide' );

// pre-cache templates used by specific actions

$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################

require_once( './global.php' );

// ######################## START MAIN SCRIPT ############################
$db = mysql_connect('localhost', '---', '---') or die('Couldn\'t connect to the database.');
mysql_select_db('---', $db) or die('Couldn\'t select the database');
$query = 'select * from smallville_episode_guide where id="101"';
$result = mysql_query($query, $db) or die($query.' failed: '.mysql_error());
$row = mysql_fetch_assoc($result);
eval("\$id = \"". nl2br($row['id']) ."\";");
eval("\$episode_name = \"". nl2br($row['episode_name']) ."\";");
eval("\$episode_description = \"". nl2br($row['episode_description']) ."\";");
eval("\$air_date = \"". nl2br($row['air_date']) ."\";");
eval("\$music = \"". nl2br($row['music']) ."\";");
eval("\$guest_stars = \"". nl2br($row['guest_stars']) ."\";");
eval("\$written_by = \"". nl2br($row['written_by']) ."\";");
eval("\$directed_by = \"". nl2br( $row['directed_by'] ) ."\";");
eval( 'print_output( "' . fetch_template( 'episode_guide' ) . '" );' );

?>

The template itself is working I'm just not getting any information from my database. I'm probably running the query wrong. Thanks for your help!

Zachery
31 Jul 2004, 05:58
Any idea why my code isn't working? I'm sure (as a novice) I have to be doing something wrong. What I'm trying to do is get a page up thats going to display information put into my database. Its an episode guide. It runs fine alone, but I'm in the process of making my entire site template based.

Here is the template$stylevar[htmldoctype]
<html dir="$stylevar[textdirection]" lang="$stylevar[languagecode]">
<head>
<title>$vboptions[bbtitle] - Donate</title>
$headinclude
</head>
<body>
$header

<table border="0" cellspacing="0"



width="100%" cellpadding="0">
<tr>
<td width="100%">
<table border="0" cellspacing="0"



width="100%"

cellpadding="0">
<tr>

<td width="24" id="top"> <img border="0" src="images/smallville/left_top.jpg" width="24" height="6" /></td>

<td width="100%"

background="images/smallville/top.jpg"> <img border="0" src="images/smallville/top.jpg" width="2" height="6" /></td>

<td width="19" align="right"> <img border="0" src="images/smallville/right_top.jpg" width="19" height="6" /></td>
</tr>
<tr>
<td width="24">
<p align="left"> <img border="0" src="images/smallville/left_corner.jpg" width="24" height="19" /></p></td>
<td width="100%"

background="images/smallville/top_mid.jpg">
<b><font face="Verdana" size="1" color="#CC9966">Smallville
Episode Guide</font></b></td>
<td width="19" align="right">
<p> <img border="0" src="images/smallville/right_corner.jpg" width="19" height="19" /></p></td>
</tr>
<tr>
<td width="24">
<p align="left"> <img border="0" src="images/smallville/left_second.jpg" width="24" height="16" /></p></td>
<td id="top" width="100%"

background="images/smallville/second_mid.jpg">
<p align="left"> <b><font face="Verdana" size="1" color="#CC9966">
$id - $episode_name</font></b></p></td>
<td width="19" align="right">
<p> <img border="0" src="images/smallville/right_second.jpg" width="19" height="16" /></p></td>
</tr>
<tr>
<td width="24" valign="baseline"

background="images/smallville/left_mid.jpg">
<p align="left"> <img border="0" src="images/smallville/left_mid.jpg" width="24" height="5" /></p></td>
<td width="100%" bgcolor="#000000">
<table border="0" cellspacing="0"



width="100%"

cellpadding="4">
<tr>
<td width="100%" valign="top">
<table border="0" cellspacing="0" width="100%" cellpadding="3">
<tr>
<td width="100%">
<p align="left"> <font face="Verdana" size="1" color="#CC9966">
$episode_description
</font></p></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="19" valign="baseline"

background="images/smallville/right_mid.jpg">
<p align="right"> <img border="0" src="images/smallville/right_mid.jpg" width="19" height="5" /></p></td>
</tr>
<tr>

<td width="24" valign="baseline"> <img border="0" src="images/smallville/left_maroon_bottom.jpg" width="24" height="13" /></td>
<td width="100%" id="top"

background="images/smallville/maroon_mid.jpg" valign="bottom">

<p align="center"><font size="1" face="Verdana">&nbsp;</font></p></td>
<td width="19" valign="baseline">
<p align="right"> <img border="0" src="images/smallville/right_maroon_bottom.jpg" width="19" height="13" /></p></td>
</tr>
<tr>
<td width="24">
<p align="left"> <img border="0" src="images/smallville/left_bottom.jpg" width="24" height="18" /></p></td>
<td width="100%"

background="images/smallville/bottom.jpg">
<p align="left"> <img border="0" src="images/smallville/bottom.jpg" width="3" height="18" /></p></td>
<td width="19" align="right">
<p> <img border="0" src="images/smallville/right_bottom.jpg" width="19" height="18" /></p></td>
</tr>
<tr>

<td width="24" id="top"> <img border="0" src="images/smallville/left_top.jpg" width="24" height="6" /></td>

<td width="100%"

background="images/smallville/top.jpg"> <img border="0" src="images/smallville/top.jpg" width="2" height="6" /></td>

<td width="19" align="right"> <img border="0" src="images/smallville/right_top.jpg" width="19" height="6" /></td>
</tr>
<tr>
<td width="24">
<p align="left"> <img border="0" src="images/smallville/left_corner.jpg" width="24" height="19" /></p></td>
<td width="100%"

background="images/smallville/top_mid.jpg">
<b><font face="Verdana" size="1" color="#CC9966">Extras</font></b></td>
<td width="19" align="right">
<p> <img border="0" src="images/smallville/right_corner.jpg" width="19" height="19" /></p></td>
</tr>
<tr>
<td width="24">
<p align="left"> <img border="0" src="images/smallville/left_second.jpg" width="24" height="16" /></p></td>
<td id="top" width="100%"

background="images/smallville/second_mid.jpg">
<p align="left"> <b><font face="Verdana" size="1" color="#CC9966">Original
Air Date</font></b></p></td>
<td width="19" align="right">
<p> <img border="0" src="images/smallville/right_second.jpg" width="19" height="16" /></p></td>
</tr>
<tr>
<td width="24" valign="baseline"

background="images/smallville/left_mid.jpg">
<p align="left"> <img border="0" src="images/smallville/left_mid.jpg" width="24" height="5" /></p></td>
<td width="100%" bgcolor="#000000">
<table border="0" cellspacing="0"



width="100%"

cellpadding="4">
<tr>
<td width="100%" valign="top">
<table border="0" cellspacing="0" width="100%" cellpadding="3">
<tr>
<td width="100%">
<font face="Verdana" size="1" color="#CC9966">
$air_date</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="19" valign="baseline"

background="images/smallville/right_mid.jpg">
<p align="right"> <img border="0" src="images/smallville/right_mid.jpg" width="19" height="5" /></p></td>
</tr>
<tr>

<td width="24" valign="baseline"> <img border="0" src="images/smallville/con_left.jpg" width="24" height="17" /></td>
<td width="100%" background="images/smallville/con_middle.jpg">
<b><font face="Verdana" size="1" color="#CC9966">Music</font></b></td>

<td width="19" valign="baseline"> <img border="0" src="images/smallville/con_right.jpg" width="19" height="17" /></td>
</tr>
<tr>
<td width="24" valign="baseline"

background="images/smallville/left_mid.jpg">
<p align="left"> <img border="0" src="images/smallville/left_mid.jpg" width="24" height="5" /></p></td>
<td width="100%" bgcolor="#000000">
<table border="0" cellspacing="0"



width="100%"

cellpadding="4">
<tr>
<td width="100%" valign="top">
<table border="0" cellspacing="0" width="100%" cellpadding="3">
<tr>

<td width="100%"> <font face="Verdana" size="1" color="#CC9966">
$music</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="19" valign="baseline"

background="images/smallville/right_mid.jpg">
<p align="right"> <img border="0" src="images/smallville/right_mid.jpg" width="19" height="5" /></p></td>
</tr>
<tr>

<td width="24" valign="baseline"> <img border="0" src="images/smallville/con_left.jpg" width="24" height="17" /></td>
<td width="100%" background="images/smallville/con_middle.jpg">
<b><font face="Verdana" size="1" color="#CC9966">Guest Stars</font></b></td>

<td width="19" valign="baseline"> <img border="0" src="images/smallville/con_right.jpg" width="19" height="17" /></td>
</tr>
<tr>

<td width="24" valign="baseline"

background="images/smallville/left_mid.jpg"> <img border="0" src="images/smallville/left_mid.jpg" width="24" height="5" /></td>
<td width="100%" bgcolor="#000000">
<table border="0" cellspacing="0" width="100%" cellpadding="4">
<tr>
<td width="100%">
<table border="0" cellspacing="0" width="100%" cellpadding="3">
<tr>

<td width="100%"> <font face="Verdana" size="1" color="#CC9966">
$guest_stars</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>

<td width="19" valign="baseline"

background="images/smallville/right_mid.jpg"> <img border="0" src="images/smallville/right_mid.jpg" width="19" height="5" /></td>
</tr>
<tr>

<td width="24" valign="baseline"> <img border="0" src="images/smallville/con_left.jpg" width="24" height="17" /></td>
<td width="100%" background="images/smallville/con_middle.jpg">
<b><font color="#CC9966" size="1" face="Verdana">Written By</font></b></td>

<td width="19" valign="baseline"> <img border="0" src="images/smallville/con_right.jpg" width="19" height="17" /></td>
</tr>
<tr>

<td width="24" valign="baseline"

background="images/smallville/left_mid.jpg"> <img border="0" src="images/smallville/left_mid.jpg" width="24" height="5" /></td>
<td width="100%" bgcolor="#000000">
<table border="0" cellspacing="0" width="100%" cellpadding="4">
<tr>
<td width="100%">
<table border="0" cellspacing="0" width="100%" cellpadding="3">
<tr>
<td width="100%">
<font face="Verdana" size="1" color="#CC9966">
$written_by
</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>

<td width="19" valign="baseline"

background="images/smallville/right_mid.jpg"> <img border="0" src="images/smallville/right_mid.jpg" width="19" height="5" /></td>
</tr>
<tr>

<td width="24" valign="baseline"> <img border="0" src="images/smallville/con_left.jpg" width="24" height="17" /></td>
<td width="100%" background="images/smallville/con_middle.jpg">
<b><font face="Verdana" size="1" color="#CC9966">Directed By</font></b></td>

<td width="19" valign="baseline"> <img border="0" src="images/smallville/con_right.jpg" width="19" height="17" /></td>
</tr>
<tr>

<td width="24" valign="baseline"

background="images/smallville/left_mid.jpg"> <img border="0" src="images/smallville/left_mid.jpg" width="24" height="5" /></td>
<td width="100%" bgcolor="#000000">
<table border="0" cellspacing="0" width="100%" cellpadding="4">
<tr>
<td width="100%">
<table border="0" cellspacing="0" width="100%" cellpadding="3">
<tr>
<td width="100%">
<font face="Verdana" size="1" color="#CC9966">
$directed_by
</font></td>
</tr>
</table>
</td>
</tr>
</table>
</td>

<td width="19" valign="baseline"

background="images/smallville/right_mid.jpg"> <img border="0" src="images/smallville/right_mid.jpg" width="19" height="5" /></td>
</tr>
<tr>

<td width="24" valign="baseline"> <img border="0" src="images/smallville/left_maroon_bottom.jpg" width="24" height="13" /></td>
<td width="100%" id="top"

background="images/smallville/maroon_mid.jpg" valign="bottom">

<p align="center"><font size="1" face="Verdana">&nbsp;</font></p></td>
<td width="19" valign="baseline">
<p align="right"> <img border="0" src="images/smallville/right_maroon_bottom.jpg" width="19" height="13" /></p></td>
</tr>
<tr>
<td width="24">
<p align="left"> <img border="0" src="images/smallville/left_bottom.jpg" width="24" height="18" /></p></td>
<td width="100%"

background="images/smallville/bottom.jpg">
<p align="left"> <img border="0" src="images/smallville/bottom.jpg" width="3" height="18" /></p></td>
<td width="19" align="right">
<p> <img border="0" src="images/smallville/right_bottom.jpg" width="19" height="18" /></p></td>
</tr>

</table>
</td>
</tr>
</table>



$footer
</body>
</html>

Here is the file<?php

// ####################### SET PHP ENVIRONMENT ###########################

error_reporting( E_ALL & ~E_NOTICE );

// #################### DEFINE IMPORTANT CONSTANTS #######################

define( 'NO_REGISTER_GLOBALS', 1 );

define( 'THIS_SCRIPT', 'test' );

// ################### PRE-CACHE TEMPLATES AND DATA ######################

// get special phrase groups

$phrasegroups = array();

// get special data templates from the datastore

$specialtemplates = array();

// pre-cache templates used by all actions

$globaltemplates = array( 'episode_guide' );

// pre-cache templates used by specific actions

$actiontemplates = array();

// ######################### REQUIRE BACK-END ############################

require_once( './global.php' );

// ######################## START MAIN SCRIPT ############################
$db = mysql_connect('localhost', '---', '---') or die('Couldn\'t connect to the database.');
mysql_select_db('---', $db) or die('Couldn\'t select the database');
$query = 'select * from smallville_episode_guide where id="101"';
$result = mysql_query($query, $db) or die($query.' failed: '.mysql_error());
$row = mysql_fetch_assoc($result);
eval("\$id = \"". nl2br($row['id']) ."\";");
eval("\$episode_name = \"". nl2br($row['episode_name']) ."\";");
eval("\$episode_description = \"". nl2br($row['episode_description']) ."\";");
eval("\$air_date = \"". nl2br($row['air_date']) ."\";");
eval("\$music = \"". nl2br($row['music']) ."\";");
eval("\$guest_stars = \"". nl2br($row['guest_stars']) ."\";");
eval("\$written_by = \"". nl2br($row['written_by']) ."\";");
eval("\$directed_by = \"". nl2br( $row['directed_by'] ) ."\";");
eval( 'print_output( "' . fetch_template( 'episode_guide' ) . '" );' );

?>

The template itself is working I'm just not getting any information from my database. I'm probably running the query wrong. Thanks for your help!
Is all this info in the same database as vBulletins?

lichtflits
31 Jul 2004, 09:48
and how do i do that phpinclude template thing.

Blue Moose Aaron
31 Jul 2004, 14:36
Is all this info in the same database as vBulletins?

Yes.

Ghostsuit
03 Aug 2004, 03:13
Ahh the original :)

Zachery
03 Aug 2004, 03:18
Yes.
Then why are you writing out all that mysql info, just use $DB_site or whatever it is.

Your already connected to the Database via global.php

PtP
13 Aug 2004, 07:20
Any way of forcing the page to use a style that is not the default style.?

Davey
13 Aug 2004, 12:51
Some basics of vB3(mini howto)
also some basic php junk
the most important thing if you want to make pages based on templates or anything of the such would be to first know how to "

connect" to vbulletin, and then learn how to call and eval templates. so lets take a look at the most BASIC page we can do


This is *exactly* what I was in need of!
Thank you endlessly.

xmitchx
13 Aug 2004, 22:50
Could anyone please explain to me what the $phasegroups variable is for.

Zachery
13 Aug 2004, 23:13
Could anyone please explain to me what the $phasegroups variable is for.
If you need to call any other phrasegroup besides global

PtP
13 Aug 2004, 23:44
Any way of forcing the page to use a style that is not the default style.?

I feel rejected :(

Zachery
14 Aug 2004, 01:15
I feel rejected :(
If i knew i would tell you.

PtP
14 Aug 2004, 06:18
My apoligies for thinking you are a guru ;)

Zachery
14 Aug 2004, 06:19
My apoligies for thinking you are a guru ;)
I am just a simple student who is still learning things himself ;)

colicab-d
07 Sep 2004, 15:05
can this be done Zachery?

say I have a var called $a and i want it evald on its own so that I can use it in the templates how do i assign just a value to that and still eval? i.e value 22

khaleel
11 Oct 2004, 15:09
Thankyou very much this is good newbs like me who have come from along time experince with phpBB and IpB :squareeyed:

Seanie
16 Oct 2004, 19:18
Warning: main(): open_basedir restriction in effect. File(./global.php) is not within the allowed path(s): (/home/latch/:/usr/lib/php:/usr/local/lib/php:/tmp) in /home/latch/public_html/test.php on line 16


.... my forums are in /home/forums/public_html/

is there anyway to get it to work :S

C.Birch
22 Oct 2004, 10:00
read the error it tell's you the prob right away.

open_basedir restriction in effect. File(./global.php) is not within the allowed path

in other words the server setup does not let you pull files from other site paths this is because there might be other sites on the server you dont own and if there not any open_basedir restriction you could pull files from other peoples sites and this could let people hack people or nick personal information.

Seanie
23 Oct 2004, 20:39
read the error it tell's you the prob right away.

open_basedir restriction in effect. File(./global.php) is not within the allowed path

in other words the server setup does not let you pull files from other site paths this is because there might be other sites on the server you dont own and if there not any open_basedir restriction you could pull files from other peoples sites and this could let people hack people or nick personal information.
i know that now... we've fixed it

Adrian Schneider
07 Nov 2004, 23:41
$actiontemplates = array(
'small' => array(
'other'
)
);

What exactly does this do?

GeZuS P
22 Nov 2004, 22:36
OMG Thanks, I feel like a god now !!!

PaulioTheGreat
08 Jan 2005, 01:13
Hey, i suppose you lot have been asked this loads of times, i am using this code:

<?php
// ## Changes Directory so it can accesss vBulletin IF we are outside the forums folder, if not this is not nessary ##
chdir("./forum");

// ## Error Reporting ( we use error reporting in php so we can control the display of error messages
// ## we will use this because all vBulletin files follow the same error reporting rules) ##
error_reporting(E_ALL & ~E_NOTICE);

// ## this action here cache's the templates so that everytime their needed a querry wont be needed to run
// ## the names in there are just the template names :), there must be a comma after everyone but the last ##
$globaltemplates = array(
'index.php'
);

// ## Grabs global.php this grabs vbulletins global.php so we can use the most basic of vBulletins functions ##
require_once("./global.php");

// ## this calls to print out one main template ##
eval('print_output("' . fetch_template('index.php') . '");');
?>

And is there any way of fixing the problems with the javascripts and images WITHOUT adding the vb home code to the relative urls?

Here is the page:

http://www.justonxbox.com/test.php

Also i know the template is called index.php, this is so that when i make my site from these they are easily edited as that will be the name for this page once done etc... etc...

Thanks Paul

grooveh
16 Jan 2005, 20:23
yes, thank you!

dwh
29 Jan 2005, 20:56
You didnt print any templates...

your missing the most important line

eval('print_output("' . fetch_template('TEMPLATE') . '");');

You just made some varibles, you didnt tell the script to display a template i suggest trying generic shell

eval('print_output("' . fetch_template('GENERIC_SHELL') . '");');

Gosh that would have saved me a lot of time had I known about it. Howdo use it? How do you populate $HTML? Is it a regular variable or aspecial one?

Also, I still don't get actions? Can someone explain the system in more details?

dwh
31 Jan 2005, 23:40
I think I understood actions now. It's no big deal it just pulls outany templates that are defined (somewhere? init.php?) for that action.It's a "shortcut" but it doesn't make any difference as long as youpull out any template you use in globaltemplates you should be ok.Correct me if I'm wrong.

I'd still like to know about the $HTML thing though.

feldon23
01 Feb 2005, 20:51
I think I understood actions now. It's no big deal it just pulls outany templates that are defined (somewhere? init.php?) for that action.It's a "shortcut" but it doesn't make any difference as long as youpull out any template you use in globaltemplates you should be ok.Correct me if I'm wrong.

I'd still like to know about the $HTML thing though.
I'm using this code and to get images and javascript to load, I'm having to use ugly search-and-replace code that replaces

href=" with href="../forums/

and

src=" with src="../forums/, etc.

There's got to be an easier way. :(

The huge problem I am running into now is that by including global.php, and by extension init.php, cookies are being established. That's not what I want. Is there a way to load templates without all that other stuff happening?

What I may need to do is create a cron task that dumps the evaluated contents of the templates I need to flat HTML files and then include those. :( :(

Razz
10 Apr 2005, 23:29
If your using the action templates as shown in the original post:


$actiontemplates = array(
'small' => array(
'other'
)
);


along with:


if (empty($_REQUEST['do']))
{
$_REQUEST['do'] = 'small';
}


Then you will need to set a default action template like below:


$actiontemplates = array(
'small' => array(
'other'
)
);

$actiontemplates['none'] = &$actiontemplates['small'];


This should prevent uncached templates on initial page visit if $_REQUEST['do'] is empty. Just change "small" in the last line to the default template array such as "home" or "main".

Razasharp
30 Apr 2005, 01:36
Hi

I've got the page to work, but I'd like to use a custom header and footer because the links do not show correctly at present - I've created the new templates for them and called them in my 'test' template instead of the standard ones. But it doesnt work :-(

Can someone give me a quick run-down of how it can be achieved? thanks.

NxTek
30 Apr 2005, 16:54
Can that be used for this (from another post) -

I've seen a few scripts that prompt a user to login, but nothing that would redirect the user to the internal login page on non-vB pages.

I have a directory structure like this -

/forums
/ads
/games
/faqs
/blog
and so on.

I want to use vB security throughout my entire site, even outside the actual /forums dir.

If you would go straight to /blog/blog.php for example, a piece of code would detect whether the visitor is logged in or not.

If so, display the page normally.

If not, redirect them to the exact same login screen that's invoked when you go to http://www.onlinepokerlistings.com/forums/calendar.php.

Ok, after logging in, the visitor would be directed back to /blog/blog.php.

It would work exactly the same as normally requiring a login to see a vB page, but in this case it's outside of vB.

hexosex
21 Aug 2005, 02:51
Where the hell are the templates stored? :O I just cant find them on the installation i have here... Can anyone help please?

Adrian Schneider
21 Aug 2005, 03:33
In the database (you should access them from vBulletin).

AdminCP > Style Manager > (pick a style) > Edit Templates

lem
16 Sep 2005, 17:56
I have this system setup for my site locksmithcafe.com. However, when I log out of the forum and go to locksmithcafe.com it gives me the following error:

Unable to add cookies, header already sent.
File: /home/httpd/vhosts/locksmithcafe.com/httpdocs/index.php
Line: 9


whats up with that do you think?

Here is my index.php page:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Welcome to the Locksmith Cafe!</title>
</head>

<body>
<?php
// OUR CONTENT BEGINS ON LINE 48 -----------------------------------------
// ## Changes Directory so it can accesss vBulletin IF we are outside the forums folder, if not this is not nessary ##
chdir("./forum");

// ## Error Reporting ( we use error reporting in php so we can control the display of error messages
// ## we will use this because all vBulletin files follow the same error reporting rules) ##
error_reporting(E_ALL & ~E_NOTICE);

// ## this here defines the "this_script" function, which if you use template conditionals, it will come in handy :) ##
define('THIS_SCRIPT', 'page');

// ## this action here cache's the templates so that everytime their needed a querry wont be needed to run
// ## the names in there are just the template names :), there must be a comma after everyone but the last ##
$globaltemplates = array(
'headinclude',
'header',
'navbar',
'footer'
);

// ## Grabs global.php this grabs vbulletins global.php so we can use the most basic of vBulletins functions ##
require_once("./global.php");

// ## ok this next set of lines "eval"'s our templates so they can be called inside the template we will print out ##

eval('$h_include = "' . fetch_template('headinclude') . '";');
eval('$header = "' . fetch_template('header') . '";');
//eval('$navbar = "' . fetch_template('navbar') . '";');
eval('$footer = "' . fetch_template('footer') . '";');

//eval('print_output("' . fetch_template('headinclude') . '");');

echo $h_include;
echo $header;
//echo $navbar;
// ********************************************************************************
// place our content here *********************************************************

echo '
<h3>Welcome to the Locksmith Cafe!</h3>

<br><br><br><br>
<h3>Find a Locksmith in Your area!</h3>
';
include $_SERVER['DOCUMENT_ROOT'].'/search.html';
// end our content ****************************************************************
// ********************************************************************************
echo $footer;
?>
</body>
</head>

Any ideas?

thanks

Lem

hexosex
16 Sep 2005, 17:59
You are trying to start another page that is trying to set the http headers after they have allready been set. I had this problem and got around it with some php http posts that then caught the output stripped out the headers and then set them on final output!

Contact me gary@behindtheweb.co.uk if you need any more help on this problem. I'd be happy to help.

Marco van Herwaarden
16 Sep 2005, 20:34
Just remove everything above the opening php-tag.

You can not output ANYTHING before you require global.php.

bigtime
30 Sep 2005, 19:58
NxTek - that's exactly what I want to do. Did you find the solution? Any one else?

Thanks.

Can that be used for this (from another post) -

I've seen a few scripts that prompt a user to login, but nothing that would redirect the user to the internal login page on non-vB pages.

I have a directory structure like this -

/forums
/ads
/games
/faqs
/blog
and so on.

I want to use vB security throughout my entire site, even outside the actual /forums dir.

If you would go straight to /blog/blog.php for example, a piece of code would detect whether the visitor is logged in or not.

If so, display the page normally.

If not, redirect them to the exact same login screen that's invoked when you go to http://www.onlinepokerlistings.com/forums/calendar.php.

Ok, after logging in, the visitor would be directed back to /blog/blog.php.

It would work exactly the same as normally requiring a login to see a vB page, but in this case it's outside of vB.

NxTek
01 Oct 2005, 16:04
No, but I'm using vBa.

NxTek - that's exactly what I want to do. Did you find the solution? Any one else?

Thanks.

PennylessZ28
10 Oct 2005, 22:33
Very nice, good information!