Setup:
EE 1.6.8
Build 20100121
Hosting Environment: MAMP (PHP 5.2.11), VirtualHostX
I’m working on a use of PHP in template to do a simple calculation. Result when viewing rendered template: Blank.
Tossed out the calculation PHP code and attempted to do a simple hello world in PHP. Result: blank.
Template Preferences for news/view_debug (the path and template):
Allow PHP: Yes
PHP Parsing Stage: Output
<?php echo "hello, world!"; ?>When I use Parsing PHP on output, the page is blank.
When I change it to PHP on input (just to test; for this situation I’ll want to do PHP on output), this is the error message I get:
Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /Volumes/KTHXBAI/vhosts/mysitename.dev/system/core/core.functions.php(634) : eval()‘d code on line 35
This is line 35 of my template, the most recent location where I put the hello world (it’s inside of exp:weblog:entries tag pair)
<h2 class="title"><?php echo "hello, world!"; ?> <a href="http://{title_permalink=news/view}" title="Perm…"> {title} </a></h2>Moved it outside exp:weblog:entries.
Cleared all caches.
debugging on, debugging off.
No joy.
Clues and assists for this baffling situation?
. . . . . . .
Background and where I’m eventually going: Thanks to LOW’s EECI2010 SF PHP and templates session, I feel brave enough to give PHP in templates a go. Working toward eventually putting together Matrix, Imgsizer (and, we hope, LG Replace) in order to do AJP’s wonderful image replacement trick, with the addition of re-creating the EE out-of-the-box javascript pop-up thumbnail link routine to ‘click to embiggen’.
Why I wish to use PHP: Do a very simple calculation to take imgsizer’s { width } and { height } values and add 15 in order to mimic EE’s out of the box pop-up thumbnail link code. (Prefer image showing up in sep window, tho I could do Lightbox instead if this all fails.) Want to use matrix+imgsizer to create what’s viewed on the page, and adjust its size either by changing img-width settings in the appropriate Matrix and/or force a size change in my template. This is step 0.5 before doing a site redesign where column widths and image widths may change with the next rev of the site.