Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: Assist with getting Text info into a placeable variabe  (Read 5187 times)

0 Members and 1 Guest are viewing this topic.

radmofo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Assist with getting Text info into a placeable variabe
« on: March 26, 2008, 04:10:19 pm »

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.

Code: [Select]
$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??????????

Code: [Select]
$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. 
Logged
Please give me some negative Karma. :)

Nibbler

  • Guest
Re: Assist with getting Text info into a placeable variabe
« Reply #1 on: March 26, 2008, 04:18:31 pm »

Code: [Select]
echo ($styleguide['$subtitle']);
That's not what you want. Try

Code: [Select]
echo $styleguide['subtitle'];
It won't hold data for %h and %v until after you call cpmfetch
Logged

radmofo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Re: Assist with getting Text info into a placeable variabe
« Reply #2 on: March 26, 2008, 04:25:13 pm »

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?
Logged
Please give me some negative Karma. :)

radmofo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Re: Assist with getting Text info into a placeable variabe
« Reply #3 on: March 26, 2008, 04:37:58 pm »

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.

Code: [Select]
include "/cpmfetch/cpmfetch.php";
Logged
Please give me some negative Karma. :)

Nibbler

  • Guest
Re: Assist with getting Text info into a placeable variabe
« Reply #4 on: March 26, 2008, 04:38:22 pm »

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.
Logged

radmofo

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 31
Re: Assist with getting Text info into a placeable variabe
« Reply #5 on: March 26, 2008, 04:44:47 pm »

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!
Logged
Please give me some negative Karma. :)
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 15 queries.