Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2011
    Location
    Espoo, Finland
    Posts
    64
    Plugin Contributions
    0

    Default MobileDetect class in Common Template html header

    Good day,
    This seems to be a very minor issue, and moreover, everything is probably Ok in fact and it's me, who does not understand something, but I'd like to wonder anyway, if this code is correct?

    Code:
    // ZCAdditions.com, ZCA Responsive Template Default (BOF-addition 1 of 2)
    if (!class_exists('MobileDetect')) {
      include_once(DIR_WS_CLASSES . 'Mobile_Detect.php');
    }
      $detect = new Detection\MobileDetect;
      $isMobile = $detect->isMobile();
      $isTablet = $detect->isTablet();
      if (!isset($layoutType)) $layoutType = ($isMobile ? ($isTablet ? 'tablet' : 'mobile') : 'default');
    // ZCAdditions.com, ZCA Responsive Template Default (BOF-addition 1 of 2)
    (lines ##32...40 of includes\templates\responsive_classic\common\html_header.php file in newest v2.1.0)

  2. #2
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,285
    Plugin Contributions
    125

    Default Re: MobileDetect class in Common Template html header

    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  3. #3
    Join Date
    Apr 2011
    Location
    Espoo, Finland
    Posts
    64
    Plugin Contributions
    0

    Default Re: MobileDetect class in Common Template html header

    Thank you for prompt reply for incompetent question

    No need to reply, but logic does not seem flawless: after checking of obsolete class existence, new instance is being created from new location nonetheless

    (I do definitely not understand something...)

    Thank you again for your time.

  4. #4
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,285
    Plugin Contributions
    125

    Default Re: MobileDetect class in Common Template html header

    Not incompetent at all - these things are quite tricky which is why they are explicitly called out in the documentation.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

  5. #5
    Join Date
    Feb 2006
    Location
    Tampa Bay, Florida
    Posts
    10,285
    Plugin Contributions
    125

    Default Re: MobileDetect class in Common Template html header

    Sorry, just realized you were asking a question:

    > No need to reply, but logic does not seem flawless: after checking of obsolete class existence, new instance is being created from new location nonetheless

    It's checking to see if the class has been loaded - not all templates will load this class. If it hasn't, load it. Then create an instance of the class.
    The class is not obsolete; it has been renamed and this new logic uses the new name.
    That Software Guy. My Store: Zen Cart Support
    Available for hire - See my ad in Services
    Plugin Moderator, Documentation Curator, Chief Cook and Bottle-Washer.
    Do you benefit from Zen Cart? Then please support the project.

 

 

Similar Threads

  1. Looking for Template/Theme ... Is this common?
    By LilleyPadGifts in forum Templates, Stylesheets, Page Layout
    Replies: 6
    Last Post: 4 Mar 2017, 04:32 AM
  2. html header php file not in my custom template?
    By Hamilton33 in forum General Questions
    Replies: 5
    Last Post: 14 Jul 2011, 09:09 AM
  3. Replies: 4
    Last Post: 4 Nov 2008, 05:38 PM
  4. tpl_header.php in template common help
    By yeaboy in forum Templates, Stylesheets, Page Layout
    Replies: 1
    Last Post: 29 Jul 2006, 05:56 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