PHP in template/theme PHP in template/theme
 

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

PHP in template/theme

Started by roverradio, August 29, 2004, 07:16:18 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

roverradio

Upgraded from 1.0 to 1.3.2.  Integration of the gallery into your site is now much different, but for the better...  but I am having a problem.

I have some PHP code in template.html.  Essentially, all the code does is add a line of text input boxes on the page if it is between 6 and 10 AM (somewhat simplified).

Problem is, it jumps out in the middle of the PHP code, and the PHP code is treated as plain HTML and displayed on the page.  The code works properly in a standalone PHP page.  Just not sure how to integrate it into a template/theme.

Here's the code...and below I'll detail where it breaks out:

<?php
$hour = date("H");
$dayofweek = date("D");
$displayim="1";
if ($dayofweek=="Sun" or $dayofweek=="Sat") $displayim="0";
if ($hour<6 or $hour>9) $displayim="0";
if ($displayim=="1")
{
echo <<<FOO
 <tr align="left" bgcolor="#FF6600">
   <td colspan="2" valign="middle" bgcolor="#FF6600" class="IMheader">
   <font color="#000000"><strong>&nbsp;&nbsp;&nbsp;&nbsp;SEND AN INSTANT MESSAGE!</strong></font><strong> </strong><strong><span class="IMheader">&nbsp;&nbsp;&nbsp;Name:
       <input name="name" type="text" id="name" style="font-family: verdana; font-size: 10px; border-color:#3871A9;border-width=1px;" size="15" maxlength="50" alt="blank">
&nbsp;&nbsp; </span> <span class="tablenomargins">City:
<input name="city" type="text" id="city" size="15" style="font-family: verdana; font-size: 10px; border-color:#3871A9;border-width=1px;" maxlength="50" alt="blank">
&nbsp;&nbsp; Message:
<input name="yousay" type="text" id="yousay" value="" size="30" style="font-family: verdana; font-size: 10px; border-color:#3871A9;border-width=1px;" maxlength="200" alt="blank">
&nbsp;
<input name="submit" type="submit" id="submit" value="Send" style="font-family: verdana; font-size: 9px;border-width=1px;">
</span></strong>
   </td>
 </tr>
   <tr>
     <td colspan="3" valign="top" class="px1"><img src="http://www.###site.com/rover/images/spacer.gif" width="1" height="10"></td>
   </tr>
FOO;

}

?>
 </table>
</form>
<?php
if ($displayim=="0")
{
echo "<img src=\"http://www.###site.com/rover/images/spacer.gif\" width=\"1\" height=\"10\">";
}
?>

----------

Here's the point at where it breaks out:

if ($hour<6 or $hour>[BREAKS AT THIS POINT]9) $displayim="0";

essentially, it puts

9) $displayim="0";
if ($displayim=="1")
{
echo <<<FOO


on the page, then echoes the table/text input boxes correctly, then puts

"; } ?>

on the page after the table.

Been trying to solve this for a couple of hours.  Any help greatly appreciated!

Thanks!

roverradio

Found out you can't put PHP in tempalte.html (was searching the 1.3 board and nothing cam eup, expanded to include 1.2 board and a few examples of this appeared).

For anyone with the same issue, the followiung thread worked:

http://forum.coppermine-gallery.net/index.php?topic=6175.0

The first example didn't work for me (didn't try screwing with it too much to figure out why), but I moved on to the second example and it worked like a charm.

Remember, if you're using Dreamweaver (or another editor) to put your customheader/footer php files in the root gallery directory to keep links correct.