Jump to content

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.

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.