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: Include in Template  (Read 3366 times)

0 Members and 1 Guest are viewing this topic.

lisastar08

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Include in Template
« on: May 09, 2011, 01:20:35 am »

I have a website I have done using wordpress and in my header am using CPMFetch to do a latest images code in the box provided in my layout as such: http://www.madisonandscott.info/word/  I have also integrated my wordpress theme into my gallery, and thus have the same header and my box for "Latest Images", however since the CPMFetch code is in php and template is in .html the code is not working and I have this big empty box in my layout instead: http://madisonandscott.info/gallery/index.php or just filled with the pieces of the code. Im wondering if anyone knows how I can modify to get the latest images to work in my template file? This is the code I have:

Code: [Select]
<?php include"/home/justinbr/public_html/madisonandscott.info/gallery/cpmfetch/cpmfetch.php";
 
$objCpm = new cpm("/home/justinbr/public_html/madisonandscott.info/gallery/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_setfilter($filter ".jpg");
$options = array('windowtarget' => '_blank',"imagewidth"=>"50");
$objCpm->cpm_viewLastAddedMedia(2,4,$options,$filter);
 
$objCpm->cpm_close();
?>
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Include in Template
« Reply #1 on: May 09, 2011, 10:46:26 am »

The easiest solution may be the following. Open your template.html file, cut everything from the first line until (including) the CPMFetch code block and save it in a new php file. In your case it would be
Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">



<html dir="{LANG_DIR}">

<head>

<meta http-equiv="Content-Type" content="text/html; charset={CHARSET}" />

<meta http-equiv="Pragma" content="no-cache" />

<title>Madison and Scott Online | Image Gallery</title>

{META}

<link rel="stylesheet" href="themes/gallery/style.css" type="text/css" />

<link rel="stylesheet" href="themes/gallery/wp_style.css" type="text/css" />

<script type="text/javascript" src="scripts.js"></script>

<!-- $Id: template.html 2688 2005-12-04 03:22:35Z donnoman $ -->

<body>
<div id="bodymain">
<div id="header">


<div id="nav" style="position: absolute; top:21px; width: 1000px; left: 0px; height: 60px;z-index:3">
<a href="http://www.madisonandscott.info/word/?page_id=4">MaScott</a>&nbsp;&nbsp;&nbsp; &hearts;&nbsp;&nbsp;&nbsp;
<a href="http://madisonandscott.info/gallery">Gallery</a>&nbsp;&nbsp;&nbsp; &hearts;&nbsp;&nbsp;&nbsp;

<a href="http://www.youtube.com/user/MaScottOnline">Youtube</a>&nbsp;&nbsp;&nbsp; &hearts;&nbsp;&nbsp;&nbsp;
<a href="http://www.madisonandscott.info/word/?page_id=8">Web</a>&nbsp;&nbsp;&nbsp; &hearts;&nbsp;&nbsp;&nbsp;
<a href="http://www.madisonandscott.info/word/?page_id=10">Site</a>&nbsp;&nbsp;&nbsp; &hearts;&nbsp;&nbsp;&nbsp;
<a href="http://twitter.com/#!/MaScottOnline">Twitter</a>&nbsp;&nbsp;&nbsp; &hearts;&nbsp;&nbsp;&nbsp;
<a href="http://madisonandscott.info">Home</a>&nbsp;&nbsp;&nbsp; &hearts;&nbsp;&nbsp;&nbsp;
</div>
</center></b>

<br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
<div style="position: absolute; top: 267px; width: 280px; left: 35px; height: 95px;" id="welcome">
Welcome to <b>Madison and Scott Online</b>, the ultimate source for All My Childrens hottest new couple, Madison North and Scott Chandler and their
portrayers Stephanie Gatschet and Daniel Cosgrove. Here you can find everything you want to know about Madison and Scott as well as a growing gallery
and more. So take a look around and I hope you like what you see.
</div>
<div style="position: absolute; top: 272px; width: 375px; left: 699px; height: 95px;" id="pics">
<?php include"/home/justinbr/public_html/madisonandscott.info/gallery/cpmfetch/cpmfetch.php";
 
$objCpm = new cpm("/home/justinbr/public_html/madisonandscott.info/gallery/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_setfilter($filter ".jpg");
$options = array('windowtarget' => '_blank',"imagewidth"=>"50");
$objCpm->cpm_viewLastAddedMedia(2,4,$options,$filter);
 
$objCpm->cpm_close();
?>

</div>

As you removed the {CUSTOM_HEADER} token in your theme, restore it at the top of the template.html file.

Now just set the new PHP file as custom header in the Coppermine config.


I haven't tested that, so please report if it works.
Logged

lisastar08

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Include in Template
« Reply #2 on: May 10, 2011, 12:12:26 am »

Hi André,

I put the coding into a file called "header.php" and the path would be: ../themes/gallery/header.php  (theme is just called 'gallery'). I have re-added my {CUSTOM_HEADER} token in my template.html at the top but can't get anything to show up. Ive tried moving {CUSTOM_HEADER} to different places and every time I don't see my header or even get an error. Not sure if Im doing the {CUSTOM_HEADER} coding wrong or not. I have attached my template file in .txt format if needed. Thanks!!
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Include in Template
« Reply #3 on: May 10, 2011, 09:15:19 am »

Unfortunately it doesn't work exactly as I expected (I just tested it in my local testbed). Please restore your template.html file. Now replace the CPMFetch PHP code with the {CUSTOM_HEADER} token in that file. Then, open your header.php file and put just your CPMFetch code into it. Finally adjust the path to the custom header to
Code: [Select]
themes/gallery/header.phpin the config.

If it still won't work, please attach your whole theme (before and after modification - i.e. 2 themes) to your next reply.
Logged

lisastar08

  • Coppermine newbie
  • Offline Offline
  • Posts: 16
Re: Include in Template
« Reply #4 on: May 11, 2011, 01:44:16 am »

Thanks so much André its working now  ;D
Logged

Αndré

  • Administrator
  • Coppermine addict
  • *****
  • Country: de
  • Offline Offline
  • Gender: Male
  • Posts: 15764
Re: Include in Template
« Reply #5 on: May 14, 2011, 08:21:52 pm »

you can tag your answer as "solved" by clicking on the little image in your initial posting on your thread.
Logged
Pages: [1]   Go Up
 

Page created in 0.019 seconds with 19 queries.