Create Custom Menu


2 Comentários

  • Tal Admon

    Hi Sam,

    There is a way to reuse code in several template pages like so:

    Say I have an html code I want to reuse:

    First, I will minify it and put it in a jQuery html clause:

    Save this file as mycode.js and upload it as an asset to your template.

    Now, in any page you want to reuse this code, add the following lines to your template:

    <div id="mycode"></div>
    <script src="{{asset 'mycode.js'}}"></script>

    The first line will add an empty <div> section with an id "mycode".
    The second one will get the script we compiled to execute.

    The script itself is looking for that "mycode" div element and adding the html we wrote in it.

    To minify the html, you can simply use online tools like:

    Let me know if you this works out.


  • Sam

    Thanks Tal. I could use some JS, yes. Great suggestion.

    I wonder if there is another more vanilla way to create an include and add it to the necessary templates.


Por favor, entrar para comentar.

Powered by Zendesk