Date: 07/22/00
- Next message: Ed Lazor: "Re: [phplib] active_session question"
- Previous message: Zakaria: "Re: [phplib] Conditional blocks"
- In reply to: Zakaria: "Re: [phplib] Conditional blocks"
- Next in thread: Zakaria: "Re: [phplib] Conditional blocks"
- Reply: Zakaria: "Re: [phplib] Conditional blocks"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
I know that in PHP 4 there is such a function, but I do not know exactly
what it is. Also, because the template scheme that I am proposing is
object-oriented, it would not be very difficult to get a string instead of
printing. However, printing with include() is more efficient.
You could just load the data out of the file using PHP's file API, and then
eval() the whole thing at a later date. This would not be too difficult.
It is possible that the error you describe is a result of PHP4 - I have not
yet tested EnzymeTemplates with PHP4. If you could uncomment some of the
DEBUG lines in ET, and send me that output, I would greatly appreciate it.
Eric
At 04:21 AM 7/22/00, Zakaria wrote:
>The problem with include() is they print the HTML right away not like template
>they let you print the HTML at later time or not to print it at all.
>
>If there is away to parse the php file and get the output in string
>I think that will be great and we could dump all those Template thing.
>
>Maybe some php function like this
>list($status, $header, $output) = execute("file.php");
>where :
> $status is the status of execute (there is error/not)
> $header is the header (if there is any)
> $output is the output
>
>BTW I just downloaded your EnzymeTemplate and try it out but I stuck
>in the following error:
>
>comment-demo/demo5.php3
>-----------------------
>Database error: Invalid SQL: SELECT DISTINCT cid FROM comment WHERE
>comment.pid = %s;
>MySQL Error: 1064 (You have an error in your SQL syntax near '%s;' at line 1)
>Session halted.
>
>orig-demo/demo1.php3
>--------------------
>Database error: Invalid SQL: SELECT DISTINCT * FROM user WHERE user.userid
>= %s;
>MySQL Error: 1064 (You have an error in your SQL syntax near '%s;' at line 1)
>Session halted.
>
>I use php 4.0.0 if it's matters.
>
>
>Eric Ries wrote:
> >
> > For those that are interested in this question, I happen to think that the
> > right thing to do is a hybrid of these approaches. PHP *is* a templating
> > language in the first place. Kristian once pointed this out to me, and we
> > discussed how funny it is to implemented a templating language within PHP.
> >
> > Therefore, I think the right thing to do is to use templates that are
> > actual PHP include files, and which can be include()ed at will. These
> > template files should not mix PHP and HTML, they should use a clean
> > template-like interface for fetching it. I have built a library that allows
> > you to do this in an object-oriented way. So, although you can have more
> > complex PHP if you want, usually you just do things like:
> >
> > <? $this->show( "foobar" ) ?>
> >
> > Since show() is a function call, you can have it do some basic logic and
> > text processing for you. Further, if you want, you can also do something
> > contsructs like this:
> >
> > <? if( $this->foo ): ?>
> > <? $this->show( "bar" ) ?>
> > <? endif; ?>
> >
> > I have built a relatively large site using this model, and I have found
> > that my HTML designers have had no trouble adapting. After all, to them the
> > <? ?> is just a normal-looking HTML tag. It even seems to work with GUI
> > editors like Dreamweaver.
> >
> > I call the package EnzymeTemplates, and you can find out more at
> > http://enzyme.sourceforge.net
> >
> > Sorry for the plug, hope you find it useful. I have been playing with
> > porting phpSlash to this system, but I'll save the announcement for the
> > appropriate list.
> >
> > Eric
>
>Wassallam,
>
>
>
>
>-- Zakaria
>
>PT. Asia Karsa Indah z4k4ri4 <email protected>
>Advanced Technologies z4k4ri4 <email protected>
>Jl. Raya Kalimalang 4B, Jakarta zakaria <email protected>
>Telp : (62-21) 8649318 http://www.asia-karsa.com
>Fax : (62-21) 8649316 http://linux.or.id/pemula
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: phplib-unsubscribe <email protected>
>For additional commands, e-mail: phplib-help <email protected>
---------------------------------------------------------------------
To unsubscribe, e-mail: phplib-unsubscribe <email protected>
For additional commands, e-mail: phplib-help <email protected>
- Next message: Ed Lazor: "Re: [phplib] active_session question"
- Previous message: Zakaria: "Re: [phplib] Conditional blocks"
- In reply to: Zakaria: "Re: [phplib] Conditional blocks"
- Next in thread: Zakaria: "Re: [phplib] Conditional blocks"
- Reply: Zakaria: "Re: [phplib] Conditional blocks"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

