Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    May 2007
    Posts
    136
    Plugin Contributions
    0

    Default get admin directory

    Hello guys,

    I'm working on a mod and it's going to live in the admin/includes/modules/MYMOD/ folder I would like to know how I would findout the name of the admin folder if a user renames there admin folder name that this mod would still work.

    I tride to use DIR_WS_ADMIN but it did not work... Any ideas?

    This is the code that I'm trying to use:
    PHP Code:
    <img src="' . DIR_WS_ADMIN . 'includes/modules/MYMOD/images/' . $image . '" alt="" /> 

  2. #2
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: get admin directory

    That's the right constant, but you may need to prefix it with "HTTP_SERVER . " or "HTTPS_SERVER . "
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  3. #3
    Join Date
    May 2007
    Posts
    136
    Plugin Contributions
    0

    Default Re: get admin directory

    thanks for the reply Kurio,

    ok this is what the link looks like when it gets echoed out:
    Code:
    http://www.mydomain.comDIR_WS_ADMINincludes/modules/mymod/images/theimagename.gif
    So my guess is that it's not loading the admin configure file, it loads the HTTP_SERVER information but not the DIR_WS_ADMIN

    PHP Code:
    <img src="' . HTTP_SERVER . DIR_WS_ADMIN . 'includes/modules/mymod/images/' . $image . '"
    I could include the configure file, but then we are back to square one if the user renames the admin folder lol

    So maybe I need to be looking for some php script to lookup the directory that the script is in and go out 3 folders then echo out that folders name. I was hoping for an easier way lol

  4. #4
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: get admin directory

    It must be loading a configure file or the HTTP_SERVER wouldn't be resolved.

    It appears that either it is loading the catalog configure file which doesn't have references to the admin location, or there is a problem with the admin configure file.

    Where is the file that is executing this code located?
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  5. #5
    Join Date
    May 2007
    Posts
    136
    Plugin Contributions
    0

    Default Re: get admin directory

    This mod file is in
    Code:
    admin/includes/modules/MYMOD/
    and it uploads images to
    Code:
    admin/includes/modules/MYMOD/images/
    I think I'm going to rewrite the mod to upload not to the admin/includes/ but just the includes/ folder and save me some hassle.

  6. #6
    Join Date
    Sep 2006
    Location
    Colorado Springs CO USA
    Posts
    516
    Plugin Contributions
    2

    Default Re: get admin directory

    I'm no expert and am taking a risk of egg on my face, but isn't there supposed to be single quotes around DIR_WS_ADMIN?

    [FONT=Courier New]old:[/FONT]
    [FONT=Courier New]<img src="' . HTTP_SERVER . DIR_WS_ADMIN . 'includes/modules/mymod/images/' . $image . '"[/FONT][FONT=Courier New]> [/FONT]
    new:

    [FONT=Courier New]<img src="' . HTTP_SERVER . 'DIR_WS_ADMIN' . 'includes/modules/mymod/images/' . $image . '"[/FONT][FONT=Courier New]> [/FONT]


  7. #7
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: get admin directory

    @ronless67

    No. That would change the constant which isn't being properly resolved, into a string which would never be resolved.

    @IllusionGuy

    How about the admin configure file? Are other parts of admin working correctly? Is there a typo in or around the declaration of the DIR_WS_ADMIN?
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

  8. #8
    Join Date
    Sep 2006
    Location
    Colorado Springs CO USA
    Posts
    516
    Plugin Contributions
    2

    Default Re: get admin directory

    I knew I would get egg on my face. I figured that out before my 7 minutes to edit ran out, but wasted my time trying to figure out how to delete my post altogether. (Never figured out). So it went through anyway.

    I agree the answer probably lies in the admin/configuration.php file.

  9. #9
    Join Date
    May 2007
    Posts
    136
    Plugin Contributions
    0

    Default Re: get admin directory

    I'm sure the config file is setup right becuase the store and the admin panel both work great, I'm sure it's this mod that I'm working on.

    The following code that is the script from a file called "testimonials_display.php".

    PHP Code:
    <?PHP
    @mysql_connect(DB_SERVERDB_SERVER_USERNAMEDB_SERVER_PASSWORD) or die("Unable to connect");
    @
    mysql_select_db(DB_DATABASE) or die("Unable to select database DB_DATABASE");
    $query=("SELECT image, business_name, location, LEFT(quote,300) AS quote FROM " DB_PREFIX "testimonials")or die(@mysql_error());
    $result=mysql_query($query);
    $num=mysql_numrows($result);
    $i=0;
    while (
    $i $num) {
    $image=mysql_result($result,$i,"image");
    $quote=mysql_result($result,$i,"quote");
    $business_name=mysql_result($result,$i,"business_name");
    $location=mysql_result($result,$i,"location");
    if (empty(
    $image)){$image "default.gif";}
    $quotes[] = '
     <div><img src="'
    DIR_WS_ADMIN .'includes/modules/testimonials/testimonial_images/' $image '" alt="" /></div>
     <div style="font-size:10px; padding-right:8px;">&quot;<em>' 
    $quote '</em>&quot;... <a href="index.php?main_page=testimonials&session=display" style="white-space:nowrap;">Read More &raquo;</a></div>
     <div /><p><strong>' 
    $business_name '</strong><br />
     ' 
    $location '</p>';
    $i++;
    };
    srand ((double) microtime() * 1000000);
    $testimonials rand(0,count($quotes)-1);
    echo 
    $quotes[$testimonials];
    ?>
    That is the only code that I have in the file I'm not sure but I may be missing something that needs to include the right config file.

    This testimonials mod has tools for the admin panel and it's own page and sidebox for the front end, so there is a lot going on with a lot of diffrent files.

    I was playing around with
    PHP Code:
    (dirname(__FILE__)  .  '/testimonial_images/'

    And it seems to work for the files in the admin but it’s not going to work for the files that are in the includes folder, so to save some time I’m just going to change the image folder to be in includes/modules/testimonials/images/ folder

  10. #10
    Join Date
    Apr 2006
    Location
    London, UK
    Posts
    10,569
    Plugin Contributions
    25

    Default Re: get admin directory

    Why not use the Zen Cart database wrapper for your queries?

    How is this script called? In particular, what includes application_top which co-ordinates the loading of all the components that make up a Zen Cart page in the admin?

    Finally, as an aside, rather than building a file structure with admin as it's root, why not just look down one level from your script into the images file?
    Kuroi Web Design and Development | Twitter

    (Questions answered in the forum only - so that any forum member can benefit - not by personal message)

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Changed Install Directory - Can't Get Admin Panel to Load
    By fmckinnon in forum General Questions
    Replies: 1
    Last Post: 16 Apr 2011, 12:50 AM
  2. Problem with Admin after changing directory name for Admin
    By cnymike in forum Basic Configuration
    Replies: 10
    Last Post: 6 Jul 2009, 02:15 PM
  3. All I get is the directory
    By larue in forum Installing on a Linux/Unix Server
    Replies: 6
    Last Post: 11 Sep 2008, 09:14 PM
  4. Replies: 0
    Last Post: 25 Apr 2007, 05:05 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