The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

cPanel 54 + jQuery

Discussion in 'User Experience' started by Dev@SH, Jan 26, 2016.

  1. Dev@SH

    Dev@SH Member

    Joined:
    Mar 11, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    Guide to cPanel Interface Customization - Software Development Kit - cPanel Documentation

    On that page, the documentation says
    "In cPanel & WHM version 54 and later, if your custom interfaces require jQuery, you must include that code in a define() block"

    I'm not a complete noob ... but... What?

    Can you give me a working example of adding jQuery to a global_header.html.tt file.

    I would assume that this has to be in a template-toolkit block of sorts however I can't find any information that states this.

    Thank you.
     
  2. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    30,678
    Likes Received:
    654
    Trophy Points:
    113
    cPanel Access Level:
    Root Administrator
    Hello :)

    Does your custom interface require jQuery? If not, you can safely ignore that warning. Otherwise, could you provide more details about what you are implementing so we can offer an example?

    Thank you.
     
  3. Dev@SH

    Dev@SH Member

    Joined:
    Mar 11, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    I took out the jQuery out for now but I would still like to see how to include jQuery code in a .tt file. Thank you.
     
  4. cPanelAdamF

    cPanelAdamF cPanel Product Owner
    Staff Member

    Joined:
    Mar 21, 2013
    Messages:
    174
    Likes Received:
    11
    Trophy Points:
    18
    Location:
    Houston TX
    cPanel Access Level:
    DataCenter Provider
    Twitter:
    Our documentation team just published Guide to cPanel Interface Customization - jQuery - Software Development Kit - cPanel Documentation which goes much more in depth about the changes, including examples from both a JS perspective and a .tt file perspective. Please have a look - Very open to feedback about how we can make this document better!
     
  5. Dev@SH

    Dev@SH Member

    Joined:
    Mar 11, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    [​IMG]
    This is the error that I'm getting.
    HTML:
    <script>
        define(
            [
                "jquery"
            ],
            function($) {
                // Code that uses jQuery goes here.
                $(document).ready(function() {
                     console.log("Loaded");
                });
            });
    </script>
    Placing that in the global_header.html.tt file to be used with my custom style.

    whm / cpanel 54.0.12
     
    #5 Dev@SH, Feb 4, 2016
    Last edited: Feb 4, 2016
  6. cPanelAdamF

    cPanelAdamF cPanel Product Owner
    Staff Member

    Joined:
    Mar 21, 2013
    Messages:
    174
    Likes Received:
    11
    Trophy Points:
    18
    Location:
    Houston TX
    cPanel Access Level:
    DataCenter Provider
    Twitter:
  7. Dev@SH

    Dev@SH Member

    Joined:
    Mar 11, 2014
    Messages:
    8
    Likes Received:
    0
    Trophy Points:
    1
    cPanel Access Level:
    DataCenter Provider
    Thank you for the updates. We appreciate them.
     
Loading...

Share This Page