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.

Passing MD5 to template

Discussion in 'cPanel Developers' started by linuxguy75, Jan 30, 2016.

  1. linuxguy75

    linuxguy75 Registered

    Jan 30, 2016
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    Root Administrator
    I've been a linux admin for 13 years so I know my way around a linux server. But I'm a noob when it comes to cpanel API. So I apologize in advance for my ignorance.

    I have created a global header template. /var/cpanel/customizations/includes/

    It works great. However, the part where I'm stuck, I have a string inside this template that I need to convert using MD5 or SHA1. I've been unable to access the perl module MD5 or SHA inside the template.

    Anyone have any ideas on maybe how to access an MD5 function inside the template?

    Or maybe I need to write a perl plugin that returns the md5 string to the template.
  2. cPDavidN

    cPDavidN cPanel Developer
    Staff Member

    Mar 19, 2013
    Likes Received:
    Trophy Points:
    cPanel Access Level:
    DataCenter Provider

    Probably the easiest way to do what you need to would be to write a UAPI module with a subroutine that does what you need, and then invoke that from within your header template. UAPI modules are just Perl modules written a specific way and stored in /usr/local/cpanel/Cpanel/API. Once a UAPI call is available, calling it from inside Template Toolkit code just looks like "execute( 'Module', 'function', { 'key' => 'value' } );"

    UAPI - Custom UAPI Modules - Software Development Kit - cPanel Documentation

    If you have any more questions about this, please don't hesitate to ask.

    David Nielson
    cPanel developer

Share This Page