ouldfella Posted May 12, 2020 Share Posted May 12, 2020 (edited) Hello, how to create a new page in WHMCS ??? i try this code https://developers.whmcs.com/advanced/creating-pages/ but i have an error " Oops! Something went wrong and we couldn't process your request. " I just copied and past their own code, it doesn't work how can create a new page then Edited May 12, 2020 by ouldfella 1 Quote Link to comment Share on other sites More sharing options...
bear Posted May 12, 2020 Share Posted May 12, 2020 Did you also create the template file and tell your page where to find it? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 12, 2020 Share Posted May 12, 2020 turning on error reporting in general settings -> other is going to give you more details about what's gone wrong. also, to cut the .php file down to bare minimum, it only needs to be along the lines of... <?php use WHMCS\ClientArea; define('CLIENTAREA', true); require __DIR__ . '/init.php'; $ca = new ClientArea(); $ca->setPageTitle('Blog'); $ca->addToBreadCrumb('index.php', Lang::trans('globalsystemname')); $ca->addToBreadCrumb('blog.php', 'Blog'); $ca->initPage(); $ca->setTemplate('blog'); $ca->output(); you'll only have to tweak it beyond that if you need to add context sidebars, capsule queries etc... all the above hook should need is to find the blog.tpl template (rename for your purposes) in your active template folder and it would output the page content. 1 Quote Link to comment Share on other sites More sharing options...
ouldfella Posted May 13, 2020 Author Share Posted May 13, 2020 (edited) thank for your reply, Quote ArgumentCountError: Too few arguments to function WHMCS\View\Client\Menu\MenuRepository::addContext(), 0 passed in /var/www/html/whmcs/vendor/illuminate/support/Facades/Facade.php on line 215 and exactly 2 expected in /var/www/html/whmcs/vendor/whmcs/whmcs-foundation/lib/View/Client/Menu/MenuRepository.php:0 Stack trace: #0 /var/www/html/whmcs/vendor/illuminate/support/Facades/Facade.php(215): WHMCS\View\Client\Menu\MenuRepository->addContext() #1 /var/www/html/whmcs/mypage.php(20): Illuminate\Support\Facades\Facade::__callStatic('addContext', Array) #2 {main} i commented this line //Menu::addContext(); the error doesn't existe, but i don't see the content of mypage.tpl mypage.php display an empty page in browser this is the content of mypage.php <?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(); require __DIR__ . '/modules/gateways/callback/gatewaysatimmodule.php'; if ($ca->isLoggedIn()) { $clientName = Capsule::table('tblclients') ->where('id', '=', $ca->getUserID())->pluck('firstname'); $ca->assign('clientname', $clientName); } else { $ca->assign('clientname', 'Random User'); } Menu::addContext(); Menu::primarySidebar('announcementList'); Menu::secondarySidebar('announcementList'); $ca->setTemplate('mypage'); $ca->output(); Edited May 13, 2020 by ouldfella 0 Quote Link to comment Share on other sites More sharing options...
bear Posted May 13, 2020 Share Posted May 13, 2020 Though I doubt it's causing the missing menu complaint, I'd assume you're on a version greater than 7.01? You're using "pluck" in the posted code, but it's been replaced. //'pluck' was renamed within WHMCS 7.0. Replace it with 'value' instead. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted May 13, 2020 Share Posted May 13, 2020 if I look at mypage.php on your site, I see this... Quote Gateway Module "gatewaysatimmodule" Not Activated remove that line from your php file and see if it displays anything in the browser. 1 Quote Link to comment Share on other sites More sharing options...
ouldfella Posted May 14, 2020 Author Share Posted May 14, 2020 Thank you everyone, it works 0 Quote Link to comment Share on other sites More sharing options...
ouldfella Posted May 20, 2020 Author Share Posted May 20, 2020 it doesn't work proprly, Quote Gateway Module "gatewaysatimmodule" Not Activated i removed that line but the page is empty 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.