Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Location
    Calgary, Alberta
    Posts
    290
    Plugin Contributions
    1

    Pathing issues for a module

    I want to create a set or reports that sit in a directory called /admin/reports. If I take the report "stats_products_viewed.php" from/admin and move it to /admin/reports and change the pathing for the REQUIRE to

    require('../../includes/application_top.php');

    it can't find the configure.php in includes and so tries to do a zc_install instead.

    I'd rather not clutter up the admin folder more then it already is, but still want my report tool to fit within the admin area (including admin security).... any suggestions?

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: Pathing issues for a module

    I do not see the reason to change the require statement?? Have you tried leaving it and copying/moving the file? The require pathing should be left as:
    Code:
      require('includes/application_top.php');
    Depending on what you are attempring with this, there may be other things that you should change.
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Mar 2004
    Location
    Calgary, Alberta
    Posts
    290
    Plugin Contributions
    1

    Default Re: Pathing issues for a module

    Quote Originally Posted by kobra View Post
    I do not see the reason to change the require statement?? Have you tried leaving it and copying/moving the file? The require pathing should be left as:
    Code:
      require('includes/application_top.php');
    Depending on what you are attempring with this, there may be other things that you should change.
    If I leave the file as is, and just move it to "reports" it shows a blank form, no meta, nothing happens.

  4. #4
    Join Date
    Mar 2004
    Location
    Calgary, Alberta
    Posts
    290
    Plugin Contributions
    1

    Default to use a subdirectory off 'admin'

    If you want to keep all your stuff neat and tidy in a subdirectory off of say admin, like admin/reports then there is some tricks you need to employ to make sure that the includes work properly.

    1. All html paths saying 'include/xxxx' need to be changed to '../include/xxxx'
    2. The "require('xxxx') statements need to be changed as follows
    <?php
    $qcd = getcwd();
    chdir('../');
    require('xxxx');
    chdir($qcd);
    ?>

    basically this moves the directory back, does the "Require" and then moves you back to your subdirectory. Now there is more elegant ways of doing this, but that would require recoding the entire zencart base files.... not a job on my to-dlo list currently.

    There may be other required changes, but this should hopefully help out those wanting to do this.

  5. #5
    Join Date
    Mar 2004
    Location
    Calgary, Alberta
    Posts
    290
    Plugin Contributions
    1

    Default Re: Pathing issues for a module

    Note.... if you want to ue any of thhe neat and wonderful functions built for say paging combos... then your totally hooped!



    You see in the functions, it parses off all but the basepath, and then adds the file back on. No idea why all the extra work was done to restrict thi, but other then making copies of the offending functions ( or hacking the originals) your stuck withh putting everything into the maind directories..... store/ or store/admin.


  6. #6
    Join Date
    Sep 2008
    Posts
    24
    Plugin Contributions
    0

    Default Re: to use a subdirectory off 'admin'

    Quote Originally Posted by quentinjs View Post
    If you want to keep all your stuff neat and tidy in a subdirectory off of say admin, like admin/reports then there is some tricks you need to employ to make sure that the includes work properly.

    1. All html paths saying 'include/xxxx' need to be changed to '../include/xxxx'
    2. The "require('xxxx') statements need to be changed as follows
    <?php
    $qcd = getcwd();
    chdir('../');
    require('xxxx');
    chdir($qcd);
    ?>

    basically this moves the directory back, does the "Require" and then moves you back to your subdirectory. Now there is more elegant ways of doing this, but that would require recoding the entire zencart base files.... not a job on my to-dlo list currently.

    There may be other required changes, but this should hopefully help out those wanting to do this.
    Could this method be used to move down a directory as well?

    If I have my files that I want to have access to application_top.php in the website root a directory above /shop/, would this work, or are there limitations?:
    PHP Code:
    <?php 
      $qcd 
    =  getcwd();
      
    chdir('/shop/');
      require(
    'xxxx');
      
    chdir($qcd);
     
    ?>
    Also, are there limitations that you, or anyone else has found using your exact workaround?

 

 

Similar Threads

  1. ITransact Module issues
    By lauriesscraps in forum Addon Payment Modules
    Replies: 13
    Last Post: 22 Apr 2010, 07:45 PM
  2. FedEx Module Issues
    By blackc2004 in forum Addon Shipping Modules
    Replies: 6
    Last Post: 27 Nov 2008, 04:58 PM
  3. Pathing
    By Shooters in forum General Questions
    Replies: 2
    Last Post: 26 Feb 2008, 06:44 PM
  4. UPS Module Issues
    By patchcables in forum Addon Shipping Modules
    Replies: 3
    Last Post: 9 Sep 2006, 02:45 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