RedFruits updates, ADContainer new funtions

Posted: December 9, 2010 in development
Tags: , ,

Redfruits is a stable software to create HML pages or piece of HMTL code, like forms or list.

Now in the last version of redfruits you can use the new ‘insert’ function. This function is present in all the HTML containers (lists, forms, div, fieldsets, etc.). You can insert a component before another component using the id of the second component or by the array index.

For example:

$form = new ADForm();
$form->add(new ADTextField('first_name', 'my first name'));
$form->add(new ADTextField('last_name', 'my last name'));
//new insert function
$form->insert(new ADTextField('year', '2010'), 'last_name');
//Equal to $form->insert(new ADTextField('year', '2010'), 1);
echo $form->render();

Another useful way is to use the other new function in the ADContainer definition: getLastClassStyle($classStyle). This function returns the index of the last component with a given class style. See the next code:

require_once('tcp/wp-content/plugins/redfruits/gui/ADCoreGui.php');

$form = new ADForm();
$form->add(new ADTextField('first_name', 'my first name'))->setClassStyle('style1');
$form->add(new ADTextField('last_name', 'my last name'))->setClassStyle('style2');

$index = $form->getLastClassStyle('style2');
$form->insert(new ADTextField('year', '2010'), $index);

echo $form->render();

RedFruits is growing!!!

See you.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s