Before downloading and installing I wanted to ask a fairly simple question:
How does cpmFetch handle empty results?... and can you specify a "fallback" function with a different search?
Meaning if I search for 1 image with keyword = X, album = Y, and user = Z, is there an easy way to use a different set of search terms as a fallback? I'm getting OK with PHP, so I thought maybe changing one of the examples in the docs to something like this may work:
<?php
include_once "./cpg/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./cpg/cpmfetch/cpmfetch_config.php");
$result1 = $objCpm->cpm_viewLastAddedMedia("cat=5,3:album=10:owner=vuud",1, 4);
$result2 = $objCpm->cpm_viewRandomMediaFrom("cat=5,3:album=9:owner=vuud2",1, 4);
if(!empty($result1)){
$result1;
}
else{
$result2;
}
$objCpm->cpm_close();
?>
(Pay no attention to the actual $source string in the example.. it's really just arbitrary. I basically just copy/pasted some things from the documentation, so I'm not really sure $result1 could ever be empty and $result2 would not, etc)
But since I don't know the code, I don't know if they can be assigned to variables like this without breaking? I also don't know what it does without any results, so I'm not sure if "empty" will work in this case? I assume it just doesn't print any output whatsoever, to keep it from breaking the page it's on, or displaying a bunch of PHP errors?
Also, is there any better, built-in way of doing this? No matter what, I guess there would have to be at least 2 queries, or I should say 2 x (# of queries a normal function uses) since what I'm asking about requires the comparison of multiple searches.
I'd also REALLY wish I could ask more than one question as I don't want to flood the forum with separate threads. Maybe I'll just wait until I first get an answer from this before asking any more.
Thank you.