coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 themes/skins/templates => Topic started by: thapame on April 07, 2007, 10:54:15 AM

Title: using php in themes.inc.php
Post by: thapame on April 07, 2007, 10:54:15 AM
how to use php code in the file themes.inc.php between <<<EOT and EOT;
Title: Re: using php in themes.inc.php
Post by: Joachim Müller 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
Title: Re: using php in themes.inc.php
Post by: thapame 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.
Title: Re: using php in themes.inc.php
Post by: Joachim Müller on April 07, 2007, 11:33:07 AM
Just end the hereodc stamement, include your stuff and the re-start it. Example:$foobar = <<< EOT
<ul>
<li>some content</li>
<li>yet some more content</li>
</ul>
EOT;
might become$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.
Title: Re: using php in themes.inc.php
Post by: thapame on April 07, 2007, 11:44:23 AM
the include file works but the file display at the top of the window.
Title: Re: using php in themes.inc.php
Post by: Joachim Müller 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.
Title: Re: using php in themes.inc.php
Post by: thapame on April 07, 2007, 11:53:59 AM
$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
Title: Re: using php in themes.inc.php
Post by: thapame on April 07, 2007, 12:40:02 PM
the problem is solved
Title: Re: using php in themes.inc.php
Post by: Joachim Müller on April 08, 2007, 02:11:29 PM
You should have posted what you did to sove your issue, for the benefit of others.
Title: Re: using php in themes.inc.php
Post by: thapame on April 09, 2007, 09:09:32 AM
$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;