using php in themes.inc.php using php in themes.inc.php
 

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

using php in themes.inc.php

Started by thapame, April 07, 2007, 10:54:15 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

thapame

how to use php code in the file themes.inc.php between <<<EOT and EOT;

Joachim Müller

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

thapame

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.

Joachim Müller

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.

thapame

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

Joachim Müller

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.

thapame

$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

thapame


Joachim Müller

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

thapame

$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;