How to read the Zenphoto Functions Guide

When you first look at our functions guide it might look confusing and may not understand what exactly it is telling you. You might ask “why don’t they just write a understandable and readable guide that even non-developers can understand at first glance?” Well, actually the guide is not that hard to read once you got into it.

We are constantly updating and changing things, so that would take too much of our time write a guide manually. If one of us writes or changes a new function, he comments it within the source code directly on top of the function. You might have seen that if you looked at the template-functions.php file for example. We then use the standard auto-documentation tool phpDocumentor that generates the functions guide from these source code’s comments. This way we can easily update it with one click anytime we need to.

So let’s take a closer look at one of the more complicated template functions as an example now: printAllTagsAs() from template-functions.php:

zp-doc-example.jpg

These are the parts in detail:

zp-doc-example_01.jpg

This is the functions name and where to find it in the file, in this case template-functions.php.

zp-doc-example_02.jpg

A short general description what the function actually does.

zp-doc-example_03.jpg

This is the list of parameters the functions provides for your theme customizing needs. There are three “fields” for each parameter.

  1. The type of parameter value you can enter for the variable. These are the common types:
    • string for a textstring
    • bool for TRUE or FALSE
    • int for integer numbers’
  2. The name of the variable.
  3. The description what to values to do what.

zp-doc-example_04.jpg

Some function has this to tell which Zenphoto version introduced the function.

zp-doc-example_05.jpg

This is the actual important part. You can ingnore the “void”, that is not important and added by the phpdocumentor because it does not know better…-) Important are the options within the brackets. If you look closely you will notice that this is actually the same as the parameter list above. In short this would read:

printAllTagsAs($option, $class = '', $sort = 'abc', $counter = FALSE,$links = TRUE,
$maxfontsize = 2, $maxcount = 50, $mincount = 10, $limit = NULL)

For example $sort = ‘abc’ is a default value that is used if no other value is entered for this parameter.To use this function within your theme to print a tag cloud you would have to write simply this:

<?php printAllTagsAs("cloud", "", "abc", FALSE, TRUE, 2, 50, 10, NULL); ?>

This would print:

  • a tag cloud
  • without a css class for styling
  • “abc” for alphabetical sorting
  • no tag count within brackets behind the tag
  • no search tag links
  • largest font size the cloud should display set to 2
  • the maximum count for a tag to appear in the output set to 50
  • the minimum count for a tag to appear in the output set to 10
  • set to limit the number of tags displayed to the top $numtags disabled.

Hopefully this makes it easier for you to understand the documentation.