Results 1 to 7 of 7
  1. #1
    Join Date
    Jan 2006
    Posts
    10
    Plugin Contributions
    0

    Default How can I execute PHP code in a page?

    I'd like to setup a custom order form for a special product. This probably won't even go through the zencart checkout system, its just a way to fill out a form and submit it.

    I could just stick up a php page on my side, but I'd really like it to look like the rest of the site, with header, footer, menus, etc. So I started doing it in one of my custom pages using the page editor, but when I view the site, all my php code ( stuff between <?php and ?>) was stripped out.

    How can I have a page on the site that will be executed? I've dug around these forums and various FAQs but couldn't find an answer.

    Thanks!

  2. #2
    Join Date
    Jan 2006
    Posts
    10
    Plugin Contributions
    0

    Default Re: How can I execute PHP code in a page?

    Now that I think about it, it may be possible to just do this as a product in the cart. If I can add several custom fields that customers can fill in, and I will use a popup window to show the 15 different color images... what would be nice is if I could make a custom product page, where I could control where the 'color' drop down box shows up, so I can put a link to a popup color picker next to it, etc.

    Any advice appreciated. I'm still curious on how to get zencart to execute php in a page, too.
    Last edited by zirconx; 6 Dec 2006 at 03:37 AM.

  3. #3
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: How can I execute PHP code in a page?

    the editor will process html I know...noit sure about php entered this way. Youcould create a php file to be called and include the applicationtop in it for the same look.

    A form though is normally html kinda like:
    Code:
    <html>
    <head>
    <title>Personal INFO</title>
    </head>
    <body>
    <form method="post" action="<?php echo $PHP_SELF;?>">
    First Name:<input type="text" size="12" maxlength="12" name="Fname">:<br />
    Last Name:<input type="text" size="12" maxlength="36" name="Lname">:<br />
    and then you can enter this in the editor or call it from php.

    I think that Zen Cart uses js forms though
    Zen-Venom Get Bitten

  4. #4
    Join Date
    Sep 2004
    Posts
    1,388
    Plugin Contributions
    4

    Default Re: How can I execute PHP code in a page?

    You cannot enter PHP via FCKEditor, HTMLArea, etc. as these are designed strictly to build HTML pages WYSIWYG-style. They treat everything as if it should appear on the screen exactly as you have typed it, and will strip or otherwise scrub code.

    It's really not that hard to create new pages within the Zen Cart system. Take a look at the templating system. includes/templates/template_default/templates/tpl_page_2_default.php is left over form the pre-"EZ Pages" days, but it's a perfect, simple example of the what and how in building your own pages.

    Speaking of EZ Pages, that could also be a possible solution. You should take a look at the documentation for it to see if you can use that.
    Frank Koehl
    "Cleverly Disguised as a Responsible Adult"

    frankkoehl.com

  5. #5
    Join Date
    Jan 2006
    Posts
    10
    Plugin Contributions
    0

    Default Re: How can I execute PHP code in a page?

    I'm not using the wysiwyg editor, I'm just using the plain text area. I'm not ending up with the actual tags and code, what happens is that the php code is just gone, it seems like zencart is stripping it out.

    If I do AA<?php phpinfo(); ?>BB

    I just end up with AABB on the page.

    And I think I might be using the EZ pages, I'm doing it through the Page Editor, which I think reads and writes files in something like the english/templates directory.

    I think what I'm going to do is have a link to a popup window that has the color options, all 15 images using a roll-over, etc. in it. THen when those choices are done, use javascript to write them back to a text field in the product page.

  6. #6
    Join Date
    Sep 2004
    Posts
    1,388
    Plugin Contributions
    4

    Default Re: How can I execute PHP code in a page?

    Diff scenario, same result: code is scrubbed out from the define pages, as they are only expected to contain HTML.
    I think what I'm going to do is have a link to a popup window that has the color options, all 15 images using a roll-over, etc. in it. THen when those choices are done, use javascript to write them back to a text field in the product page.
    I think you're making this more complicated than it needs to be. Bite the bullet and teach yourself about the templating system. It'll pay dividends when it comes time to do more complex customizations or troubleshoot an upgrade/modification. Definitely speaking from experience on this one.
    Frank Koehl
    "Cleverly Disguised as a Responsible Adult"

    frankkoehl.com

  7. #7
    Join Date
    Jan 2004
    Posts
    66,363
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: How can I execute PHP code in a page?

    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. how can I rename this ads_display2.php code?
    By wycliffn in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 11 May 2012, 04:22 PM
  2. Product page, execute code on out of stock
    By DigitalShadow in forum General Questions
    Replies: 2
    Last Post: 13 Mar 2011, 05:30 PM
  3. how can I code in a default coupon code into checkout page redeem, then auto-refresh?
    By lankeeyankee in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 1
    Last Post: 29 Nov 2008, 04:56 AM
  4. pub = unwritable (chmod 777 read/write/execute) How can i fix this?
    By gmanz73 in forum Installing on a Linux/Unix Server
    Replies: 3
    Last Post: 7 Dec 2006, 11:12 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR