I'm good to use the eval function method. I just need to know how I can place php code into a page via a wysiwyg editor in ezpages. Like I said, the default embeded wysiwig is erasing my code. How are you guys doing this?
Code:$titlecheck=substr($var_pageDetails->fields[pages_title],0,9); if ($titlecheck=="allowcode"){ eval(stripslashes($var_pageDetails->fields['pages_html_text']));} else{echo $var_pageDetails->fields['pages_html_text']; }This way of using php in EZ-pages works in 1.3.6, but if used as an EZ-link and the "allowcode" check is used, how do you avoid the actual link to include "allowcode"?Change "allocode" to whatever name you want your php code ezpages to have, or add more names or remove the if alltogether if you want. (dont forget to change ,0,9 to ,0,x where x is the length of your "allowcode" replacement string.
Or do you grab the EZ-page content directly from the database into another page (such as an info page) somehow? If so - how?
My use is to store, say, seasonal texts (spring, summer, winter etc) as EZ-pages or define pages, and then in another EZ-page, or the main page, or in a category text reference the predefined seasonal EZ-page/define page -> an easy way to shift "templates" stored as EZ-pages. I see a huge potential for using ez-pages as "includes" on other pages (such as the main page, category descriptions, in the blank_sidebox) etc.
Last edited by Wils; 19 Nov 2006 at 10:32 PM. Reason: Clarification
This may be a solution for those using built-in WYSIWYG editors to edit PHP code. Unforutunately, both HTMLArea and TinyMCE WILL remove or damage PHP code.
The good new is that FCKEditor "knows" about PHP and leaves it alone. You can grab it from Zen Cart downloads section here: http://www.zen-cart.com/index.php?ma...roducts_id=268. It should work "right out of the box". If, however, you get an updated version from http://www.fckeditor.net/, you'll need to edit a configuration file - specifically add or uncomment one line in fckconfig.js
The version from the downloads section already has this line uncommented, so you don't need to do it.Code:FCKConfig.ProtectedSource.Add( /<\?[\s\S]*?\?>/g ) ;
Note: you'll only see the PHP code in "Source" mode, it will not be visible in normal mode.
Feedback is welcome!
Dan G.
Notebook Solutions Inc.
http://www.notebooksolutions.ca
I can see it is coded to do this ... but I am having a user moment here ... and not getting it to actually execute the php code ... so what's the trick?
Linda McGrath
If you have to think ... you haven't been zenned ...
Did YOU buy the Zen Cart Team a cup of coffee and a donut today? Just click here to support the Zen Cart Team!!
Are you using the latest? Perhaps you've a problem that's fixed in the latest version: [Upgrade today: v1.5.5]
Officially PayPal-Certified! Just click here
Try our Zen Cart Recommended Services - Hosting, Payment and more ...
Signup for our Announcements Forums to stay up to date on important changes and updates!
I am using ZC 1.3.7
I have tried both methods described in this thread and can not get it to output PHP code.
I am trying to troubleshoot my problem. Does this method work in ZC 1.3.7 ?
Thanks for your support,
Pic
Sorry, I had bad PHP in my test, ignore previous post asking for troubleshooting help.
The both methods work fine in ZC 1.3.7
What are the security issues when using this code?
Thanks for your support,
Pic
Hello All,
I didn't have any problem putting the .php code into my ezpage but i do have a problem with the page opening sub-pages.
What i'm trying to do is use a PHP link manager code to manage links. The code works great until you click on a catagory to see the links inside that catagory. I'm thinking it has something to do with dynamic link page numbers since the linked page info is looking for /resources.php?cid=1831 and Zen uses /index.php?main_page=page&id=3&chapter=1
is there anyway to get around that other than installing USEO? which looks great, but seems to have some problems from all the messages and issues i've read.
You can take a look for yourself at:
http://smilesdiscounts.com/index.php...id=3&chapter=1
Thanks in advance!
Cornell
Use the simplified version given by brandtim 20th June 2006, 07:04 PM.
It's simply better. If for some reason, that just won't work for you, choose a word that is keyword rich in place of "allowcode". Just remember to replace the "9" in "],0,9)" with the length of your keyword. Then it won't (or shouldn't) matter if it shows up in the link.Code:<?php eval(stripslashes('?>' . $var_pageDetails->fields['pages_html_text'])); ?>
You could also do multiple title checks, but that requires a hard edit for every page where you want to allow the code. Take out the substring part, and test the full stringCode:if ($titlecheck=="allowcode" || $titlecheck=="Some Page Title" || $titlecheck=="Another Page"){...
OK, I am a bit slow and I don't understand how EZPages are generated. I have this code that I want to put on http://www.giftsbearsetc.com/store/i...id=1&chapter=0
via EZPages.
<?php
/*<--- BEGIN MY LINK HELPER CODE --->
Making modifications to this code can cause your links page to stop working. Please only make
modifications where modifications are allowed. Being that this is a free service, we do not have
the resources to help you debug any changes you may have made. If you do run into problems with
this code, log into your account and download the original again.
*/
$OnCat = @$_GET["cid"];
if ($OnCat == "") {$OnCat = "0";} //Set to Main Directory Page
//You may name your links page anything you want. But for your links page to work correctly
//you must provide us with the name of your links page (without the '.php' extension).
$PageName = "resources"; // change this value to match your [PageName].php links page
//You may modify the following variable to change how many columns your main directory displays.
//By default this value is set to show 2 columns, but you may show as few as 1 column or
//as many as 4. Valid values (1,2,3,4)
$DirectoryCols = 2; // change this value to adjust how many columns your main directory page displays
//You may modify the following variable to change how many columns your sub category directory pages display.
//By default this value is set to show 2 columns, but you may show as few as 1 column or
//as many as 4. Valid values (1,2,3,4)
$SubCategoryCols = 2; // change this value to adjust how many columns your sub category pages display
//You may modify the following variable to display your links on a single page instead of
//directory style. This is a convenient way to display your links if you have fewer than 40.
$ShowAsSinglePage = 0; // change this value to 1 if you want a single page, or 0 for directory
$file = file("http://www.mylinkhelper.com/bin/phpdynfetch.asp?id=E65D16FF-A31E-4886-B052-9F52754E9A93&pagename=".$PageName."&cid=".$OnCat."&dircols=".$DirectoryCols."&su bcols=".$SubCategoryCols."&single=".$ShowAsSinglePage);
if ($OnCat == "0") {
//This value is the title for your main directory page and can be modified
$sTitle = "Gifts Bears Etc.";
$GetLinks = $file[0];
} else {
$iPos = strpos($file[0], "|");
$sTitle = substr($file[0],0,$iPos);
$GetLinks = substr($file[0],$iPos + 1,strlen($file[0]));
}
//<--- END MY LINK HELPER CODE --->
?>
<!--
Place the following code into the location of your webpage template that you want your
directory to be displayed, it will assume the link syles and sizes you have defined
in your stylesheet.
Also, don't forget to use the "sTitle" variable to customize the page!
Please delete this comment when you implement your links directory.
-->
<title><?=$sTitle;?></title>
<?=$GetLinks;?>
This will display a links page. What do I do? I need specific instructions or I will fail for sure! Thanks...
Amy McCoy
Baby Gifts and Baby Gift Baskets
Bookmarks