Learn Something New Each Day

While I am still learning myself, I thought someone else could learn from my experiences....

Monday, January 09, 2006

PHP Directory Mods

While browsing through some blogs today, I came across a post from Terry which was very helpful. I noticed he too has used the PHP Directory scipt I spoke of earlier, and he had some useful modifications on his. One of the ones I was interested in, was the display of total links & categories.

After leaving a message in the blog Terry got back to me, and was kind enough to pass on the snippet of script he used to achieve this. At first the snippet didn't work, and actually created a fatal error, but having experienced this 'fatal error' occurance before while doing things, I didn't panic...lol.

I did have browse through the PHP support forums, and quickly came up with the problem.

So the snippets used were.

Open index.php
Find
echo $tpl->fetch('main.tpl', $id);

Before Add
$stats[0] = $db->GetOne("SELECT COUNT(*) FROM {$tables['link']['name']} WHERE STATUS = 2");
$stats[3] = $db->GetOne("SELECT COUNT(*) FROM {$tables['category']['name']} WHERE STATUS = 2");
$tpl->assign('stats', $stats);


Open main.tpl
Add where you want
{l}Active Links{/l} - {$stats[0]}
{l}Categories{/l} - {$stats[3]}



So.. now the only problem I have is that the category count wont show up. But atleast I am closer than I was!!

0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home