0

First of all the goal is to create a new whole php file/page on the admin page through addon module because from the _output() function, whmcs will insert header, sidebar and footer and AFAIK, we cannot remove it.

The workaround I've done is to create a new PHP file from my custom addon module, thus a (whole) new page is created but the issue is cannot access WHMCS's constants, autoloader, like namespacing stuff, etc because the file is accessed directly. In the browser, I access it on this url: {rooturl}/modules/addons/my_custom_addon_module/pages/my_page.php

To get an idea, this is a basic structure of the file (smarty template):

<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <span>{$myVar}</span>
</body>
</html>

What's the best solution for this?

mending3
  • 586
  • 7
  • 21

1 Answers1

0

What you're trying to do is a big task just to hide WHMCS' header and footer from your output.

I don't recommend doing what you're trying to do as there's a lot of things to take into account. You'd need to manually check if an admin has permissions to access the resource and figure out how WHMCS is setting up a view in Smarty. Everything that you're able to do the "WHMCS-way", you'd need to do yourself.

The first part is easy enough. You need to require init.php from the WHMCS rootdir. Once that's done, you can start using the WHMCS namespaces, functions etc.

Personally, I'd find another way to strip the addon module page for the WHMCS header and footer. The easiest way would probably be using JavaScript: Replacing Entire Page Including Head Using Javascript

Dennis
  • 56
  • 7