Results 1 to 8 of 8
  1. #1
    Join Date
    Sep 2007
    Posts
    26
    Plugin Contributions
    0

    Default Making an EZ-page with PHP code?

    Hi,

    I need to add the equivalent to an EZ-page but it must contain some PHP code as I am doing some specific server-side operations on that page.

    How can I do this?

    I tried creating a directory called "php_script" in my includes/templates/CUSTOM/ directory and copied tpl_main_page.php in there and then tried calling index.php?main_page=php_script in my browser but just got a 404 error. How can I point the controller to my script?

    Thanks!
    Emil F.,
    nCube Solutions
    http://www.ncube.ca

  2. #2
    Join Date
    Apr 2004
    Location
    UK
    Posts
    5,821
    Plugin Contributions
    2

    Default Re: Making an EZ-page with PHP code?

    http://www.zen-cart.com/forum/showth...es+include+php
    Previous thread at url above may help

  3. #3
    Join Date
    Sep 2007
    Posts
    26
    Plugin Contributions
    0

    Default Re: Making an EZ-page with PHP code?

    Thanks, that's helpful.

    However, this seems to be a particularly slow solution. If the PHP is stored in a database then the whole thing must be running through an eval() statement?

    Is there a way to achieve the same functionality by simply creating a PHP script and having it be included whenever a certain url is accessed, the same way the templating system works for shopping cart pages for example? (ie copying & modifying tpl_main_page.php into includes/templates/CUSTOM/shopping_cart dir modifies the page index.php?main_page=shopping_cart)
    Emil F.,
    nCube Solutions
    http://www.ncube.ca

  4. #4
    Join Date
    Jun 2003
    Posts
    33,721
    Plugin Contributions
    0

    Default Re: Making an EZ-page with PHP code?

    Perhaps a bit more detail in exactly what you are trying to accomplish would help get better advice?
    Please do not PM for support issues: a private solution doesn't benefit the community.

    Be careful with unsolicited advice via email or PM - Make sure the person you are talking to is a reliable source.

  5. #5
    Join Date
    Sep 2007
    Posts
    26
    Plugin Contributions
    0

    Default Re: Making an EZ-page with PHP code?

    I basically want to output form variables on a custom page.

    So on my home page I have:

    HTML Code:
    <form method="post" action="formscript.php">
    <input type="text" name="test" />
    <input type="submit" value="Submit" />
    </form>
    And on formscript.php I would have:
    PHP Code:
    <?php echo $_POST['test'?>
    I need formscript.php to output this in the main box of the ZenCart template.

    It's just adding a basic custom application to a zencart installation...not sure how else to explain it.
    Emil F.,
    nCube Solutions
    http://www.ncube.ca

  6. #6
    Join Date
    Sep 2007
    Posts
    26
    Plugin Contributions
    0

    Default Re: Making an EZ-page with PHP code?

    another way of asking the same thing is:
    how can I add a new page to Zen Cart without using the EZ-page editor and instead actually creating a new file?
    Emil F.,
    nCube Solutions
    http://www.ncube.ca

  7. #7
    Join Date
    Sep 2007
    Posts
    26
    Plugin Contributions
    0

    Default Re: Making an EZ-page with PHP code?

    figured out a complicated way of doing this...in case anyone out there had a similar problem:

    1- create an EZ page with the name you want and note its ID
    2- edit templates\template_page_default.php, changing:

    PHP Code:
    echo $var_pageDetails->fields['pages_html_text']; 
    to

    PHP Code:
    if ($var_pageDetails->fields['pages_id']=="YOUR_ID"){ 
        require(
    $template->get_template_dir('SCRIPT_NAME.php',DIR_WS_TEMPLATE$current_page_base,'SCRIPT_DIR'). '/SCRIPT_NAME.php');
    } else { 
        echo 
    $var_pageDetails->fields['pages_html_text']; 
    ?> 
    place your script in the templates/CUSTOM/SCRIPT_DIR directory
    Emil F.,
    nCube Solutions
    http://www.ncube.ca

  8. #8
    Join Date
    Jan 2004
    Posts
    66,446
    Plugin Contributions
    81

    Default Re: Making an EZ-page with PHP code?

    Quote Originally Posted by emilfalcon View Post
    another way of asking the same thing is:
    how can I add a new page to Zen Cart without using the EZ-page editor and instead actually creating a new file?
    Just add a new page!

    You could use the About Us contribution in the downloads area as an example. It contains a readme which explains the process. There are some other additional-page contributions which could be adapted similarly.
    .

    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. Html code making space on description page
    By brunello in forum Setting Up Categories, Products, Attributes
    Replies: 8
    Last Post: 17 May 2011, 10:43 PM
  2. Making a form with PHP in EZ-Pages
    By buzzfever in forum General Questions
    Replies: 1
    Last Post: 23 Jul 2010, 04:17 PM
  3. Run EZ Page with PHP code
    By TheGuest in forum General Questions
    Replies: 1
    Last Post: 19 Aug 2009, 08:20 PM
  4. Making copy of site fails to show any page but index.php
    By onpointlasers in forum Installing on a Linux/Unix Server
    Replies: 10
    Last Post: 12 Sep 2007, 09:00 PM

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