Number of Categories and Models

Post Reply
happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Number of Categories and Models

Post by happydg »

Hello,

Is there a php code to know the number of categories on my site with at least one gallery?
I would also need the numbers of models with at least one gallery?

For example <?php $categoriesnumber = .. ?>

Thank you.
admin
Site Admin
Posts: 37241
Joined: Wed Sep 10, 2008 11:43 am

Re: Number of Categories and Models

Post by admin »

Well, you can do

<category num=1-100000>
<? $count++; ?>
</category>
Don't forget to run script update
happydg
Posts: 412
Joined: Mon Jul 08, 2013 2:22 pm

Re: Number of Categories and Models

Post by happydg »

I have this code with another script which divide a list of categories by a specific number of ul ( columns ). Is it possible to do this with smartcj? I don't know what $categories stands for.

Code: Select all

<ul>
	<?php $c = count($categories); $s = ceil($c / 5); foreach ($categories as $k => $v) : $n = $k + 1?>
    <li><a href="<?=Inxy::url('best')->toCategory($v->name)?>" title="<?=$v->name?>" target="_blank"><?=ucfirst($v->name)?>&nbsp;<span>(<?=$v->published_gal_count?>)</span></a></li>
	<?php if ($n % $s == 0) : ?>
</ul>
<ul>
	<?php endif; ?>
	<?php endforeach?>
</ul>
admin
Site Admin
Posts: 37241
Joined: Wed Sep 10, 2008 11:43 am

Re: Number of Categories and Models

Post by admin »

well, looks like "php for beginners" might be a good book for you )

You can start with

<category num=1-100000>
<? $my_count++;

if ($my_count % 10 == 0) {
?>
</ul><ul>
<?
}

?>
</category>


If you need custom code - anybody with basic knowledge of PHP can do it
or you can save money by reading a some docs on this topic
Don't forget to run script update
Post Reply