vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vBulletin 3 Articles (https://vborg.vbsupport.ru/forumdisplay.php?f=187)
-   -   Some basics of vB3(mini howto) (https://vborg.vbsupport.ru/showthread.php?t=59939)

NTLDR 01-16-2004 03:28 PM

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.

PHP Code:

if (!in_array($bbuserinfo['usergroupid'], array(123))) {
    
print_no_permission();



Ryan Ashbrook 01-16-2004 03:38 PM

Thanks, it works perfectly. :)

VodkaFish 01-18-2004 10:07 PM

Quote:

Originally Posted by NTLDR
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.

PHP Code:

if (!in_array($bbuserinfo['usergroupid'], array(123))) {
    
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 01-18-2004 10:18 PM

The STANDARD_ERROR template contains the majority of the HTML for the no permission screen that you'll need to edit :)

VodkaFish 01-18-2004 10:19 PM

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:
Code:

<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 01-18-2004 10:22 PM

Quote:

Originally Posted by NTLDR
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 01-31-2004 04:49 PM

Quote:

Originally Posted by VodkaFish
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

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 01-31-2004 08:43 PM

it looks like your hard coding the file, this howto deals more with using the template system directly

Mijae 02-01-2004 05:01 PM

Quote:

Originally Posted by Faranth
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 02-01-2004 07:52 PM

Im sure there is, but i dont know how to do it really

gmarik 02-03-2004 05:18 AM

Cool, waiting for further instructions.

mossyuk 02-04-2004 11:58 AM

im confused - how do i make the navbar i have included in my page change to show your status as logged in?

Gio Takahashi 02-11-2004 01:35 AM

Quote:

Originally Posted by mossyuk
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 02-11-2004 01:48 AM

I THINK i know how to do that, but i need to double check somthing ^_^

Dark_Wizard 02-11-2004 10:46 AM

Quote:

Originally Posted by Gio Takahashi
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 02-11-2004 03:39 PM

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 02-11-2004 04:55 PM

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.

PHP Code:

{htmldoctype}
<
html>
<
head>
  <
titleBlah </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 Code:

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

Tony.

Zachery 02-12-2004 01:23 AM

Quote:

Originally Posted by Sent1nel
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.

PHP Code:

{htmldoctype}
<
html>
<
head>
  <
titleBlah </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 Code:

<?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 02-17-2004 09:24 PM

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 03-16-2004 02:43 PM

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 03-19-2004 10:22 AM

question on action templates, can u define wut u mean by actions more precisely im a lil confused.

Zachery 03-19-2004 10:23 AM

like.

search.php?do=getnew

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

AN-net 03-19-2004 11:09 AM

k
so something like
blah.php?do=redirect
is one?

Tradjick 04-02-2004 09:03 PM

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 05-18-2004 07:08 AM

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 05-28-2004 12:31 PM

Hi Zachery,
I tested the first & second examples but I keep getting the following lines in my browser:

HTML Code:

<!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 Code:

<?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 05-28-2004 12:48 PM

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 05-28-2004 01:12 PM

Got it! It worked :)

Thanks Zachery.

Casparian 06-05-2004 02:57 AM

Quote:

Originally Posted by Mijae
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 06-21-2004 04:41 PM

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 06-21-2004 05:18 PM

You simply put:

PHP Code:

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


:)

lichtflits 06-21-2004 06:36 PM

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 06-28-2004 04:38 AM

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 06-28-2004 06:29 PM

Quote:

Originally Posted by VodkaFish
The only thing throwing me off is the logout javascript:
Code:

<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 06-28-2004 06:47 PM

acutally, i just figured it out.

Code:

<!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 07-23-2004 07:59 PM

Duse any one now how to use <?php include("$id.htm" ?> in vb.

Zachery 07-29-2004 09:22 AM

Quote:

Originally Posted by lichtflits
Duse any one now how to use <?php include("$id.htm" ?> in vb.

use the phpinclude template

Blue Moose Aaron 07-31-2004 04:30 AM

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
Code:

$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 Code:

<?php

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

error_reportingE_ALL & ~E_NOTICE ); 

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

define'NO_REGISTER_GLOBALS'); 

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 07-31-2004 04:58 AM

Quote:

Originally Posted by Ted Varnson
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
Code:

$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 Code:

<?php

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

error_reportingE_ALL & ~E_NOTICE ); 

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

define'NO_REGISTER_GLOBALS'); 

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 07-31-2004 08:48 AM

and how do i do that phpinclude template thing.


All times are GMT. The time now is 07:59 PM.

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.02318 seconds
  • Memory Usage 2,195KB
  • 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
  • (5)bbcode_code_printable
  • (1)bbcode_html_printable
  • (10)bbcode_php_printable
  • (11)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)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
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete