By: cow
Date: 2004-08-07
Time: 18:05
|
MergeBlock before LoadTemplate
Hi!
I try to call merge block before loadTemplate (I process the query before I set the content. but if Load merge before I set content variable, example);
...
require_once("process.php"); // Here call mergeBlocks, and set content depend about input variables...
$engine->LoadTemplate("core.html");
$engine->Show();
...
because if I do this, the Block's not evaulated.
Any idea?
(Cow)
|
By: Skrol29
Date: 2004-08-07
Time: 18:17
|
Re: MergeBlock before LoadTemplate
Hi,
You can't merge data with a non yet defined block, anyway.
Why do uoi need to open the query before to load the template ?
If it's because of sub-template, you can merge them using [tbs_include.onshow] or simply using simple fields merged with MergeField().
|
By: cow
Date: 2004-08-07
Time: 18:30
|
Re: MergeBlock before LoadTemplate
Ok look. example.
---------------------
1 version:
$engine=new clsTinyButStrong;
$engine->loadTemplate("core.html");
process(); //Here set the content variable and the merge blocks...
$engine->Show()
core.html
<html><body>[tbs_include.onshow;file=var.content;htmlconv=no]</body></html>
examlple content.html
<table><tr><td>[blk.name;block=tr]</td></tr></table>
Result: content.html merged, but not the block not evaulated.
-------------
version 2.
$engine=new clsTinyButStrong;
process(); //Here set the content variable and the merge blocks...
$engine->loadTemplate("core.html");
$engine->Show()
core.html
<html><body>[tbs_include.onload;file=var.content;htmlconv=no]</body></html>
example content.html not modifyed
result: content block not evaulated.
-----------
Any idea?
Cow
|
By: Skrol29
Date: 2004-08-07
Time: 20:40
|
Re: MergeBlock before LoadTemplate
core.html:
<html><body>[myinclude;file=[val]]</body></html> |
content.html:
<table><tr><td>[blk.name;block=tr]</td></tr></table> |
PHP:
$engine=new clsTinyButStrong;
$engine->loadTemplate("core.html");
process(); //Here set the content variable and the merge blocks...
$engine->MergeField('myinclude',$content);
$engine->Show();
|
|
By: cow
Date: 2004-08-07
Time: 21:08
|
Re: MergeBlock before LoadTemplate
core.html:
<html><body>[content_include;file=[val]]</body></html>
|
content.html:
<table width="100%" cellpadding=3 cellspacing=0 bgcolor="silver">
<tr>
<td><a href="?event=modify">[list_block.id;block=tr]</a></td>
</tr>
</table>
|
index.php:
$engine=new clsTinyButStrong;
$engine->loadTemplate("core.html");
$array=array(
1=>array("name"=>"asd"),
2=>array("name"=>"bsd")
);
$engine->MergeBlock('list_block',$array);
$content="content.html";
$engine->MergeField("content_include","content/".$content);
$engine->Show();
|
Result is:
[list_block.name;block=tr]
|
By: Skrol29
Date: 2004-08-07
Time: 21:46
|
Re: MergeBlock before LoadTemplate
MergeField() must be called before MergeBlock().
It is MergeField() that process the sub-template tag.
My PHP snippet was not correct, because you process() function defines the sub-template name and then merges the block. But it has to performe the sub-template tag between thos two actions.
Example:
$engine=new clsTinyButStrong;
$engine->loadTemplate("core.html");
$content="content.html";
$engine->MergeField("content_include","content/".$content);
$array=array(
1=>array("name"=>"asd"),
2=>array("name"=>"bsd")
);
$engine->MergeBlock('list_block',$array);
$engine->Show();
|
|
By: cow
Date: 2004-08-08
Time: 12:40
|
Re: MergeBlock before LoadTemplate
thnx
|
|
Posting in progress.
Please wait...
|