php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #11844 It would be nice to have tags in PHP just like JSP tags.
Submitted: 2001-07-02 14:54 UTC Modified: 2001-10-02 11:27 UTC
From: aaronshaf at yahoo dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 4.0.6 OS: Win 2000
Private report: No CVE-ID: None

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-02 14:55 UTC] derick@php.net
What are JSP tags?
 [2001-10-02 04:19 UTC] sander@php.net
No feedback -> closing
 [2001-10-02 10:51 UTC] aaronshaf at yahoo dot com
There is a good tutorial on JSP tags are at http://java.sun.com/products/jsp/tutorial/TagLibrariesTOC.html.

To give you an idea, let's say I wanted PHP to automatically generate code (defined through tag library) for a menu:

<webskin:menu title="Clothing">
   <webskin:menuItem title="Shirts" url="shirts.php"/>
   <webskin:menuItem title="Pants" url="pants.php"/>
   <webskin:menuItem title="Socks" url="socks.php"/>
</webskin:menu>
 [2001-10-02 10:58 UTC] rasmus@php.net
So make yourself a function and call it.  This isn't going to happen in PHP.
 [2001-10-02 11:03 UTC] aaronshaf at yahoo dot com
The purpose of the tag libraries is to appropriately call the functions. One of the advantages is nested tags. Code would look a lot cleaner as well.
 [2001-10-02 11:27 UTC] rasmus@php.net
It is syntactical candy that would slow down the parser by a huge amount.
You can do exactly the same thing with less typing like this:
<?$webskin->menu('Clothing')?>
   <?$webskin->menuItem('Shirts','shirts.php')?>
   <?$webskin->menuItem('Pants','pants.php')?>
   <?$webskin->menuItem('Socks','socks.php')?>
<?$webskin->endmenu()?>

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 00:01:28 2024 UTC