template in php codes?

Tutorials for <a href="http://www.phpbbstyles.com/viewtopic.php?t=356">eXtreme Styles mod</a> for phpBB 2.0.

Moderator: Moderators

template in php codes?

Postby mikecop on Tue Mar 07, 2006 10:59 pm

Hi,

I am having some problem using this MOD.

Before installing this MOD:
In the original template, I first declare the variables like this:
example.php
Code: Select all
$template->assign_vars(array(
'SITENAME' => $board_config['sitename'],
'PAGE_TITLE' => $page_title
);

Then, when I do:
example.tpl
Code: Select all
<html>
<title>{SITENAME}</title>
<body>
<p>{PAGE_TITLE}</p>
</html>


{SITENAME} and {PAGE_TITLE} well be subsituted by what I declared in example.php .

And the output of examle.php is
Code: Select all
<html>
<title>My site name</title>
<body>
<p>This is page title</p>
</html>




Now I have eXtreme Styles mod installed.

When I do something like this:
example.tpl
Code: Select all
<?php

echo "{SITENAME}";

echo "{PAGE_TITEL}"

?>


I get this in the source (as text), but not executed php:
example.php
Code: Select all
<?php echo isset(Array['SITENAME']) ? Array['SITENAME'] : ('SITENAME'); ?><?php echo isset(Array['PAGE_TITLE']) ? Array['PAGE_TITLE'] : ('PAGE_TITLE'); ?>


So, how I make this work?
Code: Select all
<?php

echo "{SITENAME}";

echo "{PAGE_TITEL}"

?>


Thanks very much.
mikecop
Registered User
Registered User
 
Posts: 2
Joined: Tue Mar 07, 2006 10:44 pm

Postby DooBDee on Wed Mar 08, 2006 4:06 pm

Mite be me, but why do you want to echo a template variable? Those variables are supposed to be used with HTML (they are substition for text in tpl file). If you just want the sitename to be put to browser just use {SITENAME}, no need for php.
DooBDee
Website Ninja
DooBDee.net
User avatar
DooBDee
Moderator
Moderator
 
Posts: 3530
Joined: Tue Mar 01, 2005 6:28 pm
Location: DooBDee.net

Postby mikecop on Fri Mar 10, 2006 4:15 pm

[quote user="DoobDee" post="70373"]Mite be me, but why do you want to echo a template variable? Those variables are supposed to be used with HTML (they are substition for text in tpl file). If you just want the sitename to be put to browser just use {SITENAME}, no need for php.[/quote]Actually, i am trying to use hawhaw ( http://hawhaw.de ) in the template.

So I would like to do something like this:
Code: Select all
<?php
  require("hawhaw.inc");
  $myPage = new HAW_deck("{SITENAME}");
  $myText = new HAW_text("{PAGE_TITLE}");
  $myPage->add_text($myText);
  $myPage->create_page();
?>
Thank you.
mikecop
Registered User
Registered User
 
Posts: 2
Joined: Tue Mar 07, 2006 10:44 pm


Return to eXtreme Styles mod tutorials

Who is online

Users browsing this forum: No registered users and 1 guest