Wedge
Public area => Off-topic => The Pub => Other software => Topic started by: live627 on March 10th, 2012, 08:00 AM
-
So I needed to get a subset of boards in a category, so I decided to use the data generated by getBoardList(). I've used this function before,, and iterating through $boardList is a snap, so, why not try $boards? It's... a... mess! Much harder to iterate through properly than expected. Not only is the code inside the function confusing, but scanning the output is also confusing!
I suspect that the code dates way back, to 1.0 probably, or even YABBSE.
Seriously, why all thee node subarrays and duplications? It's enough to spend an entire evening just staring and figuring out what the hell it does!
And children aren't consistent with graandchildren, either. The former is under 'tree' while the latter isn't. What's the big deal? Either put 'em all under the extra item, or don't... quite simple, really.
-
Which one, exactly, are you looking at? getBoardList() in Subs-MessageIndex.php is rather simple to use, and I'm guessing you mean getBoardIndex() which is an utter mess?
-
getBoard... Tree. Silly me, got it wrong :P
-
At a glance, getBoardTree looks reasonably sane?
-
Here's my code.
<?php template_edit_profile_league__r(array($boards[$context['d_board']]));
function template_edit_profile_league__r($boards)
{
foreach ($boards as $board)
{
if (isset($board['node']['id']))
$b = $board['node'];
else
$b = $board;
echo '
<div><input type="text" name="boards[', $b['id'], ']"style="margin-left: ', (($b['level'] * 1.5) + 0.5), 'em;" value="', $b['name'], '"></div>';
if (!empty($board['tree']['children']))
template_edit_profile_league__r($board['tree']['children']);
if (!empty($board['children']))
template_edit_profile_league__r($board['children']);
}
} ?>
-
I don't see anything wrong with that?