Advanced search  

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

Pages: [1]   Go Down

Author Topic: integrating cpmfetch in theme.php  (Read 5854 times)

0 Members and 1 Guest are viewing this topic.

balafre

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 29
integrating cpmfetch in theme.php
« 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 :
Code: [Select]
<?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
Code: [Select]
<?php 
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("./cpmfetch/cpmfetch_config.php");
and
Code: [Select]
?> to the begining and at the end of my theme.php and remain the rest of the code :
Code: [Select]
$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.  ::)
« Last Edit: March 20, 2007, 08:00:02 am by GauGau »
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: integrating cpmfetch in theme.php
« Reply #1 on: March 08, 2007, 08:47:58 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 :
Code: [Select]
<?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
Code: [Select]
<?php 
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("./cpmfetch/cpmfetch_config.php");
and
Code: [Select]
?> to the begining and at the end of my theme.php and remain the rest of the code :
Code: [Select]
$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

Logged
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

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 29
Re: integrating cpmfetch in theme.php
« Reply #2 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.
 :)
Logged
Pages: [1]   Go Up
 

Page created in 0.022 seconds with 19 queries.