vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   PHP code withing templates? (https://vborg.vbsupport.ru/showthread.php?t=51078)

limey 04-01-2003 07:41 PM

PHP code withing templates?
 
I have a template and im pulling the page with:

PHP Code:

<?php
error_reporting
(7);

require(
'./global.php');


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

?>

Now I added this bit of php in the template and its showing that code as text. I tried a few searches on php in templates and what not, but could not find it.

PHP Code:

<?php

# Include amazon_functions
include('functions/amazon_functions.php');


# Display BrowseNodes
$BrowseNodes=amazon_browsenodes(books);
echo 
"<table border=0 align=left>\n";
while(list(
$Key,$Value)=each($BrowseNodes)) {
  echo 
"<tr>\n";
  echo 
"<td bgcolor='#f1f1f1' OnMouseOver=\"this.style.backgroundColor='#e1e1e1';\" OnMouseOut=\"this.style.backgroundColor='#f1f1f1';\"><a href=\"".$PHP_SELF."?BrowseNode=$Key&Mode=books\">$Value</a></td>\n";
  echo 
"</tr>\n";
 }
echo 
"</table><p><br>\n\n";


# Display searchform
echo amazon_create_searchform();
echo 
"<p><br>";



# Search results
if($SearchKeyword || $BrowseNode) {

  
# Perform search
  
if($BrowseNode)
   { 
$Data=amazon_browse_node($BrowseNode,$Mode); }
  else
   { 
$Data=amazon_search($SearchKeyword,$SearchType,$SearchMode); }

   
# Transform searchresult-array to HTML-Table
   
$HTMLTable=amazon_create_productlist($Data,10,"example1_productinfo.php");

   echo 
$HTMLTable;
 }


php?>


Xenon 04-01-2003 08:04 PM

change
PHP Code:

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

into:
PHP Code:

eval(gettemplate('test_temp'0,0)); 

and remove the <?php ?> from the template

limey 04-01-2003 09:14 PM

parse error: eval()'d code on line 1

limey 04-02-2003 03:55 PM

Ok so neither of these are working....

How can I pull this code that is in a seperate file into a template with a "variable" like $amazon ?

I only need this pulled on a test template that im using with this code:

PHP Code:

<?php
error_reporting
(7);

require(
'./global.php');


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

?>



All times are GMT. The time now is 09:13 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.01164 seconds
  • Memory Usage 1,728KB
  • 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_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (4)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete