Page 5 of 8

Re: phpBB Standalone Template Engine

Posted: Thu Feb 25, 2010 1:56 pm
by ChaosBringer
Take a look at the link i posted and you'll see what it can do :)

Its GPLv3 btw.

When im finished designing my site, im going to release more things like these...Some are going to be commercial, some open-source.

If you need documentation as to how to use it, PM me.

Re: phpBB Standalone Template Engine

Posted: Thu Jul 22, 2010 3:41 am
by NguyTieuNhan
imkingdavid wrote:Alright, turns out I was actually the one that was missing something utterly simple, not you (assuming you were using the file I provided a few posts back, which I have now fixed, btw). I had forgotten to remove the second check for if(!defined('IN_PHPBB')) { exit; }, so it was exiting the script. Took me half an hour to realize that too.

Anyway, I set up an example here, which you can download here (zip).

All it does is output
Hello world
onto the page, but I have explained how to use each of the functions in the script. For info on how to use other template functions, either ask here, check the tutorial in the wiki that I posted in my previous post, or dig through phpBB itself.

The engine is quite powerful and has pretty much all of the functions you'll need for your site's template and it's very easy to use once you get used to it. BTW, I tried testing out the cache system and it caused blank white pages for me, and when I removed the cache folder everything worked again. If you get it working, great and let me know how. But otherwise, I guess just don't make a folder named cache in your site's root. :)

Anyway, I hope this helps a few people. :)
please show me how to use template engine. Thanks

Re: phpBB Standalone Template Engine

Posted: Thu Jul 22, 2010 6:16 am
by imkingdavid
The wiki is a great resource for such matters. ;)

Re: phpBB Standalone Template Engine

Posted: Sun Nov 07, 2010 8:39 pm
by DreamCrafter
I tried creating this Template Engine but it doesn't work for me. Could someone help me out?

Re: phpBB Standalone Template Engine

Posted: Mon Nov 08, 2010 12:04 am
by tbackoff
What exactly didn't work?

Re: phpBB Standalone Template Engine

Posted: Mon Nov 08, 2010 2:09 am
by imkingdavid
All you have to do is download the files at the link and then include them into your script. Be sure to follow all of the steps in the first post of this topic, starting from the index.php example.

In any case, just saying it doesn't work doesn't make it any easier for us to help us. Can you please provide any errors or explain what exactly isn't working?

Re: phpBB Standalone Template Engine

Posted: Wed Nov 10, 2010 12:36 am
by DreamCrafter
The Template Engine doesn't seam to work when you use it with the $_GET Query function. It displays the previous page as well as the Queried Page is their a way to bypass it like the phpBB software does?

Re: phpBB Standalone Template Engine

Posted: Sun Dec 19, 2010 2:20 pm
by NguyTieuNhan
I have code:

Code: Select all

<?
error_reporting(E_ALL); 
require_once '../include/common.inc.php';
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Love Wall <?=$navtitle?> <?=$bbname?> <?=$seotitle?></title>
<style><!--@import url(images/style.css);--></style>
</head>
<body scroll=yes>
<div id="menu" >
<a href="../" target="_blank">
<img src="images/01.gif" width="27" height="17" /></a>
	<a href="index.php">Home</a> <img src="images/02.gif" width="16" height="16" /> <a href = "add.php" > G&#7917;i &#432;&#7899;c nguy&#7879;n </a> <img src="images/03.gif" width="16" height="16" /> <a href="list.php"> Xem danh s&#225;ch </a> <img src = "images/04.gif" width = "27" height = "18" /> <a href="http://hagiangpro.com" target="_blank"> &#272;&#7885;c b&#225;o </a> <img src = "images/05.gif "width ="15"height ="12"/> <a href="../index.php"> Quay l&#7841;i di&#7877;n &#273;&#224;n </a> <img src ="images/06.gif"width ="16" height = "16" /> <a href="http://hagiangpro.com/"> Tin t&#7913;c </a> </div>
<div id="main" style="width:900px;position:relative; height:500px">
<div style="display:none;" id="aspk" onclick="Hide();"></div>
<script type="text/javascript" src="inc/index.js"></script>
<?php 
$result=mysql_query("select * from cdb_qqlove order by id DESC"); 
$num=mysql_numrows($result); 
for ($i=0;$i<$num;$i++) { 
$id=mysql_result($result,$i,"id");
$class=mysql_result($result,$i,"class"); 
$images=mysql_result($result,$i,"images"); 
$head=mysql_result($result,$i,"head");
$sign=mysql_result($result,$i,"sign");
$lr=mysql_result($result,$i,"lr");
$date=mysql_result($result,$i,"date");
$cs=mysql_result($result,$i,"cs");
$top =rand(0,314);
$left=rand(0,660)
?>
<div id="Layer<?=$id?>" class="Face<?=$class?>" style="top:<?=$top?>px;left:<?=$left?>px;z-index:<?=$id?>" onMouseDown="Move(this,event)" onDblClick="Show(<?=$id?>)">
<p class="Num">L&#7901;i &#432;&#7899;c s&#7889;:<?=$id?><img src="images/close.gif" alt="&#272;&#243;ng" onClick="Close(<?=$id?>)" /></p><p class="Detail"><img alt="" src="images/icon<?=$images?>.gif" /><span class="Head"><?=$head?></span><br /><?=$lr?></p>
<table class="Sign" border="0" cellpadding="0" cellspacing="0">
  <tr>
    <td><div align="left"><a href="zf.php?id=<?=$id?>" title="&#7844;n &#273;&#7875; ch&#250;c cho l&#7901;i &#432;&#7899;c th&#224;nh s&#7921; th&#7853;t">&#272;&#227; &#273;&#432;&#7907;c ch&#250;c: <?=$cs?> l&#7847;n</a></div></td>
    <td><div align="right"><?=$sign?></div></td>
  </tr>
</table><p class="Date"><?=$date?></p></div>	
<?php
}
?>
</div>
<div id="footer">
<div class="footimg"></div><div class="bottom"><a href="index.php" title="Love Wall">Home</a> - 
<a href="add.php" title="Note">&#431;&#7899;c nguy&#7879;n</a> - 

	Powered by N</div></div>

</body></html>
<?
if(isset($_GET['id'])) {
echo "<script type=\"text/javascript\">Show(".$_GET['id'].");</script>";
}else {
}
?>
I use it to make phpbb mods
Them I Creat 2 files:
index.php:

Code: Select all

    <?php
    define('IN_PHPBB', true);
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();

	//start
$result=mysql_query("select * from phpbb_love order by id DESC"); 
$num=mysql_numrows($result); 
for ($i=0;$i<$num;$i++) { 
		$id=mysql_result($result,$i,"id");
		$class=mysql_result($result,$i,"class"); 
		$images=mysql_result($result,$i,"images"); 
		$head=mysql_result($result,$i,"head");
		$sign=mysql_result($result,$i,"sign");
		$lr=mysql_result($result,$i,"lr");
		$date=mysql_result($result,$i,"date");
		$cs=mysql_result($result,$i,"cs");
		$top =rand(0,314);
		$left=rand(0,660);	


}
if(isset($_GET['id'])) {
echo "<script type=\"text/javascript\">Show(".$_GET['id'].");</script>";
}else {
}
page_header('Love Wall');
$template->assign_vars(array(
	'ID'	=> $id,
	'CLASS'	=> $class,
	'TOP'	=> $top,
	'LEFT'	=> $left,
	'IMAGES'=> $images,
	'HEAD'	=> $head,
	'LR'	=> $lr,
	'SIGN'  => $sign,
	'DATE'	=> $date,
	'CS'	=> $cs,	
	

));
    $template->set_filenames(array(
        'body' => 'love/index_body.html')
    );

	page_footer();
    ?>
and index_body.html

Code: Select all

<!-- INCLUDE love/love_header.html -->


<div id="menu" >
<a href="../" target="_blank"><img src="{T_THEME_PATH}/love/images/01.gif" width="27" height="17" /></a>
<a href="index.php">Home</a> <img src="{T_THEME_PATH}/love/images/02.gif" width="16" height="16" /> 
<a href = "add.php" > G&#7917;i &#432;&#7899;c nguy&#7879;n </a> <img src="{T_THEME_PATH}/love/images/03.gif" width="16" height="16" /> 
<a href="list.php"> Xem danh s&#225;ch </a> <img src = "{T_THEME_PATH}/love/images/04.gif" width = "27" height = "18" />
 <a href="http://hagiangpro.com" target="_blank"> &#272;&#7885;c b&#225;o </a> <img src = "{T_THEME_PATH}/love/images/05.gif" width ="15"height ="12"/> 
 <a href="../index.php"> Quay l&#7841;i di&#7877;n &#273;&#224;n </a> <img src ="{T_THEME_PATH}/love/images/06.gif"width ="16" height = "16" /> 
 <a href="http://hagiangpro.com/"> Tin t&#7913;c </a> 
</div>
<div id="main" style="width:900px;position:relative; height:500px">
<div style="display:none;" id="aspk" onclick="Hide();"></div>
<script type="text/javascript" src="{T_THEME_PATH}/love/inc/index.js"></script>

	<div id="Layer{ID}" class="Face{CLASS}" style="top:{TOP}px;left:{LEFT}px;z-index:{ID}" onMouseDown="Move(this,event)" onDblClick="Show({ID})">
	<p class="Num">L&#7901;i &#432;&#7899;c s&#7889;:{ID}<img src="{T_THEME_PATH}/love/images/close.gif" alt="&#272;&#243;ng" onClick="Close({ID})" /></p>
	<p class="Detail"><img alt="" src="{T_THEME_PATH}/love/images/icon{IMAGES}.gif" />
	<span class="Head">{HEAD}</span>
	<br />{LR}
	</p>
	<table class="Sign" border="0" cellpadding="0" cellspacing="0">
	  <tr>
		<td><div align="left"><a href="zf.php?id={ID}" title="&#7844;n &#273;&#7875; ch&#250;c cho l&#7901;i &#432;&#7899;c th&#224;nh s&#7921; th&#7853;t">&#272;&#227; &#273;&#432;&#7907;c ch&#250;c: {CS} l&#7847;n</a></div></td>
		<td><div align="right">{SIGN}</div></td>
	  </tr>
	</table>
	<p class="Date">{DATE}</p>
	</div>	

</div>
<div id="footer">
<div class="footimg"></div><div class="bottom"><a href="index.php" title="Love Wall">Home</a> - 
<a href="add.php" title="Note">&#431;&#7899;c nguy&#7879;n</a> - 

	Powered by N</div></div>



<!-- INCLUDE love/love_footer.html -->
When I run index.php it have error

Code: Select all

[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4371: Cannot modify header information - headers already sent by (output started at /love/index.php:1)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4373: Cannot modify header information - headers already sent by (output started at /love/index.php:1)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4374: Cannot modify header information - headers already sent by (output started at /love/index.php:1)
[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4375: Cannot modify header information - headers already sent by (output started at /love/index.php:1)
Please help me to fix this.
Thanks for Support.

Re: phpBB Standalone Template Engine

Posted: Sat May 28, 2011 7:46 pm
by TheMadCat
imkingdavid wrote:All you have to do is download the files at the link and then include them into your script. Be sure to follow all of the steps in the first post of this topic, starting from the index.php example.

In any case, just saying it doesn't work doesn't make it any easier for us to help us. Can you please provide any errors or explain what exactly isn't working?

You still run into problems with phpbb 3.0.8 Standalone Template Engine.
For example caching. Look at where the global variable are and how they interact with the code.

Re: phpBB Standalone Template Engine

Posted: Sat May 28, 2011 8:32 pm
by TheMadCat
NguyTieuNhan wrote:I have code:....
(To long to quote)

Edit: Miss read his/her post. Correct replay.
Edit: I reading up on request_var(). Take a look about it. Its better way then doing $_GET['id'] part.

Code: Select all

<NO SPACE OR ANYTHING BEFORE><?php
// ^
// |
// NO.. this is the reason why getting "[phpBB Debug] PHP Notice: in file /includes/functions.php on line 4375: Cannot modify header information - headers already sent by (output started at /love/index.php:1)". Note the 1 for line 1.

	
    define('IN_PHPBB', true);
    $phpbb_root_path = (defined('PHPBB_ROOT_PATH')) ? PHPBB_ROOT_PATH : './../';
    $phpEx = substr(strrchr(__FILE__, '.'), 1);
    include($phpbb_root_path . 'common.' . $phpEx);

    // Start session management
    $user->session_begin();
    $auth->acl($user->data);
    $user->setup();

/*

Note: mysql_result function is slower than mysql_fetch_row(), mysql_fetch_array(), mysql_fetch_assoc() and mysql_fetch_object().
Note: mysql_result function should not be used together with mysql_fetch_row(), mysql_fetch_array(), mysql_fetch_assoc() or mysql_fetch_object().
~~http://www.w3schools.com/php/func_mysql_result.asp

Whats the point of this part? Your writing over data in ever loop. Are you trying to get the last row? 
If so then do this  "select ID, CLASS, IMEAGES, HEAD, SIGN, LR, DATE, CS from phpbb_love order by id ASC limit 1" 
(revese order and select top one to get the last one)

$result=mysql_query("select * from phpbb_love order by id DESC");
$num=mysql_numrows($result);
for ($i=0;$i < $num;$i++)
{
      $id=mysql_result($result,$i,"id");
      $class=mysql_result($result,$i,"class");
      $images=mysql_result($result,$i,"images");
      $head=mysql_result($result,$i,"head");
      $sign=mysql_result($result,$i,"sign");
      $lr=mysql_result($result,$i,"lr");
      $date=mysql_result($result,$i,"date");
      $cs=mysql_result($result,$i,"cs");
      $top =rand(0,314);
      $left=rand(0,660);
}
*/


$result=mysql_query("select ID, CLASS, IMEAGES, HEAD, SIGN, LR, DATE, CS from phpbb_love order by id ASC limit 1");
$num=mysql_numrows($result);		// Note: "The number of rows in a result set on success or FALSE on failure."
if($num !=== false && $num == 0)	// Identical ( === ): Checks if the left and right values are equal AND identical (same variable type)
{									// and check if there exsit a row.
									
	$row = mysql_fetch_assoc($result); // Get on row per call. Because of the "limit 1" there only one row.
	foreach($row as $key => $value)
	{
		// I can't recall if you cap the ID, CLASS, ETC will return as cap or not. I take it as no
		// So I take the $key and force it to be uppercase. I don't know how much time is lose in doing this.
		$template->assign_var(strtoupper ($key)  ,$value);
	}
	// Magic number are EVIL!!!!!!!!!!!!
	$template->assign_var('TOP', rand(0,314));
	$template->assign_var('LEFT', rand(0,660));
}

// I take it that id is number..   //is_numeric

if(isset($_GET['id']))	// I take that id is number
{
	// CLEAN ALL DATA - EVEN if its not for mysql. Even in this code. Also have default value or action if $_GET not sent.
	$_GET['id'] = trim($_GET['id']); // Remove spaces
	$idClean = is_numeric($_GET['id'])? $_GET['id']:0;	// 0 is the default action. 
	// NO! Use the templating engine to add this!
	echo "<script type=\"text/javascript\">Show(".$_GET['id'].");</script>";
}
else // What the point of this part? If none best to remove it. 
{

}

// BAD IDEA - Have it IN the Template. This method most likly getting html and sending it which is why your having problem 
page_header('Love Wall');

$template->set_filenames( array( 'body' => 'love/index_body.html') );

// BAD IDEA - Have it IN the Template. This method most likly getting html and sending it which is why your having problem 
page_footer();

?><NO SPACE AFTER>


Re: phpBB Standalone Template Engine

Posted: Wed Jun 29, 2011 6:07 pm
by samuelgozi
can anyone upload a demo so i can see how to make it work on the last version?
i tried all what you write here, but my web site just show a blank screen.
please upload a simple demo, it will help me a lot.

Re: phpBB Standalone Template Engine

Posted: Wed Jun 29, 2011 8:31 pm
by samuelgozi
If you want it to work with the files of phpBB 3.0.8 you will need to find:

Code: Select all

		$data = "<?php if (!defined('IN_PHPBB')) exit;" . ((strpos($data, '<?php') === 0) ? substr($data, 5) : ' ?>' . $data);
and remove it.

can some one told me how can i add my own classes?
i mean somthing like - {SOME_TEXT}.

Re: phpBB Standalone Template Engine

Posted: Thu Jul 07, 2011 6:05 pm
by doddsey_65
hi, i downloaded the code from pastebin and everything worked fine until i used block_vars. I used xxx.S_FIRST_ROW and got the following error:

Undefined index: S_FIRST_ROW

anyone know why this happens?

Re: phpBB Standalone Template Engine

Posted: Thu Dec 22, 2011 8:37 am
by indra
how to use it with phpbb 3.0.9 template core. i cant find you say to change.

please help me. i'm so interested with phpbb template system

Re: phpBB Standalone Template Engine

Posted: Tue Mar 13, 2012 4:57 pm
by Angel200
EDIT:
Get it to work i forget to delete the following in the template.php

Code: Select all

    if (!defined('IN_PHPBB'))
    {
        exit;
    }