i've been playing with XOOPS code steady for a week now (had looked at it in the past, never enough to begin to grasp it)
i'm developing a xoops-based module for my employer, and i wanted to template-ize all html within the module
i started looking at the module templates yesterday to figure out how they work, looked in XOOPS documentation, and today after creating a few simple templates, and then a few hours of struggling, i was able to create a fairly complex (imho) smarty template, whee
lol, and yes, simple things do amuse me
here's the template, specific to my module:
<{ section name=j loop=$multiple_array }>
<table align='center' cellpadding='2'>
<tr>
<td>
<table align='center' width='100%' border='1' cellspacing='0' cellpadding='2'>
<{ if $multiple_array[j].lang_b_unit != 'both' }>
<tr>
<td width='100%' align='center' colspan='6'><b><{$multiple_array[j].lang_mbiz_unit}>b>td>
tr>
<{ /if }>
<tr>
<td align='center'><b><{ $multiple_array[j].lang_date }>b>td>
<td align='center'><nobr><b><{ $multiple_array[j].lang_adoption_notice }>b>nobr>td>
<td align='center'><nobr><b><{ $multiple_array[j].lang_style }>b>nobr>td>
<td width='100%' align='center' colspan='2'><nobr><b><{ $multiple_array[j].lang_changes }>b>nobr>td>
tr>
<{ section name=i loop=$multiple_array[j].lang_while_val }>
<tr>
<td align='center'><{ $multiple_array[j].lang_while_val[i].signin_date }>td>
<td align='center'><nobr><b><a href='index.php?op=Detailed&anumber=<{ $multiple_array[j].lang_while_val[i].adoption_notice }>'><{ $multiple_array[j].lang_while_val[i].adoption_notice }>a>b>nobr>td>
<td align='center'>
<{ $multiple_array[j].lang_while_val[i].styles }>
td>
<td align='center' colspan='2'><nobr><{ $multiple_array[j].lang_while_val[i].changes }>nobr>td>
tr>
<{ /section }>
<tr><td <{$multiple_array[j].lang_colspan}> align='left'>
<{ if $multiple_array[j].lang_worklogrows > 10 }>
<table width='100%'><tr>
<td <{$multiple_array[j].lang_colspan}> align='left'><a href='index.php?op=View_Only&b_unit=csw&start=$finish'><b><{$multiple_array[j].lang_viewnext}>b>a>td>tr>table>
td><td <{$multiple_array[j].lang_colspan}> align='right'>
<{ /if }>
<table width='100%'><tr>
<td <{$multiple_array[j].lang_colspan}> align='right'><a href='index.php?op=Submit_Form'><b><{$multiple_array[j].lang_addnew_an}>b>a>td>tr>table>
td>tr>
table>
td>tr>
table>
<br>
<{/section}>
$multiple_array is a sizeable array that is dynamically expansive, and smarty works great with it
example of how i populate $multiple_array:
$workingarray = array('lang_worklogrows'=>$worklogrows,
'lang_b_unit'=>$b_unit,
'lang_mbiz_unit'=>$mbiz_unit,
'lang_while_val'=>$whilearray,
'lang_colspan'=>$colspan,
'lang_arraycount'=>$arraycount,
'lang_date'=>'Date',
'lang_adoption_notice'=>'Adoption Notice #',
'lang_style'=>'Style',
'lang_changes'=>'Changes',
'lang_viewnext'=>'View Next 10 Results',
'lang_addnew_an'=>'Add New Adoption',
'lang_style'=>'Style');
$xoopsTpl->append('multiple_array',$workingarray);
this is what the array looks like when it's filled (it's been populated twice):
Array (2)
0 => Array (12)
lang_worklogrows => 3
lang_b_unit => csw
lang_mbiz_unit => Casualwear
lang_while_val => Array (3)
0 => Array (4)
signin_date => 4/30/04
adoption_notice => 04-P638
styles => P160<br>P161
changes => New Style
1 => Array (4)
signin_date => 4/30/04
adoption_notice => 04-P639
styles => P161<br>T238
changes => Color Add - pre-load
2 => Array (4)
signin_date => 3/09/04
adoption_notice => 04-839
styles => Multi
changes => Pricing
lang_colspan => colspan='6'
lang_arraycount => 3
lang_date => Date
lang_adoption_notice => Adoption Notice #
lang_style => Style
lang_changes => Changes
lang_viewnext => View Next 10 Results
lang_addnew_an => Add New Adoption
1 => Array (12)
lang_worklogrows => 0
lang_b_unit => prt
lang_mbiz_unit => Printables
lang_while_val => empty
lang_colspan => colspan='6'
lang_arraycount => 0
lang_date => Date
lang_adoption_notice => Adoption Notice #
lang_style => Style
lang_changes => Changes
lang_viewnext => View Next 10 Results
lang_addnew_an => Add New Adoption
oh, and i forgot to mention, i'm fairly novice with arrays as well, thus my giddiness when i finally made it work...!
okay, i'm done patting myself on the back
if you see a better way to setup the template, please let me know, as i said, i'm new to this so i probably made a redundant error