Page 5 of 6 FirstFirst ... 3456 LastLast
Results 41 to 50 of 55
  1. #41
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: #categories li a.cat-selected-text but for EZPAGES

    I posted a request and got a good lead from some members who know PHP better than I do.

    $_SERVER['REQUEST_URI'] gives what we are looking for here. I knew I had seen something that did it, but was focused on $_GET.

    So, going back to my original set of files in post #28 (and adding the global statement),
    PHP Code:
    function active_page_class($ezpid,$alturl) {
      global 
    $current_page_base
      
    $active '';
      if(
    $current_page_base == 'page') { 
        
    $active = ($_GET['id'] == $ezpid)? ' class="activeEZPage"''';
      }elseif(
    $alturl) {//check for current page in alturl
        
    $active = ((strstr($_SERVER['REQUEST_URI'],$alturl) and (strstr($alturl,'/index.php') != '/index.php')) or ($_SERVER['REQUEST_URI'] == $alturl))?' class="activeILPage"''';
      }
      return 
    $active;

    This is the only edit that should be needed to those files.

  2. #42
    Join Date
    Feb 2007
    Location
    New York
    Posts
    88
    Plugin Contributions
    0

    Default Re: #categories li a.cat-selected-text but for EZPAGES

    Hmmm.. Still the same.

    (I use all the codes in post #28 except the "ezpages_improved_menus_functions.php" )

  3. #43
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: #categories li a.cat-selected-text but for EZPAGES

    Oh well, debug time again.
    echo ' url='.$_SERVER['REQUEST_URI'],' alturl='.$alturl;//debug
    PHP Code:
      }elseif($alturl) {//check for current page in alturl
        
    echo ' url='.$_SERVER['REQUEST_URI'],' alturl='.$alturl;//debug
        
    $active = ((strstr($_SERVER['REQUEST_URI'],$alturl) and (strstr($alturl,'/index.php') != '/index.php')) or ($_SERVER['REQUEST_URI'] == $alturl))?' class="activeILPage"''';
      } 

  4. #44
    Join Date
    Feb 2007
    Location
    New York
    Posts
    88
    Plugin Contributions
    0

    Default Re: #categories li a.cat-selected-text but for EZPAGES

    Have a look. Thanks, Glenn.

  5. #45
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: #categories li a.cat-selected-text but for EZPAGES

    url=/index.php?main_page=index alturl=http://www.oligoskincare.com/index.php?main_page=index

    The $_SERVER is giving everything *after* the shop base, so the $alturl will have to be tweaked to match that. Once that is done, I think it will actually work correctly.

  6. #46
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: #categories li a.cat-selected-text but for EZPAGES

    PHP Code:
      }elseif($alturl) {//check for current page in alturl
        
    $alturl '/' str_replace(HTTP_SERVER DIR_WS_CATALOG,'',$alturl);//strip root info, put back initial / to match $_SERVER format
        
    echo ' url='.$_SERVER['REQUEST_URI'],' alturl='.$alturl;//debug
        
    $active = ((strstr($_SERVER['REQUEST_URI'],$alturl) and (strstr($alturl,'/index.php') != '/index.php')) or ($_SERVER['REQUEST_URI'] == $alturl))?' class="activeILPage"''';
      } 
    Now let's see what we get...

  7. #47
    Join Date
    Feb 2007
    Location
    New York
    Posts
    88
    Plugin Contributions
    0

    Default Re: #categories li a.cat-selected-text but for EZPAGES

    YES!!! You did it!!

    Thank you so much, Glenn!

  8. #48
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: #categories li a.cat-selected-text but for EZPAGES

    There's still a bit of finessing to do to make the homepage link highlighting more robust, as there are several ways it can show in the address bar, but overall I'm happy with it. The next stage is to extend it to the ez-pages footer menu, and possibly the footer columns mod that I developed locally.

  9. #49
    Join Date
    Feb 2007
    Location
    New York
    Posts
    88
    Plugin Contributions
    0

    Default Re: #categories li a.cat-selected-text but for EZPAGES

    Glenn,

    I want to thank you again for all your help. I really appreciate it!

    I understand that it is not perfect, but I'm satisfied with it over all. Some are really strange, such as:

    when you list products by manufacturers:
    http://tinyurl.com/2djx2u4

    and the "Home" is highlighted (bold and in light blue color). This happens also when you go to a sub-category product list page.

    But, I'm happy with what you have and could have done.

    Thank you. Thank you. Thank you!

  10. #50
    Join Date
    Jul 2005
    Location
    Upstate NY
    Posts
    22,010
    Plugin Contributions
    25

    Default Re: #categories li a.cat-selected-text but for EZPAGES

    I played with it some more after my last post, and I believe this solves the false positives for home page:
    PHP Code:
    <?php
    /**
     *
     * @copyright Copyright 2010 Glenn Herbert
     * @copyright Portions Copyright 2003-2006 Zen Cart Development Team
     * @copyright Portions Copyright 2003 osCommerce
     * @license http://www.gnu.org/licenses/ GNU Public License V3.0
     * @version $Id: /includes/functions/extra_functions/ezpages_improved_menus_functions.php 
     *Ezpages Improved Menus by Glenn Herbert (gjh42) 2010-08-31
     */

    //call as   activePageClass($var_linksList[$i]['id'],$var_linksList[$i]['altURL']);
    function active_page_class($ezpid,$alturl) {
      global 
    $this_is_home_page;
      
    $active '';
      if(
    $_GET['main_page'] == 'page') {
        
    $active = ($_GET['id'] == $ezpid)? ' class="activeEZPage"''';
      }elseif(
    $alturl) {
        
    $alturl str_replace(HTTP_SERVER DIR_WS_CATALOG,'/',$alturl);
        
    $active = ((strstr($_SERVER['REQUEST_URI'],$alturl) and !strstr('/index.php?main_page=index',$alturl)) or ($this_is_home_page and strstr('/index.php?main_page=index',$alturl)))?' class="activeILPage"''';
      }
      return 
    $active;
    }
    ?>

 

 
Page 5 of 6 FirstFirst ... 3456 LastLast

Similar Threads

  1. v150 How to display Top Cat & Sub Cat but not Sub Sub Cats??
    By spiggles87 in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 5 Mar 2013, 06:37 PM
  2. Replies: 2
    Last Post: 31 Jul 2010, 03:43 PM
  3. Display top-level cat name in text, then sub-cat thumb
    By jfriesen in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 2 Feb 2007, 09:11 PM
  4. Master Cat's on main page, ONLY sub cat's on specific cat pages
    By wtashby in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 25 Jun 2006, 07:24 PM

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