Zen Follower
- Join Date:
- Sep 2007
- Posts:
- 176
- Plugin Contributions:
- 0
Running PHP in EZ-Pages
Can you run php code within an ez-page?
I added some code but it keeps getting commented out.
<?php
``` turns into ```
<!--?php
Thanks
Views: 885
Zen Follower
Can you run php code within an ez-page?
I added some code but it keeps getting commented out.
<?php
``` turns into ```
<!--?php
Thanks
Totally Zenned
In general, you cannot run php in an EZpage, because the CONTENT of EZPages is stored in the database, not in the file system. As the sequence of output assembly is important in PHP, it would have "run its course" before the database content is parsed into the output.
It's kinda a "cart before the horse" situation.
There IS an over-ride - and it has been discussed before on the forum, so try look for it.
Additionally, you could try either switching OFF your CK Editor while you work on source-type coding, or you could "toggle" to source mode, and SAVE without toggling back to wysiwyg.
But you will probably still need the over-ride technique first...
Zen Follower
Thank you for the quick reply.
I have had luck using php code in a "Define Page", ie; page_2.php. What is the process for adding additional Define Pages? page_5.php, etc...
Totally Zenned
Define pages are FILE BASED (not stored in the database like EZpages are).
Zen Follower
I can find page_2.php defined in three locations:
/includes/templates/default_template/templages
/includes/languages/english/html_includes/
/includeslanguages/english/MY_TEMPLATE/
I have copied and renamed to page_5.php, but it is not picking it up. I think I must be missing a page somewhere.
Totally Zenned
There is a technique to creating and/or re-naming the define pages. I do not use these extra pages any more, so I've forgotten the procedure, but there are lots of posts about how you do this, and I think there is also a Tutorial/FAQ topic on it.
Zen Follower
Thank you for your assistance. I'm off to the FAQ section!
Totally Zenned
Remember also to follow the principles of the OVER-RIDE system
You will always need a DEFAULT define page in the ROOT html_includes folder
\includes\languages\english*html_includes*
(In here you will see all the CORE define_page_xxxx.php files)
Then, you need an OVER-RIDE for each and every one, in the OVER-RIDE folder:
\includes\languages\english*html_includes*YOUR_TEMPLATE_FOLDER
Totally Zenned
If you do not have a YOUR_TEMPLATE_NAME folder at that location, create one...
make sure ALL the define_page_xxxx.php files are COPIED into that over-ride folder, as (if there is no over-ride folder) it is likely you have been editing the CORE files.
In general, the RULE for over-ride folders is quite simple (especially in the languages directories...)
Wherever you see a "classic" folder, you will need a CUSTOM folder named after the custom template you are using. These "over-ride" folders are only needed when you make customisations (edits) to a CORE or DEFAULT file.
It is NOT necessary to have an over-ride folder if there are no CUSTOM edits to a core file, but one of the first things I do when installing a new template, is go create all the corresponding over-ride folders - and I just leave them empty.
There is a download in the plugins area that illustrates the over-ride directory tree. But as I said... Wherever you see a "classic" folder, it indicates the "availability" of an over-ride folder named after your custom template.
Zen Follower
Thank you for all the info.
I followed it and now have page_5 - page_10 up and running!!!
I probably won't need all 10, but they are there and ready if I ever do.
Totally Zenned
Excellent...
Another useful "trick" is to leverage the capacity for EZ-pages to act as internal hyperlinks.
What I do on most sites, is de-activate the "Information" sidebox completely - and all the "define pages" and other internal links in that box, I assign to EZ-Pages, using the "internal link" function.
So... for example: I create an EZ-Page called "Contact Us", then in the "Internal Link" field, I type: index.php?main_page=contact_us .
I now have a feature where I can place the "EZ-Page" (now just a link) in either the HEADER BAR, SIDEBOX or FOOTER (or any combination of these three).
This allows for putting things like "Privacy Notice" and "Conditions of Use" in the footer, using "Above-The-Fold" space for more important content such as BUY THIS PRODUCT!
Tell staff why this post should be reviewed.