About Me & My Setup:
- Skill Level: Somewhat Knowledgeable. I usually reverse engineer other examples to brute force my way to a result.
- Hosting: A mishmash of free DNS from zoneedit, a domain registered by iPower, and a semi-dedicated server provided by a friend that serves as a proxy for his web development project.
- Root Page:http://www.ecchi-haven.net (http://www.ecchi-haven.net)
- Page In Question: http://www.ecchi-haven.net/wordpress_experiment/ (http://www.ecchi-haven.net/wordpress_experiment/)
- Test cpmfetch Page: http://www.ecchi-haven.net/wordpress_experiment/cpmfetch.php (http://www.ecchi-haven.net/wordpress_experiment/cpmfetch.php)
- Example of how the theme SHOULD look: http://www.ecchi-haven.net/wordpress_experiment/category/gallery-updates/ (http://www.ecchi-haven.net/wordpress_experiment/category/gallery-updates/)
- The plugin that makes PHP possible in a wordpress blog entry: http://blog.codexpress.cn/php/wordpress-plugin-inline-php/ (http://blog.codexpress.cn/php/wordpress-plugin-inline-php/)
Okay so now down to the nitty gritty. My problems are as follows, listed in decreasing priority, with the most important at the top of the list.
- cpgfetch displays images, yet they do not change upon sucessive pageviews or refreshes. Even more disturbing is that the images do not change even when the
$objCpm->cpm_viewRandomMediaFrom("album=129", $options);
album value is changed.[/li]
- When inserting cpmfetch into a blog post it somehow breaks the theme, causing everything below cpmfetch to not display.
For the first issue: If you follow the link http://www.ecchi-haven.net/wordpress_experiment/cpmfetch.php (http://www.ecchi-haven.net/wordpress_experiment/cpmfetch.php) you get the quick and dirty php page I set up to test what I was doing outside of the wordpress environment.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
</head>
<body>
<?php
include_once "../coppermine/cpmfetch/cpmfetch.php";
$objCpm = new cpm("../coppermine/cpmfetch/cpmfetch_config.php");
$options = array("subtitle" => "Views: {{pHits}}");
$objCpm->cpm_viewLastAddedMedia(1, 4, $options);
$objCpm->cpm_viewRandomMediaFrom("album=130", $options);
$objCpm->cpm_close();
?>
</body>
</html>
Yet if you look at the example that breaks my wordpress theme http://www.ecchi-haven.net/wordpress_experiment/ (http://www.ecchi-haven.net/wordpress_experiment/) You will see the same identical images, yet from the code below, the album referenced is #129, not #130. The "exec" tags are the containers for the inline PHP plugin.
[exec]
include_once "../coppermine/cpmfetch/cpmfetch.php";
$objCpm = new cpm("../coppermine/cpmfetch/cpmfetch_config.php");
$options = array("subtitle" => "Views: {{pHits}}");
$objCpm->cpm_viewLastAddedMedia(1, 4, $options);
$objCpm->cpm_viewRandomMediaFrom("album=130", $options);
$objCpm->cpm_close();
[/exec]
OOOkay, well This is a lesson learned in reverse engineering. As you can tell from the "Page In Question" I fixed the problem. What wast it? Well look at my old block of code:
include_once "../coppermine/cpmfetch/cpmfetch.php";
$objCpm = new cpm("../coppermine/cpmfetch/cpmfetch_config.php");
$options = array("subtitle" => "<font style:"font-size: 8pt;"><b>Views:</b> {{pHits}}</font>");
$objCpm->cpm_viewLastAddedMedia(1, 4, $options);
$objCpm->cpm_viewRandomMediaFrom("album=129", $options);
$objCpm->cpm_close();
Line 4&5 is where the problem is, I believe that they are complimentary instructions. First it wants last added media. Okay easy enough I suppose. But wait! Line 5 refines the parameters further! Now within the last added media, cpmfetch must select the ones only from album#129. Well That cannot happen since the last added media was album 130! Or something. Anyhow the resultant code that actually works is this:
include_once "../coppermine/cpmfetch/cpmfetch.php";
$objCpm = new cpm("../coppermine/cpmfetch/cpmfetch_config.php");
$options = array("subtitle" => "Views: {{pHits}}");
$objCpm->cpm_viewRandomMediaFrom("album=129", 1, 3, $options);
$objCpm->cpm_close();