[ciapug] Re: Templating System
Tony Bibbs
tony at tonybibbs.com
Fri Jun 24 14:42:27 CDT 2005
Where you getting hung up at? Not sure what you are trying to do but
I've used a lot of the PEAR packages (and even maintain a few)
--Tony
Mike Parks wrote:
> Working with X-Cart I am getting fairly familiar with using Smarty.
> Which X-Cart just released a new version 4.0.14 which they upgraded
> Smarty to Smarty-2.6.9
>
> I have also looked at PEAR, I have tried to read through Secure PHP
> Development published by Wiley written by Mohammed Kabir Mohammed writes
> the book using PEAR. I get to Chapter 4 and inevitably drop kick the
> book across the room. Maybe its the book but I get jammed up on
> something in chapter 4 that won't work every time.
>
> Any other PEAR books out there?
>
> Mike
>
>
>
> At 12:00 PM 6/24/05, you wrote:
>
>> Send ciapug mailing list submissions to
>> ciapug at cialug.org
>>
>> To subscribe or unsubscribe via the World Wide Web, visit
>> http://cialug.org/mailman/listinfo/ciapug
>> or, via email, send a message with subject or body 'help' to
>> ciapug-request at cialug.org
>>
>> You can reach the person managing the list at
>> ciapug-owner at cialug.org
>>
>> When replying, please edit your Subject line so it is more specific
>> than "Re: Contents of ciapug digest..."
>>
>>
>> Today's Topics:
>>
>> 1. Re: Templating System (Tony Bibbs)
>> 2. Re: special chars in urls (Cesar Mendoza)
>> 3. Re: Templating System (Dave J. Hala Jr.)
>> 4. Re: special chars in urls (Scott Phillips)
>>
>>
>> ----------------------------------------------------------------------
>>
>> Message: 1
>> Date: Fri, 24 Jun 2005 09:15:28 -0500
>> From: Tony Bibbs <tony at tonybibbs.com>
>> Subject: Re: [ciapug] Templating System
>> To: Jerry Weida <jweida at gmail.com>, ciapug at cialug.org
>> Message-ID: <42BC1580.6020908 at tonybibbs.com>
>> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>>
>> Not sure what you mean by "PEAR template system".
>>
>> PEAR has a number of template systems:
>>
>> 1) IT
>> 2) PHPLib
>> 3) Xipe
>> 4) Sigma
>> 5) Flexy
>>
>> See http://pear.php.net/packages.php?catpid=10&catname=HTML&pageID=2 for
>> more on each.
>>
>> Discussions on template engines can turn personal quickly so the thing
>> to remember is:
>>
>> 1) Use one only if you really need it
>>
>> I have a few system that require themeable sites and that along with the
>> tendency of putting too much PHP code in PHP-based templates has
>> prompted me to use Flexy which handcuffs how much logic you can put into
>> a template
>>
>> 2) If you use a template system, use one that compiles. The IT and
>> PHPLib ones are great examples of slow memory intensive templating
>> systems.
>>
>> Our group has decided on Flexy mainly because it supports
>> PEAR::Translation2 natively.
>>
>> Keep in mind I'm only offering guidelines and the logic I used to get
>> where I'm at now. I'd like to think I'm unbiased and could have arrived
>> at a different decision given different needs.
>>
>> --Tony
>>
>>
>>
>> Jerry Weida wrote:
>> > I think just about anyone will agree that the PEAR template system is
>> > lacking and sluggish at best.
>> >
>> > I favor the Smarty template system. It has always worked very well for
>> > me in the past and it allows you to choose the complexity of the
>> > tempaltes you write as it can handle some PHP in the template itself.
>> > The built in caching system makes it extremely fast as well.
>> >
>> > On 6/24/05, *Dave J. Hala Jr.* <dave at 58ghz.net <mailto:dave at 58ghz.net>>
>> > wrote:
>> >
>> > That's a good point. I'll buy that.
>> >
>> > However, if keep you it simple, you won't have that
>> vulnerability. I
>> > think that a "template" like the one below is fairly safe. The
>> Java
>> > script is couple of tools that format date/ssn & phone numbers
>> on the
>> > fly.
>> >
>> >
>> >
>> > <html>
>> > <head>
>> > <title> <? echo $title ?></title>
>> > <meta http-equiv="Content-Type" content="text/html; <meta
>> > http-equiv="Pragma" content="no-cache">
>> > <script language="JavaScript" src="/java/ssn-date-phn.js"
>> > type="text/javascript" ></script>
>> > <style type="text/css">@import
>> > "../css/main.css";</style>
>> > </head>
>> > <body bgcolor="#ffffff" >
>> > <? echo $page ?>
>> > </body>
>> > </html>
>> >
>> > On Fri, 2005-06-24 at 08:25, Tony Bibbs wrote:
>> > > This best sums up why PHP isn't such a good template engine:
>> > >
>> > >
>> >
>> http://www.akbkhome.com/blog.php/View/80/PHP+as+a+template+engine%2C+or+recipe+for+disaster%3F.html
>>
>> >
>> <http://www.akbkhome.com/blog.php/View/80/PHP+as+a+template+engine%2C+or+recipe+for+disaster%3F.html>
>>
>> > >
>> > > In short, you have to save developers from themeselves
>> sometimes.
>> > >
>> > > --Tony
>> > >
>> > > Dave J. Hala Jr. wrote:
>> > > > I was thinking about what Tim said the other day regarding
>> > "templating
>> > > > systems". I think the main point was: how is inserting a
>> <? echo
>> > > > $content ?> tag into an html document really any differant
>> > than if you
>> > > > just inserted some if/then logic etc.
>> > > >
>> > > > I agree with Tim, its more or less the same thing. For me, the
>> > problem
>> > > > that I was trying to solve two-fold:
>> > > >
>> > > > 1. Seperate the dynamically generated content from the static
>> > content,
>> > > > so that an end user (or graphic designer) could edit the html
>> > without
>> > > > mucking around in the php code.
>> > > > 2. Make it user to make changes to the CSS include files,
>> > thereby making
>> > > > it simple to effect system wide cosmetic changes in the both
>> > the html
>> > > > and the dynamically generated content.
>> > > >
>> > > > Tim did you have something else in mind?
>> > > >
>> > > > :) Dave
>> > > >
>> > > >
>> > > >
>> > > >
>> > > _______________________________________________
>> > > ciapug mailing list
>> > > ciapug at cialug.org <mailto:ciapug at cialug.org>
>> > > http://cialug.org/mailman/listinfo/ciapug
>> > --
>> >
>> > Open Source Information Systems (OSIS)
>> > Dave J. Hala Jr. <dave at osis.us <mailto:dave at osis.us>>
>> > 641.485.1606
>> >
>> > _______________________________________________
>> > ciapug mailing list
>> > ciapug at cialug.org <mailto:ciapug at cialug.org>
>> > http://cialug.org/mailman/listinfo/ciapug
>> >
>> >
>> >
>> >
>> ------------------------------------------------------------------------
>> >
>> > _______________________________________________
>> > ciapug mailing list
>> > ciapug at cialug.org
>> > http://cialug.org/mailman/listinfo/ciapug
>>
>>
>> ------------------------------
>>
>> Message: 2
>> Date: Fri, 24 Jun 2005 09:20:56 -0500
>> From: Cesar Mendoza <mendoza at kitiara.org>
>> Subject: Re: [ciapug] special chars in urls
>> To: ciapug at cialug.org
>> Message-ID: <20050624142056.GA20249 at tyka>
>> Content-Type: text/plain; charset=us-ascii
>>
>> Hi,
>>
>> There is another way to do it without any encoding at all using the
>> $PATH_INFO variable.
>>
>> The URL would look something like this:
>>
>> direct.php/http://www.foobar.com/blah.asp?id=5&action=poop
>>
>> use $QUERY_STRING to access the query.
>>
>> here is an example:
>>
>> ####### direct.php ######
>> <? echo("PATH_INFO = $PATH_INFO"); echo("
>> "); echo("QUERY_STRING = $QUERY_STRING"); ?>
>> ###########################
>>
>> After running direct.php/http://www.foobar.com/blah.asp?id=5&action=poop
>> you would get:
>> PATH_INFO = /http://www.foobar.com/blah.asp
>> QUERY_STRING = id=5&action=poop
>>
>> Just remove the first '/' on $PATH_INFO and you are set to go.
>>
>> Bye
>> Cesar Mendoza
>> http://www.kitiara.org
>> --
>> "The fate of all mankind I see
>> Is in the hands of fools."
>> --King Crimson, Epitaph
>>
>>
>> On Tue, Jun 21, 2005 at 10:36:43AM -0500, Scott Phillips wrote:
>> > I want to create a page (direct.php) that can take a url as a parameter
>> > like:
>> >
>> > direct.php?url=http://www.foobar.com/blah.asp?id=5&action=poop
>> >
>> > but the ? and & characters will cause problems, no? At first, I
>> thought
>> > passing the url parameter through htmlspecialchar() when creating
>> the link
>> > might work... until I actually thought about it. (Duh.) There
>> must be
>> > some other way to do it.
>> >
>> > Any suggestions?
>> >
>> >
>> > Scott Phillips
>> > Web Developer
>> > Cowles Library, Drake University
>> > (515) 271-2975
>> >
>> > _______________________________________________
>> > ciapug mailing list
>> > ciapug at cialug.org
>> > http://cialug.org/mailman/listinfo/ciapug
>>
>>
>>
>> ------------------------------
>>
>> Message: 3
>> Date: Fri, 24 Jun 2005 09:27:54 -0500
>> From: "Dave J. Hala Jr." <dave at 58ghz.net>
>> Subject: Re: [ciapug] Templating System
>> To: PHP List <ciapug at cialug.org>
>> Message-ID: <1119623274.27362.157.camel at dsl-69.marshallnet.com>
>> Content-Type: text/plain
>>
>> I wasn't trying to say that my dog is better than yours. I was just
>> trying to show that something very simple and basic could be an option.
>> If its something that would apply use it, or maybe it will help inspire
>> a better idea who knows... Just having a discussion with a number of
>> ideas thrown out on the table is always a good thing.
>>
>> Like I said, I was having lunch one day, I asked about spliting out
>> html, someone said something, the lightbulb went off, and this is what I
>> came up with... (is this an opening for jokes about how bright the bulb
>> is?)
>>
>> :) Dave
>>
>>
>>
>>
>>
>>
>> On Fri, 2005-06-24 at 09:15, Tony Bibbs wrote:
>> > Not sure what you mean by "PEAR template system".
>> >
>> > PEAR has a number of template systems:
>> >
>> > 1) IT
>> > 2) PHPLib
>> > 3) Xipe
>> > 4) Sigma
>> > 5) Flexy
>> >
>> > See http://pear.php.net/packages.php?catpid=10&catname=HTML&pageID=2
>> for
>> > more on each.
>> >
>> > Discussions on template engines can turn personal quickly so the thing
>> > to remember is:
>> >
>> > 1) Use one only if you really need it
>> >
>> > I have a few system that require themeable sites and that along with
>> the
>> > tendency of putting too much PHP code in PHP-based templates has
>> > prompted me to use Flexy which handcuffs how much logic you can put
>> into
>> > a template
>> >
>> > 2) If you use a template system, use one that compiles. The IT and
>> > PHPLib ones are great examples of slow memory intensive templating
>> systems.
>> >
>> > Our group has decided on Flexy mainly because it supports
>> > PEAR::Translation2 natively.
>> >
>> > Keep in mind I'm only offering guidelines and the logic I used to get
>> > where I'm at now. I'd like to think I'm unbiased and could have
>> arrived
>> > at a different decision given different needs.
>> >
>> > --Tony
>> >
>> >
>> >
>> > Jerry Weida wrote:
>> > > I think just about anyone will agree that the PEAR template system is
>> > > lacking and sluggish at best.
>> > >
>> > > I favor the Smarty template system. It has always worked very
>> well for
>> > > me in the past and it allows you to choose the complexity of the
>> > > tempaltes you write as it can handle some PHP in the template itself.
>> > > The built in caching system makes it extremely fast as well.
>> > >
>> > > On 6/24/05, *Dave J. Hala Jr.* <dave at 58ghz.net
>> <mailto:dave at 58ghz.net>>
>> > > wrote:
>> > >
>> > > That's a good point. I'll buy that.
>> > >
>> > > However, if keep you it simple, you won't have that
>> vulnerability. I
>> > > think that a "template" like the one below is fairly safe.
>> The Java
>> > > script is couple of tools that format date/ssn & phone numbers
>> on the
>> > > fly.
>> > >
>> > >
>> > >
>> > > <html>
>> > > <head>
>> > > <title> <? echo $title ?></title>
>> > > <meta http-equiv="Content-Type" content="text/html; <meta
>> > > http-equiv="Pragma" content="no-cache">
>> > > <script language="JavaScript" src="/java/ssn-date-phn.js"
>> > > type="text/javascript" ></script>
>> > > <style type="text/css">@import
>> > > "../css/main.css";</style>
>> > > </head>
>> > > <body bgcolor="#ffffff" >
>> > > <? echo $page ?>
>> > > </body>
>> > > </html>
>> > >
>> > > On Fri, 2005-06-24 at 08:25, Tony Bibbs wrote:
>> > > > This best sums up why PHP isn't such a good template engine:
>> > > >
>> > > >
>> > >
>> http://www.akbkhome.com/blog.php/View/80/PHP+as+a+template+engine%2C+or+recipe+for+disaster%3F.html
>>
>> > >
>> <http://www.akbkhome.com/blog.php/View/80/PHP+as+a+template+engine%2C+or+recipe+for+disaster%3F.html>
>>
>> > > >
>> > > > In short, you have to save developers from themeselves
>> sometimes.
>> > > >
>> > > > --Tony
>> > > >
>> > > > Dave J. Hala Jr. wrote:
>> > > > > I was thinking about what Tim said the other day regarding
>> > > "templating
>> > > > > systems". I think the main point was: how is inserting a
>> <? echo
>> > > > > $content ?> tag into an html document really any differant
>> > > than if you
>> > > > > just inserted some if/then logic etc.
>> > > > >
>> > > > > I agree with Tim, its more or less the same thing. For
>> me, the
>> > > problem
>> > > > > that I was trying to solve two-fold:
>> > > > >
>> > > > > 1. Seperate the dynamically generated content from the
>> static
>> > > content,
>> > > > > so that an end user (or graphic designer) could edit the
>> html
>> > > without
>> > > > > mucking around in the php code.
>> > > > > 2. Make it user to make changes to the CSS include files,
>> > > thereby making
>> > > > > it simple to effect system wide cosmetic changes in the both
>> > > the html
>> > > > > and the dynamically generated content.
>> > > > >
>> > > > > Tim did you have something else in mind?
>> > > > >
>> > > > > :) Dave
>> > > > >
>> > > > >
>> > > > >
>> > > > >
>> > > > _______________________________________________
>> > > > ciapug mailing list
>> > > > ciapug at cialug.org <mailto:ciapug at cialug.org>
>> > > > http://cialug.org/mailman/listinfo/ciapug
>> > > --
>> > >
>> > > Open Source Information Systems (OSIS)
>> > > Dave J. Hala Jr. <dave at osis.us <mailto:dave at osis.us>>
>> > > 641.485.1606
>> > >
>> > > _______________________________________________
>> > > ciapug mailing list
>> > > ciapug at cialug.org <mailto:ciapug at cialug.org>
>> > > http://cialug.org/mailman/listinfo/ciapug
>> > >
>> > >
>> > >
>> > >
>> ------------------------------------------------------------------------
>> > >
>> > > _______________________________________________
>> > > ciapug mailing list
>> > > ciapug at cialug.org
>> > > http://cialug.org/mailman/listinfo/ciapug
>> > _______________________________________________
>> > ciapug mailing list
>> > ciapug at cialug.org
>> > http://cialug.org/mailman/listinfo/ciapug
>> --
>>
>> Open Source Information Systems (OSIS)
>> Dave J. Hala Jr. <dave at osis.us>
>> 641.485.1606
>>
>>
>>
>> ------------------------------
>>
>> Message: 4
>> Date: Fri, 24 Jun 2005 09:32:23 -0500
>> From: Scott Phillips <scott.phillips at DRAKE.EDU>
>> Subject: Re: [ciapug] special chars in urls
>> To: ciapug at cialug.org
>> Message-ID: <5.2.0.9.0.20050624092626.027e0710 at mail.drake.edu>
>> Content-Type: text/plain; format=flowed; charset=us-ascii
>>
>> Whwah? That's a new one for me. I'll have to give it a try for
>> kicks. Reminds me of those blog permalinks done with the apache
>> mod_rewrite module.
>>
>>
>> At 09:20 AM 6/24/2005 -0500, you wrote:
>> >Hi,
>> >
>> >There is another way to do it without any encoding at all using the
>> >$PATH_INFO variable.
>> >
>> >The URL would look something like this:
>> >
>> >direct.php/http://www.foobar.com/blah.asp?id=5&action=poop
>> >
>> >use $QUERY_STRING to access the query.
>> >
>> >here is an example:
>> >
>> >####### direct.php ######
>> ><? echo("PATH_INFO = $PATH_INFO"); echo("
>> >"); echo("QUERY_STRING = $QUERY_STRING"); ?>
>> >###########################
>> >
>> >After running direct.php/http://www.foobar.com/blah.asp?id=5&action=poop
>> >you would get:
>> >PATH_INFO = /http://www.foobar.com/blah.asp
>> >QUERY_STRING = id=5&action=poop
>> >
>> >Just remove the first '/' on $PATH_INFO and you are set to go.
>> >
>> >Bye
>> >Cesar Mendoza
>> >http://www.kitiara.org
>> >--
>> >"The fate of all mankind I see
>> >Is in the hands of fools."
>> > --King Crimson, Epitaph
>> >
>> >
>> >On Tue, Jun 21, 2005 at 10:36:43AM -0500, Scott Phillips wrote:
>> > > I want to create a page (direct.php) that can take a url as a
>> parameter
>> > > like:
>> > >
>> > > direct.php?url=http://www.foobar.com/blah.asp?id=5&action=poop
>> > >
>> > > but the ? and & characters will cause problems, no? At first, I
>> thought
>> > > passing the url parameter through htmlspecialchar() when creating
>> the link
>> > > might work... until I actually thought about it. (Duh.) There
>> must be
>> > > some other way to do it.
>> > >
>> > > Any suggestions?
>> > >
>> > >
>> > > Scott Phillips
>> > > Web Developer
>> > > Cowles Library, Drake University
>> > > (515) 271-2975
>> > >
>> > > _______________________________________________
>> > > ciapug mailing list
>> > > ciapug at cialug.org
>> > > http://cialug.org/mailman/listinfo/ciapug
>> >
>> >_______________________________________________
>> >ciapug mailing list
>> >ciapug at cialug.org
>> >http://cialug.org/mailman/listinfo/ciapug
>>
>>
>>
>> ------------------------------
>>
>> _______________________________________________
>> ciapug mailing list
>> ciapug at cialug.org
>> http://cialug.org/mailman/listinfo/ciapug
>>
>>
>> End of ciapug Digest, Vol 2, Issue 19
>> *************************************
>
>
> <><><><><><><><><><><><><><><>
> Mike Parks
> Captain Jack Communications
> Email: techsupport at captainjack.com
> Phone: 515-964-8500
> _______________________________________________
> ciapug mailing list
> ciapug at cialug.org
> http://cialug.org/mailman/listinfo/ciapug
More information about the ciapug
mailing list