Matt Gemmell

TOLL is available now!

An action-thriller novel — book 2 in the KESTREL series.

★★★★★ — Amazon

TotalEntries module for PHPosxom

general 1 min read

Those of you who are also using PHPosxom for your blogs may have noticed 
that the NumEntries module included with it doesn't actually return the 
number of entries in your blog; it actually gives the number of entries 
in the <em>current category</em> of the blog.

That's useful in some situations, but sometimes you might prefer to know 
the total number of entries in all categories (i.e. in the entire blog). 
Well, the wait is over: I've written a module called TotalEntries which 
does exactly that.
<a href="">Grab the source here</a>.

You'll first have to rename that file to remove the additional ".txt" suffix, 
then just follow the installation and usage instructions at the top of the file, 
also quoted below.
Drop this in your $datadir and add its name to the $yourModules array under 'EXTERNAL MODULES' in your main PHPosxom file.

Add a variable declaration line to your flavor file like this:
$myNumEntries = TotalEntries();
Then concatenate $myNumEntries into one of the blocks.
I'm currently using the module here for the <code>title</code> parameter of my 
Archive link in the sidebar. &raquo;

If you have any questions or thoughts, or if you encounter any problems, 
leave a comment on this post. Enjoy!


<strong>Footnote:</strong> The Calendar module included with PHPosxom is a bit 
buggy too. Today (1st March 2003), the Calendar shows my "blogCalToday" CSS style for 
all the boxes <em>in the same row</em> as day 1, not just for day 1 itself. I'll try to 
fix that soon. I had a quick peek at the code tonight, but I'm too tired to work on 
it at the moment.