we're trying to move joomlaboards templating engine to patTemplate, but I've ran into a problem. I'm using an oddEven type template for alternating rows. So far everything works, now within each sub (_odd and _even) I'd like to check for another variable and this just doesn't work for some reason. Anybody care to enlighten me? The code is included below:
forum_flatview.xml
Code: Select all
<patTemplate:tmpl name="jb-forum-flatview">
<table border="0" cellspacing="1" cellpadding="3" width="100%" class="contentpane" style="text-align: left;">
<tr>
<td class="sectiontableheader" width="5%"> </td>
<td class="sectiontableheader" width="5%" align="center"> </td>
<td class="sectiontableheader" width="5%" align="center"> </td>
<td class="sectiontableheader" width="30%"align="center"><strong>{GEN_TOPICS}</strong></td>
<td class="sectiontableheader" width="5%" align="center"><strong>{GEN_REPLIES}</strong></td>
<td class="sectiontableheader" width="5%" align="center"><strong>{GEN_HITS}</strong></td>
<td class="sectiontableheader" width="20%" align="center"><strong>{GEN_AUTHOR}</strong></td>
<td class="sectiontableheader" width="25%" align="center" colspan="2"><strong>{GEN_LAST_POST}</strong></td>
</tr>
<patTemplate:tmpl name="jb-forum-flatview-row" type="oddeven">
<patTemplate:sub condition="__odd">
<tr class="sectiontableentry1">
<patTemplate:tmpl type="condition" conditionvar="jb-forum-flatview-row.newposts">
<patTemplate:sub condition="1">
<td width="5%">{UNREAD}</td>
</patTemplate:sub>
<patTemplate:sub condition="0">
<td width="5%">{READ}</td>
</patTemplate:sub>
</patTemplate:tmpl>
<td width="4%" align="center">{TOPICTYPE}</td>
<td width="4%" align="center"><img src="{TOPICEMOTICON}" alt="topic emoticon" /></td>
<td width="30%" align="center">{SUBJECT}</td>
<td width="5%" align="center">{REPLIES}</td>
<td width="5%" align="center">{HITS}</td>
<td width="20%" align="center">{AUTHOR}</td>
<td width="25%" align="center">
<small>{LASTPOSTTIME}</small><br />
<small>{GEN_BY} {LASTPOSTAUTHOR}</small>
</td>
<td width="2%" align="center"><a href="{LASTPOSTURL}">{LASTPOSTIMG}</a></td>
</tr>
</patTemplate:sub>
<patTemplate:sub condition="__even">
<tr class="sectiontableentry2">
<patTemplate:tmpl type="condition" conditionvar="jb-forum-flatview-row.newposts">
<patTemplate:sub condition="1">
<td width="5%">{UNREAD}</td>
</patTemplate:sub>
<patTemplate:sub condition="__default">
<td width="5%">{READ}</td>
</patTemplate:sub>
</patTemplate:tmpl>
<td width="4%" align="center">{TOPICTYPE}</td>
<td width="4%" align="center"><img src="{TOPICEMOTICON}" alt="topic emoticon" /></td>
<td width="30%" align="center">{SUBJECT}</td>
<td width="5%" align="center">{REPLIES}</td>
<td width="5%" align="center">{HITS}</td>
<td width="20%" align="center">{AUTHOR}</td>
<td width="25%" align="center">
<small>{LASTPOSTTIME}</small><br />
<small>{GEN_BY} {LASTPOSTAUTHOR}</small>
</td>
<td width="2%" align="center"><a href="{LASTPOSTURL}">{LASTPOSTIMG}</a></td>
</tr>
</patTemplate:sub>
</patTemplate:tmpl>
</table>
</patTemplate:tmpl>
Code: Select all
$arr_jb_rows=array();
$int_jb_counter=0;
foreach ($arr_jb_messages as $obj_jb_message) {
$arr_jb_rows[$int_jb_counter]['topictype']=jb_get_topic_type($obj_jb_message);
$arr_jb_rows[$int_jb_counter]['topicemoticon']=$topic_emoticons[$obj_jb_message->topic_emoticon];
$arr_jb_rows[$int_jb_counter]['newposts']=0;
if ($obj_jb_message->locked!=1) {
if ($sbConfig['showNew'] && $my->id !=0 && ! $obj_jb_message->moved)
if (($prevCheck<$obj_jb_message->lastpost && (!in_array($obj_jb_message->id, $read_topics) || $read_topics[$obj_jb_message->id]<$obj_jb_message->lastpost)))
$arr_jb_rows[$int_jb_counter]['newposts']=1;
if ($sbConfig["allowemail"]==1)
$arr_jb_rows[$int_jb_counter]['author']='<a href="mailto:'. $obj_jb_message->email . '" >'.
$obj_jb_message->name.'</a>';
else
$arr_jb_rows[$int_jb_counter]['author']=$obj_jb_message->name;
$arr_jb_rows[$int_jb_counter]['hits']=$obj_jb_message->hits;
$arr_jb_rows[$int_jb_counter]['replies']=$obj_jb_message->replies;
$arr_jb_rows[$int_jb_counter]['lastposttime']=$last_reply[$obj_jb_message->id]->time;
$arr_jb_rows[$int_jb_counter]["lastpostauthor"]=$last_reply[$obj_jb_message->id]->name;
$arr_jb_rows[$int_jb_counter]["lastposturl"]=sefRelToAbs($sbs2.'&func=view&catid='.$catid.'&getlast=1&id='.$last_reply[$obj_jb_message->id]->id).'#'.$last_reply[$obj_jb_message->id]->id;
$arr_jb_rows[$int_jb_counter]["subject"]='<a href="'.sefRelToAbs($sbs2.'&func=view&id='.$obj_jb_message->id.'&catid='.$catid).'">'.$obj_jb_message->subject.'</a>';
if ($obj_jb_message->replies+1 > $sbConfig['messages_per_page'])
$arr_jb_rows[$int_jb_counter]["subject"].='<br />'.jb_generate_pagelist($obj_jb_message);
}
else {
$newURL='';
$database->setQuery("SELECT `message` FROM #__sb_messages_text WHERE `mesid`='".$obj_jb_message->id."'");
$newURL=$database->loadResult();
$arr_jb_rows[$int_jb_counter]["subject"]='<a href="'.sefRelToAbs($sbs2.'&func=view&'.$newURL).'">'.
$obj_jb_message->subject.'</a>';
}
$int_jb_counter++;
}
$jb_unread=$sbIcons['unreadmessage'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['unreadmessage'].'" border="0" alt="'._GEN_UNREAD.'" title="'._GEN_UNREAD.'"/>' : '<span class="sb_new">'.$sbConfig['newChar'].'</span>';
$jb_read=$sbIcons['readmessage'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['readmessage'].'" border="0" alt="'._GEN_NOUNREAD.'" title="'._GEN_NOUNREAD.'"/>' : '<span class="sb_notnew">'.$sbConfig['newChar'].'</span>';
$str_lastreply=$sbConfig['latestpost'] ? '<img src="'.$mls.'/modules/mod_sbicons/'.$sbIcons['latestpost'].'" border="0" alt="'._SHOW_LAST.'" />' : ' <img src="'.$sbs.'/emoticons/icon_newest_reply.gif" border="0" width="18" height="9" alt="'._SHOW_LAST.'" title="'._SHOW_LAST.'" />';
$obj_jb_tmpl->readTemplatesFromFile( "forum_flatview.html" );
$obj_jb_tmpl->addVar('jb-forum-flatview','GEN_TOPICS',_GEN_TOPICS);
$obj_jb_tmpl->addVar('jb-forum-flatview','GEN_REPLIES',_GEN_REPLIES);
$obj_jb_tmpl->addVar('jb-forum-flatview','GEN_HITS',_GEN_HITS);
$obj_jb_tmpl->addVar('jb-forum-flatview','GEN_AUTHOR',_GEN_AUTHOR);
$obj_jb_tmpl->addVar('jb-forum-flatview','GEN_LAST_POST',_GEN_LAST_POST);
$obj_jb_tmpl->addVar('jb-forum-flatview-row','GEN_BY',_GEN_BY);
$obj_jb_tmpl->addVar('jb-forum-flatview-row','READ',$jb_read);
$obj_jb_tmpl->addVar('jb-forum-flatview-row','UNREAD',$jb_unread);
$obj_jb_tmpl->addVar('jb-forum-flatview-row','LASTPOSTIMG',$str_lastreply);
$obj_jb_tmpl->addRows( "jb-forum-flatview-row",$arr_jb_rows);
$obj_jb_tmpl->displayParsedTemplate('jb-forum-flatview');