Table of Contents
Sometimes you have a whole bunch of normal HTML pages, but are drooling over the features that CpmFetch can give you. Here is some information on using CpmFetch on normal HTML pages via the Server Side Include (SSI) functionality of the Apache web server. I have no idea if something similar exists on IIS, so if someone knows - let me know.
I was planning on writing an SSI module for use with CpmFetch, but since this is so easy I have put that off for the time being. A basic knowledge of how to use CpmFetch is useful here. Please read the example carefully.
Here are some assumptions I use in this document:you can change them of course, but this will help you figure out which parts you can change. You do not have to use these paths, please change them to whatever you want, just be consistent
Coppermine is installed into /cpg |
CpmFetch has been installed into /cpmfetch |
Your HTML page is in the root of the web site / |
You create the new file in /cpmfetch |
Here are the steps I went through:
Get cpmfetch installed - A normal install, follow the directions.
Make sure the cpmtest.php file is working - This is part of the directions, but thought it would be worth mentioning anyway.
Create a new file named randomimages.php file - The filename can be whatever you want, but must be .php
Edit "randomimages.php" and add in the following code:
Example 11.1. Example of code to use in an SSI file
<?php include "./cpmfetch.php"; $objCpm = new cpm('/cpg'); $objCpm->cpm_viewLastAddedMedia(4,2); $objCpm->cpm_close(); ?>
The cpm_viewLastAddedMedia can be altered to any of the function calls. This is just my example. Note: The first and second lines will need to be edited to your specific installation. The /cpg would be the same value you used to get cftest.php working. The include is the path to where you installed the cpmfetch program.
Edit your HTML file Include the following line (Apache users) where you want the HTML table to be inserted.
Example 11.2. Example of Apache SSI Include statement
<!--#include virtual="/cpmfetch/ssitest.php" -->
Tell the server its okay to execute SSI commands[/b] Now you need to tell the server it is okay to execute commands inside the HTML. This can be done a few ways. * You can use .shtml on some servers instead of .html * You can add a file named ".htaccess" with "XBitHack On" on it and change the permissions to execute (chmod 755) Apache documentation for SSI can be found here: [url]http://httpd.apache.org/docs/howto/ssi.html[/url]
Check it with your web browser... It should work. If not, view the source... if you see <!--#include virtual="/cpmfetch/ssitest.php" --> in there still, then it means that your web server is not noticing it can execute. Review step 6 and the apache documentation. If the #include is missing, then it means that your server is okay, your just not getting any pictures back. Try executing the PHP file directly.