Results 1 to 8 of 8

Hybrid View

  1. #1
    Join Date
    Sep 2012
    Posts
    253
    Plugin Contributions
    0

    Default require php file to be loaded into define pages editor?

    Usually in php you can add pages to another page by
    Code:
    <?php
    include('add_this page.php');
    include('add_this page_also.php');
    ?>
    I can't seem to get this to work.
    Can someone point me in the right direction with making this zen-cart friendly.

    Thank you

  2. #2
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: require php file to be loaded into define pages editor?

    Quote Originally Posted by southshorepizza View Post
    Usually in php you can add pages to another page by
    Code:
    <?php
    include('add_this page.php');
    include('add_this page_also.php');
    ?>
    I can't seem to get this to work.
    Can someone point me in the right direction with making this zen-cart friendly.

    Thank you
    That's the proper format to try to load add_this page_also.php if it exists at the designated path which in this case is at the root of your server. If it is at the root of your store, need to prepend DIR_FS_CATALOG. Otherwise based on the lack of information provided about what is happening, expected, not happening, etc... Anything else would be a guess.

    Also, if "require" the file to be loaded, then need to use the require command instead of include.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  3. #3
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: require php file to be loaded into define pages editor?

    Also, now that the title of this thread has been rereviewed, don't quite see the connection between the message and the title... Really need more information about what is being attempted. This infoshould have been in the original post to obtain the best assistance. See the posting tips above the message box when posting to the forum.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  4. #4
    Join Date
    Sep 2012
    Posts
    253
    Plugin Contributions
    0

    Default Re: require php file to be loaded into define pages editor?

    So far to test it I have written Hello, and then added that line. I can see hello but the rest is blank.

    Lets say add_this_page.php just says "Welcome to my store."
    add_this_page_also.php says "Please enjoy your visit."

    Expected output would be:
    Hello, Welcome to my store. Please enjoy your visit.

    Instead I get:
    Hello

    The files are located in the admin directory for now so I changed the code to:
    Hello
    <?php
    include(DIR_FS_ADMIN . 'add_this page.php');
    include(DIR_FS_ADMIN . 'add_this page_also.php');
    ?>

    I did try moving the files into the store front side and using DIR_FS_CATALOG as well with no success.

    Thank you

    Maybe in the title I should have left off the "editor" but yes using the define pages editor to code a page. I want to include other php pages to be included on that same page as part of the page.
    Last edited by southshorepizza; 5 May 2015 at 10:54 PM.

  5. #5
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: require php file to be loaded into define pages editor?

    Well, if your plan is to have these files "added" onthestore front side, they will need to be somewhere on the catalog side as the admin directory is not known from that side.

    Further, I thought there were some restrictions about using php in this way on the define pages editor, but let's put that aside for the moment.

    What happens if you begin the first file with ?> So that the content is pushed outside of a php code attempt. Btw, any error logs? Cache directory for ZC 1.5.0 and below or logs directory in 1.5.1 and above.
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  6. #6
    Join Date
    Sep 2012
    Posts
    253
    Plugin Contributions
    0

    Default Re: require php file to be loaded into define pages editor?

    Cannot redeclare zen_parse_url() (previously declared in /home/w57dsjmm/public_html/order/admin/includes/application_top.php:160) in /home/w57dsjmm/public_html/order/admin/includes/application_top.php on line 186
    is the log file.

    by removing the ?> from the define page and the <?php from the add_this page.php I still get the same error message.

  7. #7
    Join Date
    Jul 2012
    Posts
    16,817
    Plugin Contributions
    17

    Default Re: require php file to be loaded into define pages editor?

    By first file I meant the first included file (load_this page.php)... As to the error, interesting as it appears something is trying to load and redeclare a function/file already loaded...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

 

 

Similar Threads

  1. Replies: 5
    Last Post: 3 Jun 2014, 05:42 PM
  2. Define Pages Editor: File does not exist:
    By iann in forum Customization from the Admin
    Replies: 4
    Last Post: 28 Apr 2008, 09:55 PM
  3. Define pages editor not editing the correct file
    By Terrill_Taylor in forum General Questions
    Replies: 13
    Last Post: 31 Jul 2007, 03:00 AM
  4. Define Pages Editor - define_main_page.php
    By Donkey in forum Basic Configuration
    Replies: 5
    Last Post: 3 Aug 2006, 07:01 AM

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