10 Jun 2004

A Vision for PEAR

Having been involved with PEAR for quite a while, and a member of the much critisised PEAR group. I have to admit I was really impressed with Hans Lellieds comments today. The pear-dev mailing list has evolved over time to occasionally become a very intellectual conversation location.

We are all very invovled in the disucussion, is adding another template engine to PEAR a good idea?... All of the current engines are very much branded, IT, ITX, PHPlib, Sigma, Xipe, Flexy. To a certain degree, many of them provide the same functionality.

An ideal goal would be the provision of a core engine, that provided the features of all of them, yet had the overhead of none of them. Of course I have a biased viewpoint, having written one of them, but I would be extremely happy to depreciate Flexy, in favour of a neutral core API .

As an asside to this, the question should the PEAR group veto Savant?, two of the members have voted -1 on it, and Hans's excelently written email infers that there is something wonderfully great about a benovolant dictatorship. I've still mixed feelings on this. This overwhelming veto power should not be used without serious consideration of the concequences, and adding yet another template engine to PEAR, while not exactly desirable, may not be up to the barrier of justifying the use of the veto.

Posted by Alan Knowles in PEAR | Add / View Comments()

17 Apr 2004

Flexy - What smarty should have been?

Interesting to John's blog mention smarty and his trials and tribulations trying to implent transparent mulitlingual web sites.

It was always part of Flexy's goal to solve the Mulitlingual problem, It already had the ability
  • to parse the sentences (blocks of words) out of a template, and serialize it to a file - and when building the 'PHP' version of the template it would do one for each language - passing each of those through gettext.
  • to pick a source template based on the locale setting (eg. - you specify welcome.html - with locale=fr, you end up with compiled into php.

Well that was all 'theoretically' very good, but I'd never had chance to put it into a live site.. That changed this week (and so did alot of the code in CVS!)

Other than the basic ability to support parsing the words out of the template, (properly as Flexy is a full HTML parser). I added
  • Backend support for
  • User defined translation blocks (UDTB)
    • For blocks that include HTML and flexytags - that the autoparser cant pick up, or you want to use 'placeholders' that are a bit more verbose.
    • These blocks are translated/replaced, prior to Tag tokenizing (so the translation can include tags - variable markers or HTML)
Posted by Alan Knowles in PEAR | Add / View Comments()

22 Feb 2004

Eating your own dogfood....

My main development server is softlinked to hell with the pear (and pear compatible) packages I maintain. This has one great advantage, that you tend to get the maximum testing possible...

This week picked up a few rather nasty bugs.
DataObjects - Dates, Having added a smart way to read/write date values, I missed the slight problem that pear's Date package doesnt accept dates in the format 1940-01-31, it needs the time at the end!

Flexy - this was a bit more problematic. I was putting an image on a page, and wrapping it with a <A tag, but for some reason on the compliled template, the link was being closed before the <img tag, and the image button never worked...
It turned out that My masterpiece of tree building for the HTML document (a 2 phase process of first matching start and end tags, using seperate stacks for each tag type, then tree building by stepping through and recursively looking for open to close.... ) had forgotten that when a phase 1 stack was empty, I should wipe the element off the stack (as well as reseting the stack counter..)

Ah well - bugs are great things..

I'm still halfway through writing an article on XML parsing with XML_Tree_Morph - kind of wonder if it takes so long to write the article, then it's not simple enough.. - mind you XML parsing is always hard to explain...

Posted by Alan Knowles in PEAR | Add / View Comments()

14 Dec 2003


As part of the Membership Billing system I'm working on the client had a requirement for
  • some nice mailing envelopes
  • a very pretty bill to be sent out to the members.
Read on to see how I ended up using sodipodi, and producing sexy PDF's using SVG templating.

Posted by Alan Knowles in PEAR | Add / View Comments()

12 Oct 2003

HTML_Template_Flexy updates

demian from PHPkitchen uses my template engine in his framework (hehe we all have one of those..) anyway - he was upgrading from the original early version to the current CVS one. Which has a tokenizer and is a 2 part parser/compiling system.. (pretty awesome really)

Two of the things problems he found where
a) includes
Includes in the old engine used {include:#xxxx.html#}, I disabled this for numerous reasons in the new engine, but have been tempted into bringing it back. The current thought on it is this:
<flexy:include src="xxx.html" />

of course if you really want to get clever with it you can do things like

<flexy:include src="xxx.html"><B>xxx.html goes here</b></flexy:include>

which will display
xxx.html goes here whey you edit the template in a WYSIWG editor - and disappears when compiled..

b) javascript and scripts.
You can not use flexy tags {varname} in javascript blocks surrounded by <script></script>, as the whole thing gets too messy with it accidentally replacing stuff it shouldnt..
So if you need to send variables to javascript you can use
<flexy:toJavascript flexy:prefix="xxxxx_"
this is turned into php code that converts $object->xyz into xxxxx_abc in javascript
eg. in php
$this->xyz = 1234;
$this->wxy = "hello"

using the above tags - it ends up at the browser as
<script language="javascript">
var abc = 1234;
var bcd="hello";

Extend me!

Both of these are contained in the HTML_Template_Flexy_Compiler_Standard_Flexy class. The idea of this directory is clever - if you want to create your own namespace tags: eg. <mytag:test xxx="tttt"> all you need to do is create a file in the Standard folder called Mytag.php and implement testToString() method.

Posted by Alan Knowles in PEAR | Add / View Comments()

28 Jun 2002

Lots of free time = lots of tools

Well it's been a quiet few weeks - not much comming in on the work side, so I've been building up the resources for the next projects. These started with the PEAR Installer GTK version, point and clicky selection of standard PHP libraries, and maybe in the future applications. This ended up including one of my favourite pet ideas a HTML browser in pure PHP, it wouks quite well - renders this page (although no images yet).. After that I thought I'd better start adding some usefull stuff to pear, so db_oo got converted into DB_DataObject, and commited into PEAR's cvs, at the same time I also started packaging up some of the other usefull tools Flexy_Template, which can be found as a package on the new site, and the HTML_DataObject_FlexyForms which uses both classes to build a instant templated database interface application, that you can the go off and use as a the basis for any database driven site. To make all this happen it was essential to get a grip of some of those PEAR classes - so PHP_CodeDoc was born to try and answer the problem that most phpdoc output was totally pointless, and souce code on web pages was too difficult to read... - it's basically the best of phpdoc + lxr.. Meanwhile vendingIT (GSM + Vending) continues to move forward - They issued a press release about the cool stuff I was doing with SMS and wireless modems
Posted by Alan Knowles in PEAR | Add / View Comments()

28 Apr 2002

More crazy ideas - a php framework

I spent the weekend begining to build the notes on my php framework - the idea being to build a rough documentation, and sample code to base any generic framework from - kind of like the starter kit for frameworks.. - there are a few of these out there, but chances are that only some of each one fits the bill for any particular project. Ideally a central resouce of knoweldge of the parts available would help me (and maybe somebody else) to build a project quicker and easier..

Lets see how far this one gets. - Its all based around the page mapper, db_oo and templating at present, but the ideas and concepts have come out of over 4 years of making many mistakes!
Posted by Alan Knowles in PEAR | Add / View Comments()
« prev page    (Page 3 of 3, totalling 27 entries)   

Follow us on