Jump to content

create new page


Recommended Posts

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.

Link to comment
Share on other sites

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 by ouldfella
Link to comment
Share on other sites

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.

 

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