Zen Cart Logo
Forums / Templates, Stylesheets, Page Layout / PHP code inside of an EZ page

PHP code inside of an EZ page

Views: 1,268

Results 1 to 3 of 3
17 Dec 2012, 10:36 PM
#1
tcarden avatar

tcarden

Zen Follower

Join Date:
Oct 2012
Posts:
282
Plugin Contributions:
0

PHP code inside of an EZ page

very curious, i was trying to run some PHP inside of an EZ page and it is being completely ignored.
does anyone know why,

here's an excerpt. to troubleshoot i kept removing things until all that was left was an echo statement.
and also, just to troubleshoot, it is followed by some JS which runs just fine

<h2>Request Information</h2>
<p>If you would prefer that we contact you, please complete the relevant fields on the form below and click the
submit button. A Starlight.com representative will contact you promptly.
</p>
<?php  

echo 'Hello! ';
?>
<script type="text/javascript">alert('hello')</script>


</div>
18 Dec 2012, 3:38 AM
#2
gjh42 avatar

gjh42

Black Belt

Join Date:
Jul 2005
Location:
Upstate NY
Posts:
21,876
Plugin Contributions:
8

Re: PHP code inside of an EZ page

EZ-Pages hold only HTML (and by extension javascript) code. You can't execute PHP in ez-page content without a method that opens a possible window to hackers. This is due to the fact that ez-pages are stored in the database as data, not in files as executable code. The short discussion here:

http://www.zen-cart.com/showthread.php?187934-Need-PHP-in-an-EZpage-What-override-file-can-I-put-it-in-and-where&highlight=PHP+in+ez-pages

points to the very long discussion and a good alternative, creating a define page for your PHP content.

18 Dec 2012, 4:19 PM
#3
tcarden avatar

tcarden

Zen Follower

Join Date:
Oct 2012
Posts:
282
Plugin Contributions:
0

Re: PHP code inside of an EZ page

thanks for the info,