Include in Template Include in Template
 

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

Main Menu

Include in Template

Started by lisastar08, May 09, 2011, 01:20:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

lisastar08

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:

<?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();
?>

Αndré

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

lisastar08

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!!

Αndré

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
themes/gallery/header.php
in 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.

lisastar08

Thanks so much André its working now  ;D

Αndré

Quote from: Joachim Müller on September 28, 2008, 12:46:26 PM
you can tag your answer as "solved" by clicking on the little image in your initial posting on your thread.