Results 1 to 10 of 10
  1. #1
    Join Date
    Mar 2008
    Posts
    19
    Plugin Contributions
    1

    Default Plugin path for icons

    I am writing a plugin and wish to add an icon to a page. The icon is sitting in the plugin structure as a gif and wanted to know the best way of getting is path to pass to zen_image?

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,595
    Plugin Contributions
    88

    Default Re: Plugin path for icons

    Quote Originally Posted by hellsbit View Post
    I am writing a plugin and wish to add an icon to a page. The icon is sitting in the plugin structure as a gif and wanted to know the best way of getting is path to pass to zen_image?
    A little more information will help me help you. Is this a new admin page on which you want to display that icon? Where in the plugin structure does the .gif exist?

  3. #3
    Join Date
    Mar 2008
    Posts
    19
    Plugin Contributions
    1

    Default Re: Plugin path for icons

    No it is a phone_customer icon that is being added to index_dashboard and orders and customer pages via the notify system purely on the admin side

  4. #4
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,595
    Plugin Contributions
    88

    Default Re: Plugin path for icons

    Quote Originally Posted by hellsbit View Post
    No it is a phone_customer icon that is being added to index_dashboard and orders and customer pages via the notify system purely on the admin side
    ... and what notification is being observed to inject that icon?

  5. #5
    Join Date
    Mar 2008
    Posts
    19
    Plugin Contributions
    1

    Default Re: Plugin path for icons

    Why does that matter?

    Some of them are displayed by a dashboard widget. NOTIFY_ADMIN_DISPLAY_WIDGET

    The orders page is responding to NOTIFY_ADMIN_ORDERS_ADDRESS_FOOTERS

    I haven't added the others yet

  6. #6
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,595
    Plugin Contributions
    88

    Default Re: Plugin path for icons

    Quote Originally Posted by hellsbit View Post
    Why does that matter?

    Some of them are displayed by a dashboard widget. NOTIFY_ADMIN_DISPLAY_WIDGET

    The orders page is responding to NOTIFY_ADMIN_ORDERS_ADDRESS_FOOTERS

    I haven't added the others yet
    I'm just trying to figure out what you are trying to accomplish.

    If you're "in the observer" in the admin, the admin-root directory of your encapsulated plugin can be found by
    PHP Code:
    $plugin_admin_root dirname(dirname(dirname(__FILE__))) . DIRECTORY_SEPARATOR
    If the image file to be loaded in the plugin's /admin/images directory (I'm guessing, since you haven't said), the image file can then be located at
    PHP Code:
    $gif_file_location $plugin_admin_root 'images/mygiffilename.gif'

  7. #7
    Join Date
    Mar 2008
    Posts
    19
    Plugin Contributions
    1

    Default Re: Plugin path for icons

    Thank you for that. Unfortunately that gives a File System path not a web Path so can't be passed to zen_image. Is there a way to convert it?

    The idea is to keep the plugin as separate as possible for maintenance.

  8. #8
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,595
    Plugin Contributions
    88

    Default Re: Plugin path for icons

    Quote Originally Posted by hellsbit View Post
    Thank you for that. Unfortunately that gives a File System path not a web Path so can't be passed to zen_image. Is there a way to convert it?

    The idea is to keep the plugin as separate as possible for maintenance.
    Hmm, good point on the file-system vs. web path. Perhaps
    PHP Code:
    $gif_file_web_path str_replace(DIR_FS_CATALOG''$plugin_admin_root) . 'images/mygiffilename.gif'

  9. #9
    Join Date
    Mar 2008
    Posts
    19
    Plugin Contributions
    1

    Default Re: Plugin path for icons

    So I got the path right. Had to change the / to \ in DIR_FS_CATALOG but hit a problem as the webserver doesn't have permission to serve from that location.

    is that an .htaccess change or something else?

  10. #10
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    12,595
    Plugin Contributions
    88

    Default Re: Plugin path for icons

    Quote Originally Posted by hellsbit View Post
    So I got the path right. Had to change the / to \ in DIR_FS_CATALOG but hit a problem as the webserver doesn't have permission to serve from that location.

    is that an .htaccess change or something else?
    Hmm, the as-shipped /zc_plugins/.htaccess provides access for various image files:
    Code:
    #
    # @copyright Copyright 2003-2022 Zen Cart Development Team
    # @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
    # @version $Id: DrByte 2020 Oct 29 Modified in v1.5.8-alpha $
    #
    # This is used with Apache WebServers
    #
    # The following blocks direct HTTP requests to all filetypes in this directory recursively, except certain approved exceptions
    # It also prevents the ability of any scripts to run. No type of script, be it PHP, PERL or whatever, can normally be executed if ExecCGI is disabled.
    # Will also prevent people from seeing what is in the dir. and any sub-directories
    #
    # For this to work, you must include either 'All' or at least: 'Limit' and 'Indexes' parameters to the AllowOverride configuration in your apache/conf/httpd.conf file.
    # Additionally, if you want the added protection offered by the OPTIONS directive below, you'll need to add 'Options' to the AllowOverride list, if 'All' is not specified.
    # Example:
    #<Directory "/usr/local/apache/htdocs">
    #  AllowOverride Limit Options Indexes
    #</Directory>
    ###############################
    
    # deny *everything*
    <FilesMatch ".*">
      <IfModule mod_authz_core.c>
        Require all denied
      </IfModule>
      <IfModule !mod_authz_core.c>
        Order Allow,Deny
        Deny from all
      </IfModule>
    </FilesMatch>
    
    # but now allow just *certain* necessary files:
    <FilesMatch "(?i).*\.(js|css|html?|jpe?g|gif|webp|png|otf|ico|cur|map|eot|svgz?|ttf|woff2?|xml|xsl)$">
      <IfModule mod_authz_core.c>
        Require all granted
      </IfModule>
      <IfModule !mod_authz_core.c>
        Order Allow,Deny
        Allow from all
      </IfModule>
    </FilesMatch>
    
    IndexIgnore */*
    
    <limit POST PUT>
      <IfModule mod_authz_core.c>
        Require all denied
      </IfModule>
      <IfModule !mod_authz_core.c>
        Order Allow,Deny
        Deny from all
      </IfModule>
    </limit>
    
    
    ## NOTE: If you want even greater security to prevent hackers from running scripts in this folder, uncomment the following line (if your hosting company will allow you to use OPTIONS):
    # OPTIONS -Indexes -ExecCGI
    
    
    
    ##################
    ## Optional caching improvements
    ## Requires mod_header and mod_deflate to be enabled within Apache
    ##################
    <IfModule mod_headers.c>
      Header unset Pragma
      FileETag None
      Header unset ETag
      #Header set Cache-Control "no-transform"
      <FilesMatch "(?i).*\.(ico|jpe?g|gif|webp|png|otf|swf|flv|ttf|woff|eot|svg)$">
        Header set Cache-control "max-age=864000, public, must-revalidate"
        Header unset Last-Modified
      </FilesMatch>
      <FilesMatch "(?i).*\.(html|htm|xml|txt|xsl)$">
        Header set Cache-control "max-age=7200, must-revalidate"
      </FilesMatch>
    </IfModule>
    <IfModule mod_deflate.c>
      <FilesMatch "(?i)\.(js|css)$">
        SetOutputFilter DEFLATE
      </FilesMatch>
    </IfModule>
    
    ##################
    ## Optional improvements
    ## Requires mod_expires to be enabled within Apache
    ##################
    <ifmodule mod_expires.c>
      ExpiresActive On
      ExpiresDefault A300
      ExpiresByType application/x-javascript A3600
      ExpiresByType text/css A3600
      ExpiresByType image/gif A604800
      ExpiresByType video/x-flv A604800
      ExpiresByType application/pdf A604800
      ExpiresByType text/html A300
      ExpiresByType image/x-icon A86400
      ExpiresByType image/jpeg A2592000
      ExpiresByType image/png A2592000
      ExpiresByType image/svg A2592000
    </ifmodule>

 

 

Similar Threads

  1. v153 Set path for existing small image and path for existing large image in product?
    By njlech in forum Setting Up Categories, Products, Attributes
    Replies: 6
    Last Post: 12 Dec 2014, 03:11 AM
  2. icons for color attributes?
    By ekon79 in forum Setting Up Categories, Products, Attributes
    Replies: 1
    Last Post: 29 Jan 2011, 05:01 PM
  3. Change of Admin Path - Icons not Showing
    By Nick_Schoolwear in forum Customization from the Admin
    Replies: 6
    Last Post: 13 Jul 2008, 02:06 PM
  4. Icons for partners
    By josefs in forum Basic Configuration
    Replies: 3
    Last Post: 11 Dec 2007, 09:28 PM
  5. Great resource for new icons
    By fbords in forum Templates, Stylesheets, Page Layout
    Replies: 0
    Last Post: 2 Sep 2007, 08:52 AM

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
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR