我想将项目编辑到whmcs
模板中提供的导航栏中。我该如何编辑,让任何人对此有所了解?
下面是网站图片。
https://drive.google.com/file/d/1Ytq4hxF0jXYCtc3_lbUEVlVxKPX8pb21/view?usp=sharing
我正在为我的公司项目修改whmcs
模板。网站使用PHP,Html,CSS和一些JavaScript代码。我已将某些页面修改为也更改了导航栏项目的URL。但是我无法在导航栏中添加或删除项目。
导航栏来自以下代码。
{foreach $navbar as $item}
<li menuItemName="{$item->getName()}" class="{if $item->hasChildren()}dropdown{/if}{if $item->getClass()} {$item->getClass()}{/if}" id="{$item->getId()}">
<a {if $item->hasChildren()}class="dropdown-toggle" data-toggle="dropdown" href="#"{else}href="{$item->getUri()}"{/if}{if $item->getAttribute('target')} target="{$item->getAttribute('target')}"{/if}>
{if $item->hasIcon()}<i class="{$item->getIcon()}"></i> {/if}
{$item->getLabel()}
{if $item->hasBadge()} <span class="badge">{$item->getBadge()}</span>{/if}
{if $item->hasChildren()} <b class="caret"></b>{/if}
</a>
{if $item->hasChildren()}
<ul class="dropdown-menu">
{foreach $item->getChildren() as $childItem}
<li menuItemName="{$childItem->getName()}"{if $childItem->getClass()} class="{$childItem->getClass()}"{/if} id="{$childItem->getId()}">
<a href="{$childItem->getUri()}"{if $childItem->getAttribute('target')} target="{$childItem->getAttribute('target')}"{/if}>
{if $childItem->hasIcon()}<i class="{$childItem->getIcon()}"></i> {/if}
{$childItem->getLabel()}
{if $childItem->hasBadge()} <span class="badge">{$childItem->getBadge()}</span>{/if}
</a>
</li>
{/foreach}
</ul>
{/if}
</li>
{/foreach}
答案 0 :(得分:2)
WHMCS自动生成菜单,必须创建一个钩子才能更改菜单;请参阅钩子:ClientAreaPrimaryNavbar。 将您的代码放入:
WHMCS_ROOT \ includes \ hooks \ MyPrimaryNavbar.php
这是示例代码:
<?php
$ca = new WHMCS_ClientArea();
use WHMCS\View\Menu\Item as MenuItem;
use Illuminate\Database\Capsule\Manager as Capsule;
add_hook('ClientAreaPrimaryNavbar', 1, function (MenuItem $primaryNavbar)
{
global $CONFIG;
$friendlyurl = $CONFIG['RouteUriPathMode'];
if($friendlyurl == 'acceptpathinfo')
{
$urlpath = 'index.php/store/';
}
elseif($friendlyurl == 'rewrite')
{
$urlpath = 'store/';
}
elseif ($friendlyurl == 'basic')
{
$urlpath = 'index.php?rp=/store/';
}
$marketconnect = Capsule::table('tblmarketconnect_services')->where('status', '1')->get();
$client = Menu::context('client');
// Navbar Items for Clients
if(!is_null($primaryNavbar->removeChild('Affiliates'))){}
if(!is_null($primaryNavbar->removeChild('Open Ticket'))){}
if(!is_null($primaryNavbar->removeChild('Store'))){}
if(!is_null($primaryNavbar->removeChild('Website Security'))){}
// Moved custom pages in services child menu
if(!is_null($primaryNavbar->getChild('Services')))
{
$primaryNavbar->getChild('Services')->removeChild('Order New Services');
if(count($marketconnect))
{
foreach ($marketconnect as $service)
{
if ($service->name == 'symantec')
{
$primaryNavbar->getChild('Services')->addChild('Manage SSL Certificates',array(
'label' => Lang::trans('navManageSsl'),
'uri' => $urlpath.'ssl-certificates/manage',
'order' => '20',
));
}
}
}
$primaryNavbar->getChild('Services')->addChild('Web Hosting', array(
'uri' => 'web-hosting.php',
'order' => '60',
));
#$primaryNavbar->getChild('Services')->addChild('Backup as a Service', array(
# 'uri' => 'backup.php',
# 'order' => '70',
# ));
$primaryNavbar->getChild('Services')->addChild('Backup Service', array(
'uri' => 'backup-new.php',
'order' => '75',
));
#$primaryNavbar->getChild('Services')->addChild('Mail Hosting', array(
# 'uri' => 'mail-hosting.php',
# 'order' => '80',
# ));
$primaryNavbar->getChild('Services')->addChild('Mail Hosting', array(
'uri' => 'mail-hosting-new.php',
'order' => '85',
));
$primaryNavbar->getChild('Services')->addChild('E-Mail', array(
'uri' => 'mail.php',
'order' => '90',
));
$primaryNavbar->getChild('Services')->addChild('DSGVO TOM Software', array(
'uri' => 'dsgvo.php',
'order' => '95',
));
//$primaryNavbar->getChild('Services')
// ->addChild('SSL Certificates', array(
// 'label' => Lang::trans('navMarketConnectService.symantec'),
// 'uri' => 'ssl-certificates.php',
// 'order' => '100',
//));
if (count($marketconnect))
{
foreach ($marketconnect as $service)
{
if ($service->name == 'symantec')
{
$primaryNavbar->getChild('Services')->addChild('SSL Certificates', array(
'label' => Lang::trans('navMarketConnectService.symantec'),
'uri' => $urlpath.'ssl-certificates',
'order' => '100',
));
}
elseif ($service->name == 'weebly')
{
$primaryNavbar->getChild('Services')->addChild('Website Builder', array(
'label' => Lang::trans('navMarketConnectService.weebly'),
'uri' => $urlpath.'website-builder',
'order' => '110',
));
}
if ($service->name == 'spamexperts')
{
$primaryNavbar->getChild('Services')->addChild('E-mail Services', array(
'label' => Lang::trans('navMarketConnectService.spamexperts'),
'uri' => $urlpath.'email-services',
'order' => '120',
));
}
}
}
}
//Moved Affiliate links to under Billing child menu
if(!is_null($primaryNavbar->getChild('Billing'))){
$primaryNavbar->getChild('Billing')
->addChild('Affiliates', array(
'label' => Lang::trans('affiliatestitle'),
'uri' => 'affiliates.php',
'order' => '70',
));
}
//Moved Open Ticket links to under Support child menu
if (!is_null($primaryNavbar->getChild('Support'))){
$primaryNavbar->getChild('Support')->addChild('Open Ticket', array(
'label' => Lang::trans('navopenticket'),
'uri' => 'submitticket.php',
'order' => '10',
));
$primaryNavbar->getChild('Support')->addChild('Contact Us', array(
'label' => Lang::trans('contactus'),
'uri' => 'contact.php',
'order' => '70',
));
}
// Custom About Us menu rearrange order for clients
//if (!is_null($primaryNavbar->addChild('Über uns'))) {
// $navItem = $primaryNavbar->getChild('Über uns');
// if (is_null($navItem)) {
// return;
// }
// $navItem->setOrder(40);
// $navItem->setUri('about-us.php');
//}
if(is_null($client))
{
// Navbar Items for visitors
if (!is_null($primaryNavbar->removeChild('Announcements'))){}
if (!is_null($primaryNavbar->removeChild('Network Status'))){}
if (!is_null($primaryNavbar->removeChild('Knowledgebase'))){}
// Custom Servers menu for logout clients
if (!is_null($primaryNavbar->addChild('Services'))){
$navItem = $primaryNavbar->getChild('Services');
if (is_null($navItem)){
return;
}
$navItem->setOrder(20);
$navItem->setLabel(Lang::trans('navservices'));
$primaryNavbar->getChild('Services')->addChild('Web Hosting', array(
'uri' => 'web-hosting.php',
'order' => '10',
));
$primaryNavbar->getChild('Services')->addChild('Backup Service', array(
'uri' => 'backup-new.php',
'order' => '20',
));
$primaryNavbar->getChild('Services')->addChild('Mail Hosting', array(
'uri' => 'mail-hosting-new.php',
'order' => '25',
));
$primaryNavbar->getChild('Services')->addChild('E-Mail Service', array(
'uri' => 'mail-service.php',
'order' => '30',
));
$primaryNavbar->getChild('Services')->addChild('Software', array(
'uri' => 'software.php',
'order' => '40',
));
//$primaryNavbar->getChild('Services')
// ->addChild('SSL Certificates', array(
// 'label' => Lang::trans('navMarketConnectService.symantec'),
// 'uri' => 'ssl-certificates.php',
// 'order' => '50',
//));
if (count($marketconnect)){
foreach ($marketconnect as $service) {
if ($service->name == 'symantec') {
$primaryNavbar->getChild('Services')->addChild('SSL Certificates', array(
'label' => Lang::trans('navMarketConnectService.symantec'),
'uri' => $urlpath.'ssl-certificates',
'order' => '50',
));
}
elseif ($service->name == 'weebly') {
$primaryNavbar->getChild('Services')->addChild('Website Builder', array(
'label' => Lang::trans('navMarketConnectService.weebly'),
'uri' => $urlpath.'website-builder',
'order' => '60',
));
}
if($service->name == 'spamexperts'){
$primaryNavbar->getChild('Services')->addChild('E-mail Services', array(
'label' => Lang::trans('navMarketConnectService.spamexperts'),
'uri' => $urlpath.'email-services',
'order' => '70',
));
}
}
}
}
//Custom support menu
if (!is_null($primaryNavbar->addChild('Support'))) {
$navItem = $primaryNavbar->getChild('Support');
if(is_null($navItem)){
return;
}
$navItem->setOrder(20);
$navItem->setLabel(Lang::trans('navsupport'));
$primaryNavbar->getChild('Support')->addChild('Tickets', array(
'label' => Lang::trans('navtickets'),
'uri' => 'supporttickets.php',
'order' => '10',
));
$primaryNavbar->getChild('Support')->addChild('Knowledgebase', array(
'label' => Lang::trans('knowledgebasetitle'),
'uri' => 'knowledgebase.php',
'order' => '20',
));
$primaryNavbar->getChild('Support')->addChild('Announcements', array(
'label' => Lang::trans('announcementstitle'),
'uri' => 'announcements.php',
'order' => '30',
));
$primaryNavbar->getChild('Support')->addChild('Network Status', array(
'label' => Lang::trans('networkstatustitle'),
'uri' => 'serverstatus.php',
'order' => '40',
));
}
// Custom About Us menu rearrange order for visitors
$navItem = $primaryNavbar->getChild('About us');
if (is_null($navItem)){
return;
}
$navItem->setOrder(30);
}
});
?>