vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Templates - what am I doing wrong? (https://vborg.vbsupport.ru/showthread.php?t=70621)

vauge 10-15-2004 11:21 AM

Templates - what am I doing wrong?
 
I want to create a news page. But I cannot get anything in the news_header template to display. What am I doing wrong?



news.php

PHP Code:


<?php

 

error_reporting
(E_ALL & ~E_NOTICE);

require_once(
'./global.php');

eval(
'$navbar = "' fetch_template('navbar') . '";');

$globaltemplates = array('news','news_header','news_desc');

if (
$bbuserinfo[userid]=='') {

print_no_permission();

} else {

     
$username1=ereg_replace("[^A-Za-z0-9]""_"$bbuserinfo['username']); 

     
$myLength strlen$username1 ); 

     if (
$myLength 15) { 

     
$username substr$username1015 ); 

     } else { 

     
$username $username1

    }

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

}

 

$item_title "test1";

 

eval(
'$item_title = "' fetch_template('news_header'00) . '";');

 

?>



news template

PHP Code:


$stylevar
[htmldoctype]

<
html id="moooo" dir="$stylevar[textdirection]lang="$stylevar[languagecode]">

<
head>

<
title>$vboptions[bbtitle] - $pagetitle</title>

$headinclude

</head>

<
body>

$header

$navbar

<table class="tborder">

<
tr>

    <
td class="tcat" colspan="2">My Table</td>

</
tr>

$news_header

</table>

 

$footer

</body>

</
html



news_header template

PHP Code:


<tr>

    <
td class="alt1">$item_title</td>

    <
td class="alt2">Hello I am in your news header!</td>

</
tr


Xenon 10-15-2004 11:29 AM

well you made a few mistakes

first: the $globaltemplates line has to be BEFORE the require global.php line

second: you news_heade variable is filled AFTER the actual page_output part, so of course it would not show anything

vauge 10-15-2004 11:52 AM

Wow - fast response - thanks!

I changed the news.php around:

PHP Code:

<?php

error_reporting
(E_ALL & ~E_NOTICE);
$globaltemplates = array('news','news_header','news_desc');
require_once(
'./global.php');
eval(
'$navbar = "' fetch_template('navbar') . '";');


 
  
$item_title "test1";
   
  eval(
'$item_title = "' fetch_template('news_header'00) . '";');
  
  eval(
'print_output("' fetch_template('news') . '");');
?>

Still doesn't print my item_title. Confused. :/

Xenon 10-15-2004 11:56 AM

change
PHP Code:

eval('$item_title = "' fetch_template('news_header'00) . '";'); 

into
PHP Code:

eval('$news_header = "' fetch_template('news_header'00) . '";'); 

you are refering to $news_header in your newstemplate, not to item_title :)

vauge 10-15-2004 11:58 AM

woohoo!

Thank you much.

Xenon 10-15-2004 12:11 PM

you're welcome :)


All times are GMT. The time now is 01:21 AM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02019 seconds
  • Memory Usage 1,744KB
  • 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
  • (6)bbcode_php_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (6)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