|
From: Culprit <cul...@us...> - 2009-11-04 09:04:00
|
Update of /cvsroot/mxbb/core/includes In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv12805/core/includes Modified Files: template.php Log Message: template::assign_block_vars add S_FIRST_ROW & S_LAST_ROW Index: template.php =================================================================== RCS file: /cvsroot/mxbb/core/includes/template.php,v retrieving revision 1.37 retrieving revision 1.38 diff -C2 -d -r1.37 -r1.38 *** template.php 18 Jun 2009 21:38:58 -0000 1.37 --- template.php 4 Nov 2009 09:03:47 -0000 1.38 *************** *** 1190,1194 **** function assign_block_vars($blockname, $vararray) { ! if (strstr($blockname, '.')) { // Nested block. --- 1190,1194 ---- function assign_block_vars($blockname, $vararray) { ! if (strstr($blockname, '.') == true) { // Nested block. *************** *** 1202,1205 **** --- 1202,1223 ---- $str = &$str[sizeof($str)-1]; } + + $s_row_count = isset($str[$blocks[$blockcount] . '.']) ? sizeof($str[$blocks[$blockcount] . '.']) : 0; + $vararray['S_ROW_COUNT'] = $s_row_count; + + // Assign S_FIRST_ROW + if( !$s_row_count) + { + $vararray['S_FIRST_ROW'] = true; + } + + // Now the tricky part, we always assign S_LAST_ROW and remove the entry before + // This is much more clever than going through the complete template data on display (phew) + $vararray['S_LAST_ROW'] = true; + if( $s_row_count > 0) + { + unset($str[$blocks[$blockcount] . '.'][($s_row_count - 1)]['S_LAST_ROW']); + } + // Now we add the block that we're actually assigning to. // We're adding a new iteration to this block with the given *************** *** 1209,1212 **** --- 1227,1245 ---- else { + $s_row_count = (isset($this->_tpldata[$blockname . '.'])) ? sizeof($this->_tpldata[$blockname .'.']) : 0; + $vararray['S_ROW_COUNT'] = $s_row_count; + + // Assign S_FIRST_ROW + if (!$s_row_count) + { + $vararray['S_FIRST_ROW'] = true; + } + + // We always assign S_LAST_ROW and remove the entry before + $vararray['S_LAST_ROW'] = true; + if ($s_row_count > 0) + { + unset($this->_tpldata[$blockname . '.'][($s_row_count - 1)]['S_LAST_ROW']); + } // Top-level block. // Add a new iteration to this block with the variable assignments |