RE: [phplib] Using Template class - How do I include another PHP script? From: Rogers, Paul (Paul.Rogers <email protected>)
Date: 04/19/01

Nathan

Thanks for the reply. I've tried what you suggested as follows:

In my main script I've added:

include ('database.php'); <- second script file
set_var(array(
          "someothervar" => "some other text",
          "SOMETABLE", $table->show_result()));

and included the {SOMETABLE} in a cell of the table in index.ihtml (about
three quarters of the way down the page)

However when the script runs the database output is the first thing which
appears on the page and no output appaers where I've asked it to :o(

I think maybe I have two problems:

1) The show_result() function outputs directly to the browser at the point
at which it's called.

2) The function doesn't actually return anything (not sure about this)?

3) do I need to set some of the variables from the second script ie $table &
$db to global so they are available in the first script?

I would be grateful for any further input that you or others might have.

Many thanks

Paul

-----Original Message-----
From: nathan r. hruby [mailto:nhruby <email protected>]
Sent: 19 April 2001 13:25
To: Rogers, Paul; 'phplib'
Subject: Re: [phplib] Using Template class - How do I include another
PHP script?

on 4/19/01 6:43 AM, Rogers, Paul at Paul.Rogers <email protected> wrote:

>
> Can I use require/include to run the second script and then use the table
> show_result() to place the output in a variable which can then be parsed
by
> the first script?
>

Yes any output from anything (so long as it's text) can be inserted into a
template variable and parsed accordingly.

$tpl->set_var("SOMETABLE", $table->show_result());

-n

-- 
......
nathan hruby - nhruby <email protected>
computer support specialist
department of drama and theatre
http://www.drama.uga.edu/
......

--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>

***************************************************************************** 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. *****************************************************************************

--------------------------------------------------------------------- To unsubscribe, e-mail: phplib-unsubscribe <email protected> For additional commands, e-mail: phplib-help <email protected>