Problems with instantiation

2 views
Skip to first unread message

John O.

unread,
Jan 24, 2010, 5:51:36 PM1/24/10
to php-outline
Thi is in regard to the issue I created here:
http://code.google.com/p/php-outline/issues/detail?id=5&can=1&colspec=ID%20Type%20Status%20Priority%20Owner%20Summary

I have the tags set to "{{" and "}}" by default in the engine.php
file.
Even when I try to create an instance of outline with the code you
suggested, I still get an error message.

Fatal error: Uncaught exception 'OutlineException' with message 'error
compiling template './templates/_header.tpl.html', line 170 -
OutlineCompiler::parse() : unrecognized tag: * {{if $templatename ==
'set'' in D:\AppServ\www\outline\class\engine.php:109 Stack trace: #0
D:\AppServ\www\outline\class\engine.php(176): OutlineEngine->build('./
templates/_he...', 'D:\AppServ\www\...', NULL) #1 D:\AppServ\www
\outline\test\compiled\tpl\page.tpl.php(1): Outline->__construct
('_header') #2 D:\AppServ\www\outline\class\tpl.php(160): require('D:
\AppServ\www\...') #3 D:\AppServ\www\website\webroot\page.html(36):
OutlineTpl->display() #4 {main} thrown in D:\AppServ\www\outline\class
\engine.php on line 109

Line 170 in _header.tpl.html simply is this:
{{if $templatename == 'set'}}
with templatename being defined in the script:
$templatename = "page";

mindplay.dk

unread,
Jan 26, 2010, 11:04:44 PM1/26/10
to php-outline
Did a quick test, and it worked fine - maybe you only configured the
open/close tags? There are a few other tags to configure:

"bracket_open" => '{{',
"bracket_close" => '}}',
"bracket_comment" => '{{*',
"bracket_end_comment" => '*}}',
"bracket_ignore" => '{{ignore}}',
"bracket_end_ignore" => '{{/ignore}}',

There are technical as well as practical reasons why the comment and
ignore tags are configured separately - but it might have been more
logical to have these be optional, and if not configured, have them
default to using the same brackets?

On Jan 24, 5:51 pm, "John O." <oppenlaen...@gmail.com> wrote:
> Thi is in regard to the issue I created here:http://code.google.com/p/php-outline/issues/detail?id=5&can=1&colspec...

mindplay.dk

unread,
Jan 26, 2010, 11:14:16 PM1/26/10
to php-outline

John O.

unread,
Jan 28, 2010, 5:26:11 AM1/28/10
to php-outline
On 27 Jan., 05:04, "mindplay.dk" <ras...@mindplay.dk> wrote:
> Did a quick test, and it worked fine

Hmm, that's weird.
I have all the tags set to use double brackets in the engine.php file.

This is how I call the Outline instance:
$tpl = new TxOutline($templatename,10,'./templates');

And this is the class:
require_once "../../outline/config.dist.php";
require_once OUTLINE_CLASS_PATH."/tpl.php";

header("Content-type: text/html; charset=iso-8859-1");

class TxOutline extends OutlineTpl
{
public $tpl;

public function __construct ($templatename,$cache_time = 10,$root =
'./templates')
{

parent::__construct('tpl:'.$templatename, array(
"cache_time" => $cache_time,


"bracket_open" => '{{',
"bracket_close" => '}}',

"roots" => array(
"tpl" => $root
)
));

}

public function __destruct ()
{
}
}

If I remove the bracket_open and bracket_close from this class, the
title tag in a template is not recognized:
{{$title}}
If I use the above class as it is, I get an error at a tag that is
below the title tag:
Here is the code in the template:
{{*
{{if $templatename == 'main'}}
<!-- jQuery lightBox plugin -->
<script type="text/javascript" src="/js/
jquery.lightbox-0.5.min.js"></script>
<link rel="stylesheet" type="text/css" href="/img/lightbox/
jquery.lightbox-0.5.css" media="screen" />
{{/if}}
*}}

I fixed it temporarily by adding also the comment bracket definition
to the TxOutline class:
parent::__construct('tpl:'.$templatename, array(
"cache_time" => $cache_time,


"bracket_open" => '{{',
"bracket_close" => '}}',
"bracket_comment" => '{{*',
"bracket_end_comment" => '*}}',

"roots" => array(
"tpl" => $root
)
));

What I don't understand is: why do I have to configure the tags twice?
It should be enough to configure them in engine.php. Why does outline
throw an error message when I do not declare any double brackets in
the class?
Is this because of the two ways of using outline? Is engine.php not
used by the OutlineTpl class?

Also, I now get red info messages in the output. Seems to be debugging
output. Why is it showing when I instantiate the object, but not
showing when I use outline the way you suggest it on the google code
page? And how do I turn it off?

mindplay.dk

unread,
Jan 29, 2010, 12:49:07 PM1/29/10
to php-outline
OutlineTpl uses the engine, yes - all it does with the configuration,
is pass it up to the engine instance.

I'm not sure what else you're doing or what might be causing this.

I recommend you take a look at the source code to understand it better
and see how you can get it to integrate with your extensions.

Reply all
Reply to author
Forward
0 new messages