Jump to content

how create html php file beside of whmcs


hogava

Recommended Posts

Be aware there is an error in the code you should use this one :

<?php
use WHMCS\ClientArea;
use WHMCS\Database\Capsule;
define('CLIENTAREA', true);
require __DIR__ . '/init.php';
$ca = new ClientArea();
$ca->setPageTitle('Your Page Title Goes Here');
$ca->addToBreadCrumb('index.php', Lang::trans('globalsystemname'));
$ca->addToBreadCrumb('mypage.php', 'Your Custom Page Name');
$ca->initPage();
//$ca->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->assign('variablename', $value);
// Check login status
if ($ca->isLoggedIn()) {
 /**
 * User is logged in - put any code you like here
 *
 * Here's an example to get the currently logged in clients first name
 */
 $clientName = Capsule::table('tblclients')
 ->where('id', '=', $ca->getUserID())->pluck('firstname');
 // 'pluck' was renamed within WHMCS 7.0. Replace it with 'value' instead.
 // ->where('id', '=', $ca->getUserID())->value('firstname');
 $ca->assign('clientname', $clientName);
} else {
 // User is not logged in
 $ca->assign('clientname', 'Random User');
}
# Define the template filename to be used without the .tpl extension
$ca->setTemplate('mynewpage');
$ca->output();

and

<h3>This is my custom WHMCS page's content</h3>
<p>I used the code found <a href="https://developers.whmcs.com/advanced/creating-pages/" target="_blank" title="Click here to navigate to WHMCS Support to obtain the code needed for creating a custom page.">here</a>.</p>
<p>I put that code into a file named: </p>
<p><code>mypage.php</code>, which resides in the root directory (where my WHMCS is installed).</p>
<p>Now, I can write HTML into the file named:</p>
<p><code>mypage.tpl</code>, located in the templates/six/ directory. Any HTML I save into that file, will be displayed on my new custom page.</p>
<code>
<b>here some Coded text </b>
</code>

I don't know if they have fixed it my ticket is from the  16th November:

Quote

Hello,

Please remove the following default coding and it should resolve this for you:


/**
 * Set a context for sidebars
 *
 * @link http://docs.whmcs.com/Editing_Client_Area_Menus#Context
 */
Menu::addContext();

/**
 * Setup the primary and secondary sidebars
 *
 * @link http://docs.whmcs.com/Editing_Client_Area_Menus#Context
 */
Menu::primarySidebar('announcementList');
Menu::secondarySidebar('announcementList');

If you require further assistance, please don't hesitate to let us know.

Best regards,

--
Lawrence Williams

 

Link to comment
Share on other sites

22 hours ago, wp4all said:

Be aware there is an error in the code you should use this one :

it's not really an error or bug, it's just an option to show contexted sidebars.... same as checking if the user is logged in or not... if they were left out of the sample code, you'd have users asking how to do it... a little common sense needs to be applied when reading the documentation and using the example code! 🙂

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated