Jump to content

Recommended Posts

I have been coding jsp for work alot and they have a tag library, making jsp easier and cleaner.  An example of what I mean is for an if statement instead of going into the jsp makers <% %> and programming the if it is a <c:if test="${param}"></c:if>.  I've been looking for a tag library with php but havent found one, and my last shot was asking on this board.  Does anyone know anything about this as far as it being available or does anyone know if this is an in demand idea currently in development, or is just me wishfully thinking?

Link to comment
https://forums.phpfreaks.com/topic/74672-tag-library/
Share on other sites

To me, it sounds a little like Smarty o_o I mean, smarty shortens php coding with template management, but php itself is short. The if/else can be shortened in php:

 

($username != null ? $username : "Sorry, you didn't type in anything for your name." );

//equivalent

if($username != null){
echo $username;
} else {
echo "Sorry, you didn't type in anything for your name.";
}

Link to comment
https://forums.phpfreaks.com/topic/74672-tag-library/#findComment-377474
Share on other sites

Yes and no, doing it the traditional programming way takes a better programmer and probably encourages better habits, however it is also easier to read and maintain with tags, it keeps everything cleaner, in my opinion atleast.  Using jsp both ways, the tags seem to make everything easier to read and edit.

Link to comment
https://forums.phpfreaks.com/topic/74672-tag-library/#findComment-377488
Share on other sites

I do agree, about the if/else statements. I usually prefer writing it out with the { } and ( ) as it's "good practice".

 

You would have to understand that functions are pretty much shortened PHP codes for certain things.

 

I do belive Smarty is somewhat along the lines of what you're looking for.

Link to comment
https://forums.phpfreaks.com/topic/74672-tag-library/#findComment-377490
Share on other sites

  • 1 year later...

Hi,

 

I use this tag library for my own startup hacking and professional PHP

gigs, so you may find it useful.

 

Basically it mimics the style of nice approaches Ive seen in plt

scheme and arc lisp - highly nested, self closing tags, build up

structures, easy droplists etc..

 

Article here - http://quantblog.wordpress.com/2009/10/01/xilla_tags-php-library-make-html-with-lispy-php-code/

Download here -  http://code.google.com/p/xillatags/downloads/list

 

Basically to make a table you go like this -

 

 

table("",

  tr("", array(

    td("", "item one"),

    td("", "item two"))));

 

 

BSD licence, enjoy,

 

gord

webxilla.com

Link to comment
https://forums.phpfreaks.com/topic/74672-tag-library/#findComment-931043
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.