/lib.
Layout
Creating the Page-Layout consists of two main tasks:
- Creating forms for data manipulation
- and - if the page is complex enought (nearly every page is it) you can store the html-content in templates.
If a submenu on the content page ist needed (like in turba), it can be generated via ..menu..
Templates
WARNING: The Horde_Template package is no longer supported. You should use http://wiki.horde.org/Doc/Dev/Horde_View instead.
To move your businesslogic-variabes to a html-layout, the Horde_Templates-Package is usefull. You can include templates with code tags, and Horde will replace these tags with your variable content, if the tags and the variables are associated via template->setVariable(...);. For further information read about this package use wiki.horde.org : /Doc/Dev/TemplatePackageH32
Horde_Forms
// Prepare Variables
$title = 'myFormtitle';
$vars = Variables::getDefaultVariables();
// Prepare Form
$form = &new Horde_Form($vars, $title, 'accountstatement_Form');
$renderer = new Horde_Form_Renderer();
// Add form fields & Variables.
$form->addHidden('', 'example_hidden', 'int', false);
$form->addVariable(_("Title"), 'title', 'text', false);
// ---------------------- Render Form ------------
// Writes the HTML opening tag.
$form->open( $renderer, $vars, 'accountstatement.php', 'post');
// Titelzeile rendern
$renderer->beginActive($title);
/* writes the via addVariable(...) and addHidden(...) added inputtypes.
Available types are: http://wiki.horde.org/Doc/Dev/FormTypes?referrer=Doc%2FDev%2FFormPackage# */
$renderer->renderFormActive($form, $vars);
// writes the "submit" input button
$renderer->submit();
// writes the HTML tag
$form->close($renderer);
// stop renderer
$renderer->end();
If you want to manipulate form variables in javascript, you must set any value to that variable, otherwise it is not initialized correctly. If you plan to use a form for hidden values only, you will see a thin line in HTML. To prevent that, you can add a variable with type 'spacer'. This type has no visible content and the thin line caused by the "only hidden values" disappears.
To read or write the form variables user $vars->set( $variablename, $value); and $myVar = $vars->get( $variablename, $defaultvalue_if_not_available ); .
Scripts
If any scripts are needed for layout like striped.js für alternating rowcolors, add these scripts via Horde::addScriptFile('