Assist with getting Text info into a placeable variabe Assist with getting Text info into a placeable variabe
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

Assist with getting Text info into a placeable variabe

Started by radmofo, March 26, 2008, 04:10:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

radmofo

Hello, please see the attached image to better explain what my ultimate goal is here.

I'm still using the old version of cpmfetch that uses %h etc to get back info, but I'd like to get this working before doing anymore upgrades.

I understand that everything comes back together, (image, alt tag, subtitle) ETC.

What I need to do is get these varibles back seperatly somehow so I can place them in this template in a loop.

$styleguide = array(
"linkstyle" => "photoclip",
"alttag" => "This TOP VIEWED Photo (%t) has been Viewed: %h times with %v votes. It is rated %V/5 stars, it was added by %o %D days ago.",
"subtitle" => "<span class='fnt_9'>%h views<br />%v rating</span>",
        "imagestyle" => "photoclip",
"imagesize" => 'int',
        'imagewidth' => "180");
$objCpm->cpm_setReturnType('print');


$data = $objCpm->cpm_viewRandomMostViewedMediaFrom ("", 1, 1, $styleguide);




This is the thing that baffles me the most....notice in the following code I added an echo ($styleguide['$subtitle']);  In an attempt to use the returned info from the array elswhere in my template. But when I do all I get is "%h views %v rating"

Why wont the Variables hold a value for %h or %v??????????

$styleguide = array(
"linkstyle" => "photoclip",
"alttag" => "This TOP VIEWED Photo (%t) has been Viewed: %h times with %v votes. It is rated %V/5 stars, it was added by %o %D days ago.",
"subtitle" => "%h Views %v rating",
        "imagestyle" => "photoclip",
"imagesize" => 'int',
        'imagewidth' => "180");
$objCpm->cpm_setReturnType('print');

echo ($styleguide['$subtitle']);

$data = $objCpm->cpm_viewRandomMostViewedMediaFrom ("", 1, 1, $styleguide);


If someone could please point me in the right direction to be able to echo these variables I think I can figure out how to make cpmfetch call photos and look like the below template, just repeated over and over again. (based on user input IE search, album number, users pics)

I must be missing something terribly easy...Maybe theres a way to just bring back textual data and place it in the html properly. 
Please give me some negative Karma. :)

Nibbler

echo ($styleguide['$subtitle']);

That's not what you want. Try

echo $styleguide['subtitle'];

It won't hold data for %h and %v until after you call cpmfetch

radmofo

Hi Nibbler,

Just tried that again - it was one of my any combinations I've tested.

I've tried the "echo" in nearly every line of the code and all it will return is %h etc.

Can you tell me where to place it to get back a value?
Please give me some negative Karma. :)

radmofo

Just so you know, I am calling cpmfetch and the script does pull photo's with views and rating under the image. I just want to be able to place this stuff into seperate variables to build this template.

include "/cpmfetch/cpmfetch.php";
Please give me some negative Karma. :)

Nibbler

I don't think you can. You'd need to capture the entire output and then extract the details using string/regex functions.

Judging by your screenshot you'd be better off with a custom script than trying to use cpmfetch.

radmofo

Thanks, I'll look into it. And if anyone has any suggestions throw them my way! I have built this template that will allow users to do a search and display the images that meet that requirement directly down the page to an adjustable amount per page just as the screenshot. The images are therejust  all the info fields are filled with %v %h %d ETC.

There has to be a way!
Please give me some negative Karma. :)