No announcement yet.

Global Header - Quirks Mode

  • Filter
  • Time
  • Show
Clear All
new posts

  • Global Header - Quirks Mode

    I am using this to document a quirk with the Global Header code block and variable. This is for the following code that is populated from the Settings => Design => Header and Footer.

    HTML Code:
    <!--START: global_header--><!--END: global_header-->
    This block of code requires you to have either a "[ ]" characters or a HTML tags between the start and stop html commands to work. You can use a real variable ([storename]), a dummy variable ([dummy]), the left and right backets - [ ], or any html tag.

    Global Header Dis-enabled (turned off).
    The html code between the start and stop commands will show on you web pages. This means if you are using a [dummy] or just the [ ], it will appear.

    Global Header Enabled
    The content defined in the Admin at Header and Footer => Global Header will show up as designed.

    (If you really want to see 3dcart go crazy, try just placing one space between the start and stop html commands with the global header enabled with content included.)

    This Quirk only impacts the Global Header. The Global Footer, Global Left Banner and Global Right Banner do not exhibit these behaviors.

    There are a couple of work arounds:
    1. Place the [ ] between the start and stop html commands. Enable the Global Header. Leave the field blank or only place spaces in the admin system. The dummy [ ] will disappear and the variable does not take any space in the resulting html. You can then add or remove content as needed.

    2. A more permanent fix is the following code.
    HTML Code:
    <!--START: global_header-->
      <span style="display:none;"></span>
    <!--END: global_header-->
    This will allow you to use the admin system without having to remember to keep the Global Header enabled with an empty field. The code block will behave like the rest of the 3dcart variables.

    Why and How did I find this:
    I am using this code block to show images for sales, clearances, free shipping, etc. At times, this code block will be empty. I was using a [global_header] variable between the start and stop html commands. The variable kept showing when I dis-enabled the content. It was annoying me and I had to figure out what was happening.

    A ticket has been opened with 3dcart on this issue.

    Last edited by jcocking; 12-13-2013, 04:01 PM.

    The Wedding Printer

  • #2
    its not the brackets that are required. i've found it just needs some sort of element. you can just as easily put a <span>&nbsp;</span> in there and it will work. when the content loads from the global header.. the span will be replaced with whatever markup is in the header.

    I don't know why there has to be something there, but then again I don't know why they inject html in a lot of places. I'm not surprised.


    • #3
      The downside of the "<span>&nbsp;</span>" is it will act as a html block and influence the design. The span with the display none will not impact the design when it is inactive.

      I edited my first post with the option to place any html tag or [ ] brackets.

      I tried it with only a single letter and it stopped the template from rendering. Not as bad as the single space, but stilled messed up the template from loading.


      The Wedding Printer


      • #4
        yeah depending on your layout you may need to hide it. though unless you have some crazy css rules, your spans should be displaying as inline elements rather than block.

        either way, the concept is the same but it doesn't fix the fact there shouldnt need to be anything there in the first place. the comments should be more than enough