Jump to content

Custom Page issue


Recommended Posts

Hi all. I've done all the research I can, both with your extensive documentation, as well as my hosting companies, inmotion, and i have to say, i really appreciate it. So far, its allowed me, a non php user, to finally begin to grasp this language.

However, while trying to create a custom TOS page, i've run into problems. I'm using a custom theme, and am wondering if that is whats causing the issues here. However, they don't have any support for the WHMCS implementation of the theme, so I'm hoping I can figure it out.

So, I've created the new .php according to the guides i've found,  namely
:

<?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();
if ($ca->isLoggedIn()) {
    $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');
}
Menu::addContext();
Menu::primarySidebar('announcementList');
Menu::secondarySidebar('announcementList');
$ca->setTemplate('mypage');
$ca->output();

that i found through the documentation. I obviously replaced what was needed with my filenames. I then created the needed .tpl, in my case tos.tpl, and put it in the active template directory.

However, when i try to visit the page,i get an error message. you can see this at clients.erishost.com/tos.php . Am i missing something obvious?

For the moment, I've solved the issue by simply opening the links in a new tab, but this is far from ideal.

I appreciate any help or pointers. I tried to figure it out myself before bothering ya'll.

Link to comment
Share on other sites

Quote

ArgumentCountError: Too few arguments to function WHMCS\View\Client\Menu\MenuRepository::addContext(), 0 passed in /home/erisho5/clients.erishost.com/vendor/illuminate/support/Facades/Facade.php on line 215 and exactly 2 expected in /home/erisho5/clients.erishost.com/vendor/whmcs/whmcs-foundation/lib/View/Client/Menu/MenuRepository.php:0
Stack trace:
#0 /home/erisho5/clients.erishost.com/vendor/illuminate/support/Facades/Facade.php(215): WHMCS\View\Client\Menu\MenuRepository->addContext()
#1 /home/erisho5/clients.erishost.com/tos.php(20): Illuminate\Support\Facades\Facade::__callStatic('addContext', Array)
#2 {main}

Is the exact error

Link to comment
Share on other sites

13 hours ago, Discordiaink said:

However, when i try to visit the page,i get an error message. you can see this at clients.erishost.com/tos.php . Am i missing something obvious?

As Kian says, enabling errors will give you a clue as to what it doesn't like...

two other thoughts...

  1. you could cut that .php page down to it's absolute minimum code... ... and then only add sidebars etc if you need them.
  2. there might be something specific you need to do to create new pages with Antler...
    http://inebur.com/antler/documentation/faq.html
    Quote

    How can I create a new page?

    First of all, find inside the item folder the empty.html file. If you want develop or create more pages, use the empty.html file and customize with 35+ short-code elements and sections. Please, check the empty page here

    the test of that would be to try your custom page using the Six template (currently it gives the same error too).
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