Welcome Guest, Not a member yet? Register   Sign In
Create custom HTML tags with Idea-Labs Markup Language (ILML) BETA
#1

[eluser]duffy0[/eluser]
This is my first contribution and it is only in BETA, but I though that everyone could find some use for it.

The library takes custom tags before being output then and process them using functions defined in application/helpers/ilml_helper.php.

I included some examples with the download.

It is easily changed and is derived from OpenFBML.
#2

[eluser]Amzad Hossain[/eluser]
Nice One.
#3

[eluser]xwero[/eluser]
The library uses a helper to replace the custom tags, why not use the helper functions in your view?
#4

[eluser]duffy0[/eluser]
It is meant to allow designers to integrate with the server easier.

Instead of writing:
Code:
<?php echo profile_picture('username', 'height', 'width', 'linked'); ?>

they can write:
Code:
<il:profile-pic height="200" width="250" linked="true">username</il:profile-pic>

This is a example I included that I use to load user's profile pictures.

I needed it to work with some designers in my group that wanted more control then what the Parser offered and they refused to touch PHP. So I threw this together.

I am open to suggestions and code contributions. I would love to see what how people use this. I will be updating it soon with some more robust code once I get it fully integrated with my website.
#5

[eluser]xwero[/eluser]
The problem is that your library is a template engine add-on instead of a templating engine. The only function your library provides is a way to retrieve hardcoded markup from functions without using php escaping.

To make your library a templating library you should add a way to process variables in your custom tag attributes. In your profile-pic tag you have no src for your picture and that is the most important of the whole tag not the height, width or that it should be linked or not.

It also should provide a way to make it possible to change the custom tag output. You could put the markup in a view files
Code:
// profile_pic.php
<img&lt;?php echo $attributes ?&gt; />
// profile_pic_linked.php
<a&lt;?php echo $attributes2 ?&gt;><img&lt;?php echo $attributes ?&gt; /></a>

As you see there needs to be a way to have attributes for complex tags like the linked profile-pic.

With all those things added the profile-pic tag could look like this
Code:
<il:profile-pic src="var:pic" alt="var:username" height="200" width="250" linked-href="var:id_link" />

I would keep the attributes as close to the real markup attributes this means a lower threshold. Your profile-pic tag has the alt attribute content as the content of the tag but what if the designer want to use the title attribute instead? It's not possible.

To summarize the changes i would do:

- add variable processing
- call views instead of functions
- make the syntax as close to the rendered markup as possible.

I also would add caching as soon as possible because all that replacing slows down the rendering of the page.
#6

[eluser]xwero[/eluser]
Before you start coding like a maniac i suggest you check out the phptal template engine to see if that isn't what you want your library to be.
The custom tags are called macros in phptal.
#7

[eluser]xwero[/eluser]
I did put my money where my mouth is and i created a proof of concept library. The things i implemented are :

- variables as values
- views instead of functions
- no php in the custom tag views
- attributes from the custom file tags are overwritable with attributes from the template
- no limited use of attributes

Changes

- tags have an empty form
- content attribute for container tags in the custom tag file
- no multiple tags in custom tag files yet

Usage zip file

- unzip it in the application directory drop.io
- add a controller function to some controller

Code:
function test()
{

$this->load->library('ct_parser');

echo $this->ct_parser->render('cttest',array('sub1'=>'Hello tag h2'));
}

the library is written as an way how it could be done so use everything you need from it.




Theme © iAndrew 2016 - Forum software by © MyBB