Table of Contents
The OptionsArray is the most useful way to customize how CpmFetch displays images and information. Almost all function calls accept the OptionArray as a parameter. I did it this way because there are way too many options to just start adding on parameters and function calls for. So I added in this sort of catch all parameter. You don't need to include this at all, but it is very powerful and you should at least be aware of what you can add into it. Usage is simple, you can either create an array of options ahead of time and submit it or simply create one in the function call - each has its pros and cons.
To pass options to CpmFetch you need to do create an assocaitive array and add in predetermined keys and values into it. This can be accomplished like so... (two examples that do the same exact thing)
Example 6.1. Example of creating the option array
//Example #1 $options = array( 'option_name' => 'option_value' , 'option_name' => 'option_value' ); $objCpm->viewRandomMedia(1,1,$options); //Example #2 $objCpm->viewRandomMedia(1,1, array( 'option_name' => 'option_value' , 'option_name' => 'option_value' )); //Example #3 Real world example $options = array( 'subtitle' => 'Image %t is %S KB' , 'imagewidth' => '200', "tablestyle" => "cssfortables" ); $objCpm->viewRandomMedia(1,1,$options);
A full listing of options and what they take and do is provided in this chapter. To learn more about associative arrays, please see the www.php.net site.
Believe it or not, the Options array originally was supposed to just handle CSS tags for the generated tables. As time went on, more and more things were able to be modified by passing new information through the options array.
For ease of use, I seperate the options into the following groups:
Entries for appearance - CSS usage, changing table tags, image size to display, not to display images, etc.. |
Entries for information - Setting ALT and TITLE tags, adding subtitles, formatting dates |
Entries for control - Where and How to link images, etc. |