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
    Posts
    26,493
    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
    Get Your Business Found

  4. #4
    Join Date
    Sep 2004
    Posts
    1,390
    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,390
    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
    60,195
    Blog Entries
    4
    Plugin Contributions
    139

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

    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    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. Cannot complete database setup Step. Error encountered while writing /include
    By samcyh in forum Installing on a Windows Server
    Replies: 1
    Last Post: 13 Oct 2006, 03:31 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
  •