Go Back   vb.org Archive > vBulletin Article Depository > Read An Article > vBulletin 3 Articles

Reply
 
Thread Tools
Some basics of vB3(mini howto)
Zachery's Avatar
Zachery
Join Date: Jul 2002
Posts: 11,440

 

Ontario, Canada
Show Printable Version Email this Page Subscription
Zachery Zachery is offline 01-08-2004, 10:00 PM

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 Code:
<?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 Code:
<?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') . '");');
?>

PHP Code:
// ## 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
PHP Code:
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 )
Reply With Quote
  #72  
Old 06-21-2004, 05:18 PM
Dean C's Avatar
Dean C Dean C is offline
 
Join Date: Jan 2002
Location: England
Posts: 9,071
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

You simply put:

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

Reply With Quote
  #73  
Old 06-21-2004, 06:36 PM
lichtflits's Avatar
lichtflits lichtflits is offline
 
Join Date: Feb 2002
Location: The Netherlands
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #74  
Old 06-28-2004, 04:38 AM
marcjd marcjd is offline
 
Join Date: Jan 2003
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #75  
Old 06-28-2004, 06:29 PM
Slapyo Slapyo is offline
 
Join Date: Feb 2004
Location: Rancho Cucamonga
Posts: 370
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #76  
Old 06-28-2004, 06:47 PM
Slapyo Slapyo is offline
 
Join Date: Feb 2004
Location: Rancho Cucamonga
Posts: 370
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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.
Reply With Quote
  #77  
Old 07-23-2004, 07:59 PM
lichtflits's Avatar
lichtflits lichtflits is offline
 
Join Date: Feb 2002
Location: The Netherlands
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Duse any one now how to use <?php include("$id.htm" ?> in vb.
Reply With Quote
  #78  
Old 07-29-2004, 09:22 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by lichtflits
Duse any one now how to use <?php include("$id.htm" ?> in vb.
use the phpinclude template
Reply With Quote
  #79  
Old 07-31-2004, 04:30 AM
Blue Moose Aaron's Avatar
Blue Moose Aaron Blue Moose Aaron is offline
 
Join Date: Sep 2002
Location: Austin, Texas
Posts: 149
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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!
Reply With Quote
  #80  
Old 07-31-2004, 04:58 AM
Zachery's Avatar
Zachery Zachery is offline
 
Join Date: Jul 2002
Location: Ontario, Canada
Posts: 11,440
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

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?
Reply With Quote
  #81  
Old 07-31-2004, 08:48 AM
lichtflits's Avatar
lichtflits lichtflits is offline
 
Join Date: Feb 2002
Location: The Netherlands
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

and how do i do that phpinclude template thing.
Reply With Quote
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:09 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.10606 seconds
  • Memory Usage 2,492KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (4)bbcode_code
  • (7)bbcode_php
  • (3)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_article
  • (1)navbar
  • (4)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.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/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.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
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete