I have following codes:
<?php foreach ($list as $item) : ?>
<li<?php if ($id == $item->id && in_array($view, array('category', 'categories')) && $option == 'com_content') echo ' class="active"'; ?>>
<?php $levelup = $item->level - $startLevel - 1; ?>
<a href="<?php echo JRoute::_(ContentHelperRoute::getCategoryRoute($item->id)); ?>">
<?php echo $item->title; ?>
<?php if ($params->get('numitems')) : ?>
(<?php echo $item->numitems; ?>)
<?php endif; ?>
</a>
Could anyone tell how to random the title? And control the showing numbers?
shuffle($list)
? What are you currently seeing as output? What output do you want?foreach()
seems sensible.<?php shuffle($list); foreach ($list as $item) : ?>
? I don't see the purpose of declaring$levelup
.