integrating cpmfetch in theme.php integrating cpmfetch in theme.php
 

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]

Main Menu

integrating cpmfetch in theme.php

Started by balafre, March 08, 2007, 08:33:25 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

balafre

Hi,
as I realised that my previous request was about a different topic (sorry) and if I understand correctly the board policy, I must create this new topic.
Then, my cpmfetch install is fine, I run without problem the datas it provides outside cpmfetch.

Here is the code :
<?php 
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("./cpmfetch/cpmfetch_config.php");
$source "keyword=all-right-mama";
$objCpm->cpm_viewRandomMediaFrom($source,1,1,array("imagestyle" => "test1","subtitle"=>"%a","alttag"=> "%a","imagesize" => "large","subtitlelink" => "","imagelink" => "album"));
$myarray = array("subtitle"=>"%a","alttag"=> "%a","subtitlelink" => "","imagelink" => "album");
$objCpm->cpm_viewLastAddedMedia (1,1,$myarray);  
$objCpm->cpm_close();
?>

My goal is to display these datas in my theme.php file in the main category section (coppermine home page).
I have read the docs and search the board.
So I split <?php 
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("./cpmfetch/cpmfetch_config.php");

and ?> to the begining and at the end of my theme.php and remain the rest of the code :
$source = "keyword=all-right-mama";
$objCpm->cpm_viewRandomMediaFrom($source,1,1,array("imagestyle" => "test1","subtitle"=>"%a","alttag"=> "%a","imagesize" => "large","subtitlelink" => "","imagelink" => "album"));
$myarray = array("subtitle"=>"%a","alttag"=> "%a","subtitlelink" => "","imagelink" => "album");
$objCpm->cpm_viewLastAddedMedia (1,1,$myarray); 

at the place I want it to be displayed in the // HTML template for the category list.
but it doesn't work, it only displays the code, not the datas.
Did I missed something ?
Do you have any idea if I made it wrong ?

Thank you for your time (sorry for my english and my php wizard skills...)
I guess that I'm a (tenacious) pain.  ::)

vuud

Quote from: balafre on March 08, 2007, 08:33:25 PM
Hi,
as I realised that my previous request was about a different topic (sorry) and if I understand correctly the board policy, I must create this new topic.
Then, my cpmfetch install is fine, I run without problem the datas it provides outside cpmfetch.

Here is the code :
<?php 
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("./cpmfetch/cpmfetch_config.php");
$source "keyword=all-right-mama";
$objCpm->cpm_viewRandomMediaFrom($source,1,1,array("imagestyle" => "test1","subtitle"=>"%a","alttag"=> "%a","imagesize" => "large","subtitlelink" => "","imagelink" => "album"));
$myarray = array("subtitle"=>"%a","alttag"=> "%a","subtitlelink" => "","imagelink" => "album");
$objCpm->cpm_viewLastAddedMedia (1,1,$myarray);  
$objCpm->cpm_close();
?>

My goal is to display these datas in my theme.php file in the main category section (coppermine home page).
I have read the docs and search the board.
So I split <?php 
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("./cpmfetch/cpmfetch_config.php");

and ?> to the begining and at the end of my theme.php and remain the rest of the code :
$source = "keyword=all-right-mama";
$objCpm->cpm_viewRandomMediaFrom($source,1,1,array("imagestyle" => "test1","subtitle"=>"%a","alttag"=> "%a","imagesize" => "large","subtitlelink" => "","imagelink" => "album"));
$myarray = array("subtitle"=>"%a","alttag"=> "%a","subtitlelink" => "","imagelink" => "album");
$objCpm->cpm_viewLastAddedMedia (1,1,$myarray); 

at the place I want it to be displayed in the // HTML template for the category list.
but it doesn't work, it only displays the code, not the datas.
Did I missed something ?
Do you have any idea if I made it wrong ?

Thank you for your time (sorry for my english and my php wizard skills...)
I guess that I'm a (tenacious) pain.  ::)

First, congratulations on getting cpmfetch working.

Second, by doing so - you are not my problem anymore :D

You pretty much need to figure out how to execute PHP from the CPG templates... I have no idea how to do that, but if you can get that far - then you can easily add in the cpmfetch code. 

The only thing is that your include statement (once you get it in somehow) will need to reflect starting in the CPG directory (where your CPG gallery index.php file is).

Let us know how it works out...  a templating area of the site here may be helpful

Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

balafre

Hi !
In fact I did'nt manage to integrate cpmfetch in theme.php.
The only  way I succeded was in modifying index.php which is not recommanded at all.
So this topic seems to be solved.
Thanks for your time.
:)