RE: [Phplib-users] Using more than one template instance on a sin gle page
Brought to you by:
nhruby,
richardarcher
|
From: Rogers, P. <Pau...@mo...> - 2002-12-18 14:04:16
|
Dear All
Sorry, I'm still having problems with this. When I run the script I just
get the word Array at the point where the content_Output book mark is. If I
print_r($templ->get_vars("main_Output") after "$templ->parse("main_Output",
"content");" it seems to contain everything. Any ideas what I'm doing wrong?
The complete script is below. pagemaker extends template.
Many thanks
Paul
<?php //test_pagemaker.php
/* This part creates the generic page layout */
//create our pagemaker
include("mlm_pagemaker.inc");
$temp_header = true;
$page = new pagemaker ($temp_header);
/* This part creates any buttons */
// create buttons
$temp_array = array(array("text" => "Quality Management Systems for:",
"type" => "nodrop"),
array("link" => "http://some/link/", "alt" => "MCE
QMS", "target" => "_blank", "text" => "Mowlem Civil Engineering", "type" =>
"go"),
array("link" => "http://some/other/link/", "alt" =>
"MCE QMS", "text" => "Northern Civil Engineering", "type" => "go"));
$page->create_buttons($temp_array);
/* This section produces the output for the content */
# create Template instance called $templ
$templ = new
Mowlem_Template("/usr/local/apache/htdocs/test/qa_dept/templates");
$templ->set_file(array(
"content" => "index.ihtml"));
# define the variables
$templ->set_var(array(
"Count" => "3,000,000",
"Div" => "Fred",
"Division" => "Fred's Division"));
#parse templ
$templ->parse("main_Output", "content");
/* This part tidies everything up and outpts the page */
# define the variables PHP_SELF & Title
$page->set_var(array(
"PHP_SELF" => $PHP_SELF,
"TITLE" => "MIS Pagemaker Test Page",
"content_Output" =>
$templ->get_vars("main_Output")));
// print_r($templ->get_vars("main_Output"));
$page->complete();
The page complete function is as follows:
$this->parse("header_Output", "header");
// build contentOutput...
$this->parse("main_Output", "main");
// finish all Output and print it.
$this->p("main_Output");
?>
-----Original Message-----
From: Layne Weathers [mailto:la...@if...]
Sent: 17 December 2002 22:09
To: 'Rogers, Paul'; 'Phplib-Users (E-mail)'
Subject: RE: [Phplib-users] Using more than one template instance on a
single page
> I am trying to separate some logic in an application. The easiest way
> seem sto be to use two template instance with two separate roots (I've
> also considered using one template instance and setting the root part
> way thru).
<snip>
> Having done this how do I then combine the content of the two instances
> using parse and print? Can I use get_vars?
Yes.
$page->set_var("content", $content->get_var("content"));
$page->pparse("out", "page");
Layne Weathers
Ifworld Inc.
*****************************************************************************
This email and any attachments transmitted with it are confidential
and intended solely for the use of the individual or entity to whom
they are addressed. If you have received this email in error please
notify the sender and do not store, copy or disclose the content
to any other person.
It is the responsibility of the recipient to ensure that opening this
message and/or any of its attachments will not adversely affect
its systems. No responsibility is accepted by the Company.
*****************************************************************************
|