I want some of these elements can be arranged horizontally, for example, to InputPicker and elements related to its
But the default template of EasyForm, generate verticaly element.
So i change the template for EasyForm like this
...
{foreach item=item key=mykey from=$dataPanel}
{if substr($mykey, -6) eq '_pleft'}
<tr>
<td width="12%" nowrap="" class="edit_label2"><b>{$item.label}</b>
</td>
<td class="edit_control2">{$item.element}
{elseif substr($mykey, -8) eq '_pcenter'}
{$item.label} {$item.element}
{elseif substr($mykey, -7) eq '_pright'}
<b>{$item.label}</b> {$item.element}
</td>
</tr>
{elseif substr($mykey, -5) eq '_bold'}
<tr>
<td width="12%" nowrap="" class="edit_label2"><b>{$item.label}</b></td>
<td class="edit_control2">{$item.element}
</td>
</tr>
{elseif substr($mykey, -7) eq '_boldln'}
<tr>
<td width="12%" nowrap="" class="edit_label2"><b>{$item.label}</b></td>
<td class="edit_control2">{$item.element}
</td>
</tr>
<tr>
<td width="12%" nowrap="" class="edit_label1"><img src="../images/spacer.png" height="4"></td>
<td class="edit_control1"><img src="../images/spacer.png" height="4"></td>
</tr>
{elseif substr($mykey, -8) eq '_boldln1'}
<tr>
<td width="12%" nowrap="" class="edit_label2"><b>{$item.label}</b></td>
<td class="edit_control2">{$item.element}
</td>
</tr>
<tr>
<td width="12%" nowrap="" class="edit_label1"><img src="../images/spacer.png" height="1"></td>
<td class="edit_control1"><img src="../images/spacer.png" height="1"></td>
</tr>
{else}
<tr>
<td width="12%" nowrap="" class="edit_label2">{$item.label}</td>
<td class="edit_control2">{$item.element}
</td>
</tr>
{/if}
{/foreach}
...
formatting elements is done by adding suffix to the name of the element. Please see this following sample:
<Element Name="unit_kerja_kode_pleft" Class="InputPicker" FieldName="UnitKerjaKode" Label="Unit Kerja (11)" Width="80" xEnabled="N"
ValuePicker="pegawai.v_Picker,config.f_UnitKerjaPicker,unit_kerja_kode_pleft"
PickerMap="unit_kerja_kode_pleft:fld_unitkerja_kode,unit_kerja_nama_pright:fld_unit_kerja"/>
<Element Name="unit_kerja_nama_pright" Class="InputText" FieldName="UnitKerjaNama" Label="" Width="400" Enabled="N"/>
screen shoot: http://picasaweb.google.com/agus.suhartono/PhpOpenBizSimpeg#5368716215211876194
I know this solution is not ideal,
i must learn phpOpenBiz element concept for better solution
Agus Suhartono | ThePhpEnterprise.Com
Thanks for the tips. I found
Thanks for the tips.
I found the some 2 column sample in templates/edit_c2.tpl.
{assign var="i" value=0}
{foreach item=item from=$fields}
{if $i is div by 2}<tr>{/if}
<td width=100 class=item align=right valign=top class=cell>{$item.label}</td><td valign=top class=cell_edit>{$item.control}</td>
{if $i is not div by 2}</tr>{/if}
{assign var="i" value=$i+1}
{/foreach}
Also, for custom layout, it is a good idea to use field name in tpl file. Like /modules/trac/templates/ticket_details.tpl