| Chirag Ahmedabadi 2004-08-13, 3:59 pm |
| Hello All
I wrote to this forum/list few months back about the something interesting with smarty, I thought let me again describe same thing here.
The concept I am talking about is something different with PHP and Smarty. For me this was not possible without using Smarty and that’s where I am very much thankful to smarty.
There are few programmers whom I know who are against smarty, they says it is taking extra resources andgoing away from basic concept of template system. It is just programming in html, this is true to some extent. However, for me, what I could do with Smarty as explained here, is not possible at all without smarty. For me smarty is really a powerful tool
What i wish if my concept is not worth than smarty developers can come with something like this....i am sure, would be really very useful in commercial rapid development.
Amway, my concept ‘Akaar’ has few features, which are quite new with PHP developmentlike BackFire, Client Validation, Insertion, and Layout Management etc. These features can surely give pace to the development work dramatically. There are lots of feature for just for example, here
BackFire
This is bit difficult for me to explain the concept behind the Backfire in words; I would prefer to explain by case.
Just imagine a case, you are doing coding for a registration form in which you will ask some information from your user like, email, password, gender, address, city, country etc.
The email address filed is unique in your system and you need to validate it. You must validate that the email address enter by user is unique andif it is not you must inform user to enter different email address.
In such case, while informing the notice to user, you would prefer to re-fill all the information (like city, address, gender, and country) entered byuser so they don’t need to fill again. They just enter different email address and go ahead.
Now, just think, how would you do this? What is your normal way to do coding in such case and how would you re-filled the information entered by user while notifying the user?
I would not describe here how we do this normally, but I would surely tell you how you could do this in Akaar. Just by a single line of Code, yes by just single line ofcode like
$obj->DoBackFire();
That’s all; this line of codewill do all for you. It would re-fill all the information entered by user on form; you don’t require doing any coding in your template or php at all. It does not matter for Akaar what kind of html element you have on your form.
If it were select box for country then it would show the country entered by user as selected, if it was radio for gender, it would show proper radio selected as selected by user.
For more detail information and example please visit
http://www.php-india.net/Akaar/?op=BackFire
Akaar Value Insertion
What is this? Again, let us go by an example.
To understand this, just think of a case, you have edit profile form in your member area, when your user clicks on this, you want to display a edit form with all the information filled (Which you will fetch from database)
What we normally do for this?
Normally we will assign the value in html code like
<input type="text" name="FirstName" value="<? =$FirstName?> ">
Or if we are using the templates then, in our template we will have something like
<input type="text" name="FirstName" value="{$FirstName} ">
This is orthodox example of text box, if we have select box, we may have different way to handle this, in case or radio button, it is different, in case of check boxes, it can be again different.
Now, What if you have single way of handling this, irrespective of what kind of html element you have.
Like, if we have same way to put value in checkbox, list box, radio or textarea or any such input element.
Here, Akaar helps you, you use single method to handle this and you don't require writing of any code in your template or in your html code value tag.
You just do this simply by calling setValue method. For example, in above case it would be something like
$obj->setValue("FirstName", $FirstName);
Now, your "FirstName" can be any HTML element, it can be checkbox, textbox, radio, textarea, select box or even multiple select box. Akaar takes care of that; you don't have to bother what kind of html element it is
For more detail information and example please visit
http://www.php-india.net/Akaar/?op=value
There are lots of other features like
Client Validation, Layout Managment etc
For more detail information and example please visit
http://www.php-india.net/Akaar/
Any comments ?
Thanks All and Thanks Smarty!!!
|