Introduction

The Pixelpost FAQ states that in order to use selected categories for the images on my main page, I should install the GeoS Show Category addon. I tried it, and while it looks to be a rather nice addon I wasn't happy with the fact that it mucked with my database. So, I looked at how the archive/browse code worked and realized that if the proper parameters were passed via the URL, it would be a simple matter to view categories on the main page... and more! Yes, it will be a bit of work, but I think you'll find the time spent making this modification is well-worth the effort.

The aim of this modification is to enable filtering of not only categories on your main page, but also archives and tags. The way we do it is to modify the thumbnail and tag links on the archive/browse page to pass the appropriate parameter (archivedate, category, or tag). We retrieve this parameter on our main page and use it to filter our SQL queries, links, and thumbnails. There's no need for additional changes to the database. Everything is passed by URL and two simple function calls determine which URL parameter is passed and what where constraint to add to our SQL.

I don't see a way to make this modification into a plugin for the current version of Pixelpost (1.7.3). Therefore you will need to make direct changes to the code. 5 files are modified. The first four are simple modifications (you can make them in a couple of minutes). The last file (index.php) requires quite a few insertions of a variable into the SQL and links. Still, it's not all that difficult and should take you somewhere between 10 to 30 minutes to complete, depending on how familiar you are with PHP coding. Just back up your files and also backup each line you're changing (duplicate the line and then comment one of them out).


Programming Comment

I detest PHP's concatenation symbol (the period). My editor uses periods to denote tabs. Therefore, it is very difficult for me to distinguish between periods and tab symbols. Also, I strongly disagree with the standard practice of using single quotes (') to enclose strings. I prefer to use double quotes (").

I bring this up because I use the {} delimiters to enclose variables inside of strings. To use these delimiters, you need to use double quotes for strings. So, instead of doing something like $a = 'There are ' . $x . 'items in a dozen' I instead use $a = "There are {$x} items in a dozen". Your delimited variable ({$x}) must be a variable -- no function calls are allowed inside the delimiters.

Some of the code below uses these {} delimiters. Now you know what they do. I recommend you don't change anything until after you make the cited modifications and ensure everything works. Only then should you go ahead and change things to your own style of coding.


Modifications

This blog format isn't sufficient to display the necessary coding changes. I've place them into a text file attachment which I encourage you to download at this time.


Conclusion

That's it!

Now, when you use archive/browse your results are made part of the thumbnail and tag URLs. When you click on the thumbnail or tag, images on your main page will be constrained to the archivedate, category, or tag you chose.

The constraint remains in effect until:

A) You go back to archive/browse and choose a different constraint.
B) You click on your site title, which takes you back to the most current photo. The URL for this is http://yoursite/ and seeing as there are no parameters, all constraints are removed.

Enjoy!