Since using CpmFetch in PHP pages is its primary goal, thats the example I will include here. Usage is very easy... basically all you have to do is include the library, initialize the object and make your calls. Then close the object.
This example displays a table with four random images in a horizontal row, then will display the latest 8 images added in two rows of four.
Example?4.2.?Example of using CpmFetch
<?php include "cpmfetch.php"; $objCpm = new cpm('/photos'); $objCpm->cpm_viewRandomMedia (1,4); $objCpm->cpm_viewLastAddedMedia (2,4); $objCpm->cpm_close(); ?>
I recommend doing the new( ) and the close( ) once per page. You can do it many times, but that will cause the program to reconnect to the database each time. The code will ONLY connect to the database if it needs to, then releases it when it gets the close command. This means there is minimal overhead on the page if you don't even use it.