title: How to define a template function, then in the template I can invoke it
body: <p>From the <a href="https://developers.whmcs.com/advanced/creating-pages/" rel="nofollow noreferrer">document</a>:</p>
  
  <pre><code>&lt;?php
  
  use WHMCS\ClientArea;
  use WHMCS\Database\Capsule;
  
  define('CLIENTAREA', true);
  
  require __DIR__ . '/init.php';
  
  $ca = new ClientArea();
  
  $ca-&gt;setPageTitle('Your Page Title Goes Here');
  
  $ca-&gt;addToBreadCrumb('index.php', Lang::trans('globalsystemname'));
  $ca-&gt;addToBreadCrumb('mypage.php', 'Your Custom Page Name');
  
  $ca-&gt;initPage();
  
  //$ca-&gt;requireLogin(); // Uncomment this line to require a login to access this page
  
  // To assign variables to the template system use the following syntax.
  // These can then be referenced using {$variablename} in the template.
  
  //$ca-&gt;assign('variablename', $value);
  
  // Check login status
  if ($ca-&gt;isLoggedIn()) {
  
      $clientName = Capsule::table('tblclients')
          -&gt;where('id', '=', $ca-&gt;getUserID())-&gt;pluck('firstname');
          // 'pluck' was renamed within WHMCS 7.0.  Replace it with 'value' instead.
          // -&gt;where('id', '=', $ca-&gt;getUserID())-&gt;value('firstname');
      $ca-&gt;assign('clientname', $clientName);
  
  } else {
  
      $ca-&gt;assign('clientname', 'Random User');
  }
  
  Menu::addContext();
  
  Menu::primarySidebar('announcementList');
  Menu::secondarySidebar('announcementList');
  
  $ca-&gt;setTemplate('mypage');
  
  $ca-&gt;output();
  </code></pre>
  
  <p>You see, the example gives the variable define, but did not give the function define. </p>
  
  <p>I want to in the php file define a <code>function</code>, then in the template I can invoke it.</p>
  
  <p>But I tried use <code>registerPlugin()</code> or whatever, all do not work. </p>