Jump to content

[Template System] customs tags?


Strike X

Recommended Posts

Is there any template system allow you to create customs tags?

 

For example:

 

For example, this creates a macro variable that prints a big  "Hello Joe!'':

<#macro greet person>
  <font size="+2">Hello ${person}!</font>
</#macro>   

 

 

and then you can use this macro as:

	
<@greet person="Fred"/> and <@greet person="Batman"/>

 

Output, This will print on the browser:

  <font size="+2">Hello Fred!</font>
and   <font size="+2">Hello Batman!</font>

 

I got this example from freemarker http://freemarker.sourceforge.net/docs/dgui_misc_userdefdir.html (For Java) but I am looking similar to this for PHP, I can't find it.  ???

Link to comment
https://forums.phpfreaks.com/topic/134588-template-system-customs-tags/
Share on other sites

Although there is nothing that has "macros" this really could be accomplished through sub-templating, ie: putting a template within a template (or loading a template into a variable and then passing that value to another template, either one accomplishes the same thing).

As far as I know, no template engine in PHP does that.

 

You could probably mod one to do it though.

 

I see, I might try to develop it.

 

Can you please give me some of advice how to implement this? and what PHP functions to use to parse custom tags.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.