coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 cpmFetch by vuud => Topic started by: balafre on March 08, 2007, 08:33:25 PM

Title: integrating cpmfetch in theme.php
Post by: 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.  ::)
Title: Re: integrating cpmfetch in theme.php
Post by: vuud on March 08, 2007, 08:47:58 PM
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

Title: Re: integrating cpmfetch in theme.php
Post by: balafre on March 19, 2007, 09:01:52 PM
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.
:)