Discordiaink Posted April 13, 2020 Share Posted April 13, 2020 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. 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted April 14, 2020 Share Posted April 14, 2020 We have to see the exact error since the "Oops" doesn't mean anything. Visit Setup > General Settings > Other and enable Display Errors. Once done visit tos page again to see the reason why you have the error. 0 Quote Link to comment Share on other sites More sharing options...
Discordiaink Posted April 14, 2020 Author Share Posted April 14, 2020 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 0 Quote Link to comment Share on other sites More sharing options...
Discordiaink Posted April 14, 2020 Author Share Posted April 14, 2020 Ahh, that error gave me the info i needed to figure this out. The template doesnt pass any context, so would default in the error if i don't fill in. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted April 14, 2020 Share Posted April 14, 2020 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... you could cut that .php page down to it's absolute minimum code... ... and then only add sidebars etc if you need them. 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). 0 Quote Link to comment Share on other sites More sharing options...
Discordiaink Posted April 14, 2020 Author Share Posted April 14, 2020 Great resources, thank you. I believe i've got it worked out, I'm delving into the sidebars today. Thank you for the great help. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.