|
Posted by phpdevkit on 12/31/06 19:03
Hi Ric, thanks for the excellent comments, see below...
Ric wrote:
> If I'd use a kit like this one, I would prefer an overloaded function
for link(), that accepts $css as parameter, if given it sets the
class="" if not don't set it
Good idea, and certainly doable. I wanted to keep the HTML objects
(the content) separate from the presentation and also standardize the
way all content is linked to $css objects via the link2css() method.
(If you know how to do it with one HTML object you know how to do it
for all of them.)
The link object is, first of all, a link. It's presentation can be
optionally altered by linking it to a $css object. Also, I could not
figure out how to standardize constructor signatures since all the HTML
objects require different initial values depending on their purpose.
The link, for example, can optionally take a label and an href, a
button a label, a. I also wanted to minimized the number of
parameters. The list_definition class can take an optional 1 or 2 css
objects, each one controlling a different aspect (i.e., one for the
term, another for the description).
// create one of the dozen HTML objects derived from
// class_attributes, like this link class
$kitlink = new link( "View Kit Demo" , "http://www.fotocar.com.mx/kit"
) ;
// link it to the css object above and output
$kitlink->link2css( $css ) ;
$kitlink->output() ;
>> why an extra output for a simple element, I would understand it, for
>> tables where you add rows like:
It has an OUTPUT_NOW optional parameter for the constructor and as long
as you have given it the minimum information needed to actually be a
link (the label and href) then you may create a link with one
statement. But, just in case you need to set additional parameters
like the target or name or id before outputing, you would wait and use
the output() method when ready.
The Kit's link object can take about 30 different attributes. I didn't
want the constructor to look like this... new link( $name , $id,
$label , $href, $target, $onblur, $onfocus, $class, $outputnow=false
......)
> Asynchronous construction
>
> I don't think the word asynchronous is suitable in this context
It solved one of my personal nuisances when building a page by letting
me output tweaked/customized CSS settings only when the page was ready
and by collecting all the pieces (html, title, script, style, head,
body) in the right order.
> Please visit the demo at http://www.fotocar.com.mx/kit. Meanwhile,
> here are some of the features. I guarantee you will find the kit
> helpful and a very real time-saver.
>> This may be true for simple sites, but may work against you in case of
>> complex sites with a complex design, an html template system is usually
>> better for that.
It is, of course, a personal preference. I find the very advantages OO
was designed to provide (code re-use/sharing, reduced complexity,
extensibility, overriding, additional/modified behavior) my preference.
>
> >
> > Cascading Style Sheets -- The Kit supports CSS Levels 1 and 2 and
> > generates clean, formatted styles directly into the web page. Both
>
> That is a performance problem, if you use a specific file for css or js
> the browser will be able to cache it and load it only once. If you put
> the css code inside the page, the browser has to load it everytime.
I worried about that too but 1) I found no problems with performance,
in fact, I have been surprised at how transparent it all seems. Maybe
I am running on a super fast Apache server but some informal testing
showed the kit pages loading no slower than a equally sized html page
already built (and I am often on a less-than-speedy connection and
computer). 2) If anything, you can tweak a css object then save it
into a permanent external css page and reference it using the page
object's setcssfilename() method.
> > external and internal style sheets and inline styles are supported.
> > Using CSS has never been easier with 39 CSS-related classes doing most
> > of the work for you.
> >
> > Compression -- The page object queries the user's web browser and, if
> > supported, compresses the entire page before sending it. Typical
> > ratios range from 20:1 to 30:1, dramatically improving perceived
> > bandwidth, especially with larger pages.
>
> Usually this is automatically done by the webserver, if properly
> configured:-)
>
> >
> >
> > Source Code Included -- The Kit includes over 14,000 lines of tested,
> > stable and extensible code.
>
> That has to be proven
Absolutely true for any software. I had two peers contribute and test
things. I fixed any problems they found. I am happy to make my kit
available for review to a couple more volunteers.
Ric, thanks for the remarks. I enjoy the academic exercise. I know
there are always better ways of doing things. Thanks.
Navigation:
[Reply to this message]
|