Re: [Nolug] PHP help

From: Jess Planck <>
Date: Fri, 18 Apr 2008 10:56:45 -0500
Message-Id: <>

HA! Joey had throw PERL!

Here's a simple example:

/// put in file include.php
function spiffy_html( $text = '' ) {
     echo '<p class="nobody" id="nothing">';
     echo $text;
     echo '</p>';

// put in file application.php
<?php include( 'include.php' ); ?>
<?php spiffy_html(); ?>

So right there you have separated SOME of your HTML/UI with your php
code. This example is very short, so it can be done a heck of a lot
better. The thing is in many cases you can get further thinking about
PHP as a template system itself. It can reduce complexity since in
most cases with Smarty and Flexy you will be working with the PHP API
and then working with an additional Template System API that is
typically not interchangeable. If you are thinking about template
systems because of caching features then in the above case you should
be looking toward memcache and others.

Also always remember just because you use "include( blah.php )"
doesn't mean that blah.php has to have any real PHP code. It could be
"include( blah.html )" for just sticking in HTML stuff.

For Petri..

Smarty Code: {function_name name1="some value" name2="some other value"}

  is really no more difficult to understand than

PHP Code: <?php function_name( 'some value', 'some other value' ) ?>

I think Joomla, Drupal and WordPress follow the PHP as template engine
system, so you can look to those complex applications for inspiration.


[ :P ] jess planck -

On Apr 18, 2008, at 9:22 AM, Joey Kelly wrote:
> Pipeline vs. callback:

Nolug mailing list
Received on 04/18/08

This archive was generated by hypermail 2.2.0 : 12/19/08 EST