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: using php in themes.inc.php  (Read 4340 times)

0 Members and 1 Guest are viewing this topic.

thapame

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 72
using php in themes.inc.php
« on: April 07, 2007, 10:54:15 am »

how to use php code in the file themes.inc.php between <<<EOT and EOT;
« Last Edit: April 08, 2007, 02:11:43 pm by GauGau »
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: using php in themes.inc.php
« Reply #1 on: April 07, 2007, 11:09:02 am »

1) Don't edit include/themes.inc.php! Edit themes/yourtheme/theme.php instead
2) Heredoc syntax: http://www.php.net/manual/en/language.types.string.php#language.types.string.syntax.heredoc
Logged

thapame

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 72
Re: using php in themes.inc.php
« Reply #2 on: April 07, 2007, 11:18:15 am »

I am confused about the heredoc, well simply want to use php include(); function to include php files between {IMAGE} and {TITLE} on displayimage.php
so how could i do that.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: using php in themes.inc.php
« Reply #3 on: April 07, 2007, 11:33:07 am »

Just end the hereodc stamement, include your stuff and the re-start it. Example:
Code: [Select]
$foobar = <<< EOT
<ul>
<li>some content</li>
<li>yet some more content</li>
</ul>
EOT;
might become
Code: [Select]
$foobar = <<< EOT
<ul>
<li>some content</li>
<li>yet some more content</li>
EOT;
// do some custom PHP stuff here
include('your/custom/include.php');
// re-start the heredoc-definition of the variable. Note the dot in front of the equal sign.
$foobar .= <<< EOT
</ul>
EOT;
However, don't forget that you're populating a variable - you need to know your way around in PHP to accomplish what you're up to.
Logged

thapame

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 72
Re: using php in themes.inc.php
« Reply #4 on: April 07, 2007, 11:44:23 am »

the include file works but the file display at the top of the window.
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: using php in themes.inc.php
« Reply #5 on: April 07, 2007, 11:47:31 am »

Probably because you're not populating the variable, but just output your stuff. As suggested: you need to understand PHP to do what you're up to. No use in discussing this on the abstract level. Post a real life link and the code you actually applied.
Logged

thapame

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 72
Re: using php in themes.inc.php
« Reply #6 on: April 07, 2007, 11:53:59 am »

Code: [Select]
$template_display_media = <<<EOT
..........
.....
...
EOT;
print "my custom php";
$template_display_media.= <<<EOT
..........
.....
...
EOT;


link: http://www.pictures.com.np/displayimage.php?album=51&pos=68
Logged

thapame

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 72
Re: using php in themes.inc.php
« Reply #7 on: April 07, 2007, 12:40:02 pm »

the problem is solved
Logged

Joachim Müller

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 47843
  • aka "GauGau"
    • gaugau.de
Re: using php in themes.inc.php
« Reply #8 on: April 08, 2007, 02:11:29 pm »

You should have posted what you did to sove your issue, for the benefit of others.
Logged

thapame

  • Coppermine regular visitor
  • **
  • Offline Offline
  • Posts: 72
Re: using php in themes.inc.php
« Reply #9 on: April 09, 2007, 09:09:32 am »

Code: [Select]
$foobar = <<< EOT
<ul>
<li>some content</li>
<li>yet some more content</li>
EOT;

// do some custom PHP stuff here
#####php stuffs
$foobar.="#####php stuffs output";
// re-start the heredoc-definition of the variable. Note the dot in front of the equal sign.

$foobar.= <<< EOT
</ul>
EOT;

Logged
Pages: [1]   Go Up
 

Page created in 0.047 seconds with 15 queries.