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: Insert php in theme.php  (Read 4888 times)

0 Members and 1 Guest are viewing this topic.

attempt

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Insert php in theme.php
« on: July 28, 2007, 06:41:28 pm »

How can i insert php in theme.php? If i insert something like:
Code: [Select]
<?php
echo "test";
?>
it's not displayed, but if i look into the source of the page, it is there like above.
« Last Edit: July 30, 2007, 04:48:45 pm by Nibbler »
Logged

Nibbler

  • Guest
Re: Insert php in theme.php
« Reply #1 on: July 28, 2007, 06:55:53 pm »

Leave out the php tags. For more details post what you are trying to accomplish.
Logged

attempt

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Insert php in theme.php
« Reply #2 on: July 28, 2007, 07:02:59 pm »

If so, it displays as text
echo "test";

I want to insert an rssfeed using rss2html. It works on other page with php or html extension, but not working in coppermine.
Logged

attempt

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Insert php in theme.php
« Reply #3 on: July 28, 2007, 07:08:31 pm »

I observed that it depends where I insert the code. I want to be inserted in
"// HTML template for the image rating box" section, but if I put the php code after EOT of this section it is displayed but not where I want to.
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: Insert php in theme.php
« Reply #4 on: July 28, 2007, 10:21:17 pm »

I've used rss2html with coppermine a long time ago. IRC I inserted the code into template.html.

I was displaying an image generated by rss2html so just had to include an img src tag but it's quite simple to add any element of the feed to template.html
Logged
It is a mistake to think you can solve any major problems just with potatoes.

Nibbler

  • Guest
Re: Insert php in theme.php
« Reply #5 on: July 28, 2007, 11:11:45 pm »

You can't use php in template.html. You can add php into your theme.php but you need to know how to write valid php. The way you are trying to do it is not valid. Post the exact code you need to insert.
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: Insert php in theme.php
« Reply #6 on: July 28, 2007, 11:51:26 pm »

Nibbler,

With rss2html you don't really need php, that was my point. It generates a page from it's own script and you just display elements of that.  In my case it generated a weather graphic depending on location and that graphic was just displayed within template.html.

Hope this makes my reasoning clearer. I'm not too good at explaining things sometimes.
Logged
It is a mistake to think you can solve any major problems just with potatoes.

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: Insert php in theme.php
« Reply #7 on: July 28, 2007, 11:59:16 pm »

Sorry to add another post.

Here is a better explanation of how it works.

http://www.feedforall.com/php-documentation.htm
Logged
It is a mistake to think you can solve any major problems just with potatoes.

attempt

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Insert php in theme.php
« Reply #8 on: July 29, 2007, 07:44:55 pm »

If anyone will be able to help me with the test code, I'll manage with any other php code.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: Insert php in theme.php
« Reply #9 on: July 30, 2007, 07:40:38 am »

Do as Nibbler suggested:
For more details post what you are trying to accomplish.
Logged

attempt

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Insert php in theme.php
« Reply #10 on: July 30, 2007, 10:44:43 am »

Code: [Select]
// HTML template for the image rating box
$template_image_rating = <<<EOT

       <tr>
                <td>
<div align="justify" class="graybox postmetadata">
<h3 style="margin: 0 0 0;"><span style="float:left">{TITLE}</span></h3>
      <p><span style="float:right">{VOTES}</span></p>
      <p><br />
      </p>
      <table width="100%"><tr>
                <td width="" align="center"><a href="{RATE0}" title="{RUBBISH}"><img src="themes/oranje/images/rating0.gif" alt="{RUBBISH}" border="0" /><br /></a></td>
                <td width="" align="center"><a href="{RATE1}" title="{POOR}"><img src="themes/oranje/images/rating1.gif" alt="{POOR}" border="0" /><br /></a></td>
                <td width="" align="center"><a href="{RATE2}" title="{FAIR}"><img src="themes/oranje/images/rating2.gif" alt="{FAIR}" border="0" /><br /></a></td>
                <td width="" align="center"><a href="{RATE3}" title="{GOOD}"><img src="themes/oranje/images/rating3.gif" alt="{GOOD}" border="0" /><br /></a></td>
                <td width="" align="center"><a href="{RATE4}" title="{EXCELLENT}"><img src="themes/oranje/images/rating4.gif" alt="{EXCELLENT}" border="0" /><br /></a></td>
                <td width="" align="center"><a href="{RATE5}" title="{GREAT}"><img src="themes/oranje/images/rating5.gif" alt="{GREAT}" border="0" /><br /></a></td>
        </tr></table>
</div>
<center>
$XMLFILE = "http://stiri.myweb.ro/e107_plugins/rss_menu/rss.php?1.1";
$TEMPLATE = "http://www.myweb.com/templaterss.html";
$MAXITEMS = "4";
include("rss2html.php");
</center>
</td>
</tr>
EOT;

the section between center tag is my code. It could be very well: echo "please show";
Logged

Nibbler

  • Guest
Re: Insert php in theme.php
« Reply #11 on: July 30, 2007, 12:00:22 pm »

Code: [Select]
$XMLFILE = "http://stiri.myweb.ro/e107_plugins/rss_menu/rss.php?1.1";
$TEMPLATE = "http://www.myweb.com/templaterss.html";
$MAXITEMS = "4";

ob_start();
include("rss2html.php");
$rss = ob_get_clean();

// HTML template for the image rating box
$template_image_rating = <<<EOT

       <tr>
                <td>
<div align="justify" class="graybox postmetadata">
<h3 style="margin: 0 0 0;"><span style="float:left">{TITLE}</span></h3>
      <p><span style="float:right">{VOTES}</span></p>
      <p><br />
      </p>
      <table width="100%"><tr>
                <td width="" align="center"><a href="{RATE0}" title="{RUBBISH}"><img src="themes/oranje/images/rating0.gif" alt="{RUBBISH}" border="0" /><br /></a></td>
                <td width="" align="center"><a href="{RATE1}" title="{POOR}"><img src="themes/oranje/images/rating1.gif" alt="{POOR}" border="0" /><br /></a></td>
                <td width="" align="center"><a href="{RATE2}" title="{FAIR}"><img src="themes/oranje/images/rating2.gif" alt="{FAIR}" border="0" /><br /></a></td>
                <td width="" align="center"><a href="{RATE3}" title="{GOOD}"><img src="themes/oranje/images/rating3.gif" alt="{GOOD}" border="0" /><br /></a></td>
                <td width="" align="center"><a href="{RATE4}" title="{EXCELLENT}"><img src="themes/oranje/images/rating4.gif" alt="{EXCELLENT}" border="0" /><br /></a></td>
                <td width="" align="center"><a href="{RATE5}" title="{GREAT}"><img src="themes/oranje/images/rating5.gif" alt="{GREAT}" border="0" /><br /></a></td>
        </tr></table>
</div>
<center>
$rss
</center>
</td>
</tr>
EOT;
Logged

attempt

  • Coppermine novice
  • *
  • Offline Offline
  • Posts: 26
Re: Insert php in theme.php
« Reply #12 on: July 30, 2007, 03:12:06 pm »

thank you
Logged
Pages: [1]   Go Up
 

Page created in 0.018 seconds with 15 queries.