Using the $source parameter effectively | In depth explanations | Using the $format parameter effectively |
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.
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 #1 $options = array( 'option_name' => 'option_value' , 'option_name' => 'option_value' ); $objCpm->viewRandomMediaFrom("",1,1,$options); //Example #2 $objCpm->viewRandomMediaFrom("",1,1, array( 'option_name' => 'option_value' , 'option_name' => 'option_value' )); //Example #3 Real world example $options = array( 'subtitle' => 'Image {{pTitle}} is {{pFilesizeKB}} KB' , 'imagewidth' => '200', "tablestyle" => "cssfortables" ); $objCpm->viewRandomMediaFrom("",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 http://www.php.net/manual/en/language.types.array.php.
It helps to catagorize the different entries by what they actual change.
These just add whatever you set them to as a class attribute on the corresponding HTML tag. So if you submit something as tablestyle it will set the value on your table tag, etc...
Set with: A string naming the css style to be added.
The CSS Style passed to it will be added to all <TH> tags
Set with: A string naming the css style to be added.
The CSS Style passed to it will be added to all <TABLE> tags
Set with: A string naming the css style to be added.
The CSS Style passed to it will be added to all <TH> tags
Set with: A string naming the css style to be added.
The CSS Style passed to it will be added to all <TR> tags
Set with: A string naming the css style to be added.
The CSS Style passed to it will be added to all <TD> tags
Set with: A string naming the css style to be added.
The CSS Style passed to it will be added to all <A HREF> tags
Set with: A string naming the css style to be added.
The CSS Style passed to it will be added to all <IMG> tags
Set with: Array containing a series of key / value pairs.
By submitting an array of keys and values, they will be added to the output as a series of HTML attributes. For example, adding "imageattributes" => array("height" => "20", "width"=>"20") as an option will adding the height and width attributes to all image tags generated and set them to 20.
Set with: Array containing a series of key / value pairs.
By submitting an array of keys and values, they will be added to the output as a series of HTML attributes. For example, adding "imageattributes" => array("height" => "20", "width"=>"20") as an option will adding the height and width attributes to all image tags generated and set them to 20.
Set with: Array containing a series of key / value pairs.
By submitting an array of keys and values, they will be added to the output as a series of HTML attributes. For example, adding "imageattributes" => array("height" => "20", "width"=>"20") as an option will adding the height and width attributes to all image tags generated and set them to 20.
Set with: Array containing a series of key / value pairs.
By submitting an array of keys and values, they will be added to the output as a series of HTML attributes. For example, adding "imageattributes" => array("height" => "20", "width"=>"20") as an option will adding the height and width attributes to all image tags generated and set them to 20.
Set with: Array containing a series of key / value pairs.
By submitting an array of keys and values, they will be added to the output as a series of HTML attributes. For example, adding "imageattributes" => array("height" => "20", "width"=>"20") as an option will adding the height and width attributes to all image tags generated and set them to 20.
Set with: Array containing a series of key / value pairs.
By submitting an array of keys and values, they will be added to the output as a series of HTML attributes. For example, adding "imageattributes" => array("height" => "20", "width"=>"20") as an option will adding the height and width attributes to all image tags generated and set them to 20.
While technically CSS tags above do that, these do it in a more direct manner. With the above, you set a CSS tag, then use CSS to change things. These entries just plain change things for you.
Set with: String containing thumb, int, or large
This tells CpmFetch which of three image sizes it should get from your gallery for a photo. The default is to grab the thumbnail version (thumb), but you can also grab the intermediate size (int) or the full size version (large).
Set with: Height to force image to in pixels.
This entry will set the height attribute on the <IMG> tags. It will essentially force your browser to resize the image to a specific height. If you specify just the height and not the width, the ration will be kept the same. If you specify both, funky things will happen - which can be cool if thats what you are looking for.
Set with: Width to force image to in pixels.
This entry will set the width attribute on the <IMG> tags. It will essentially force your browser to resize the image to a specific width. If you specify just the width and not the height, the ration will be kept the same. If you specify both, funky things will happen - which can be cool if thats what you are looking for.
Set with: anything (see below).
If you simply want subtitles displayed, and no images... add this entry. The value you give to the key will be ignored at this time, so don't worry about what you put in there. "" will suffice. Its highly recommended that you use this with a subtitle, otherwise nothing will display at all.
Set with: formatting string.
This defines the text displayed in the images ALT and TITLE tags. The default ALT tag is set to a directory / image name. You compose it by submitting a format string with it.
Set with: formatting string.
This defines the text to include under the image. What is displayed is defined by the format string you compose using the placeholders shown below.
These set how an image is linked or not-linked, and where it links to.
Set with: String containing none, album, or large.
What type of image to link to when the image is clicked. None indicates no link will be provided.
Set with: String containing format string.
This allows you to set up exactly what the link will be formatted like. This allows for you to link to other than the CPG gallery. This is new, and allows you to screw the links up all on your own.
For example, lets say you want to create a custom link to your gallery that rates the thumbnail at 5 stars. If you looked at the link to your gallery on a rating link it would look like so:
http://www.fistfullofcode.com/cpg/ratepic.php?pic=17&rate=5
http://www.fistfullofcode.com/cpg/ratepic.php?pic={{pPid}}&rate=5
See the format tag explaination for more information on what tags are available.
Set with: Anything.
The presence of this tag tells CpmFetch to make the subtitle a link also. It follows the linking rules you set with the imagelink and windowtarget settings.
Set with: String containing _blank, _parent, _blank-js, _blank-cfshow, or anything else.
.If this is present a target tag is inserted with the contents. This is simply passed through. You can add anything in there (I think) - probably even javascript.
Note: _blank-js requires the file cpmfetch.js to be included in your page. That provides the javascript to display the image correctly.
_blank-cfshow: Uses the cfshow.php file to display the image. This will be expanded greatly in the future.
Using the $source parameter effectively | In depth explanations | Using the $format parameter effectively |
Documentation generated on Tue, 10 Apr 2007 23:00:31 -0400 by phpDocumentor 1.3.0