zmen Posted September 6, 2018 Share Posted September 6, 2018 Hello. I want to create custom page without breadcrumb and container (col-xs-12). Because i have elements with full width. I see val $skipMainBodyContainer, but how i can use it on custom page? Create page with this: https://developers.whmcs.com/advanced/creating-pages/ 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 8, 2018 Share Posted September 8, 2018 On 06/09/2018 at 13:21, zmen said: I see val $skipMainBodyContainer, but how i can use it on custom page? where do you see it ? it's not ringing any bells with me.. 😕 0 Quote Link to comment Share on other sites More sharing options...
zmen Posted September 9, 2018 Author Share Posted September 9, 2018 header.tpl <section id="main-body"> <div class="container{if $skipMainBodyContainer}-fluid without-padding{/if}"> <div class="row"> {if !$inShoppingCart && ($primarySidebar->hasChildren() || $secondarySidebar->hasChildren())} {if $primarySidebar->hasChildren() && !$skipMainBodyContainer} <div class="col-md-9 pull-md-right"> {include file="$template/includes/pageheader.tpl" title=$displayTitle desc=$tagline showbreadcrumb=true} </div> {/if} <div class="col-md-3 pull-md-left sidebar"> {include file="$template/includes/sidebar.tpl" sidebar=$primarySidebar} </div> {/if} <!-- Container for main page display content --> <div class="{if !$inShoppingCart && ($primarySidebar->hasChildren() || $secondarySidebar->hasChildren())}col-md-9 pull-md-right{else}col-xs-12{/if} main-content"> {if !$primarySidebar->hasChildren() && !$showingLoginPage && !$inShoppingCart && $templatefile != 'homepage' && !$skipMainBodyContainer} {include file="$template/includes/pageheader.tpl" title=$displayTitle desc=$tagline showbreadcrumb=true} {/if} 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 10, 2018 Share Posted September 10, 2018 On 09/09/2018 at 10:28, zmen said: header.tpl aah - hiding in plain sight.. the little rascal. if you don't want to add breadcrumbs, then don't define them in the php page... with regards to full width, you can use the following in header.tpl {if $filename eq '*custom filename*'} {assign skipMainBodyContainer true} {/if} and so by implication, you should be able to do the same with a hook... setting the variable in the php file doesn't seem to work though. 0 Quote Link to comment Share on other sites More sharing options...
zmen Posted September 10, 2018 Author Share Posted September 10, 2018 36 minutes ago, brian! said: aah - hiding in plain sight.. the little rascal. if you don't want to add breadcrumbs, then don't define them in the php page... with regards to full width, you can use the following in header.tpl {if $filename eq '*custom filename*'} {assign skipMainBodyContainer true} {/if} and so by implication, you should be able to do the same with a hook... setting the variable in the php file doesn't seem to work though. I could not do urs example. Just do: <div class="container{if $skipMainBodyContainer}-fluid without-padding{/if}{if $templatefile == 'custom_page'}-fluid without-padding{/if}"> But how i must write it to use many page in if or just copy many times this if? And i remove pageheader with this: {if $templatefile != 'custom_page'} <div class="header-lined"> <h1>{$title}{if $desc} <small>{$desc}</small>{/if}</h1> {if $showbreadcrumb}{include file="$template/includes/breadcrumb.tpl"}{/if} </div> {/if} So the same question (a few pages) And you say that i can do this with hook. Can you write the example ? 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted September 11, 2018 Share Posted September 11, 2018 let's say we create a *very* basic PHP custom page - no sidebars, no login requirement and no breadcrumbs... <?php use WHMCS\ClientArea; define('CLIENTAREA', true); require __DIR__ . '/init.php'; $ca = new ClientArea(); $ca->setPageTitle('Custom Page'); $ca->initPage(); $ca->setTemplate('custom'); $ca->output(); and then in the custom.tpl template, if we just use some Lorem Ipsum text (with no divs), that would give you the following output... there is a slight gap where the empty $breadcrumb array is outputting - they'd be a number of ways to fix that... you could pass $breadcrumb=false in header.tpl, or you could modify /includes/breadcrumb.tpl to only output if there are breadcrumbs in the array... however, if you're going to set the value of $skipMainBodyContainer using a hook on these custom pages, then neither Pagetitle or breadcrumbs will be shown anyway, and so you'll see full-width output... and the hook to set custom page(s) full width, would be... <?php # Set Selected Custom Pages Full Width Hook # Written by brian! function client_custom_pages_hook($vars) { $custom_filenames = ['custom','custom2']; $filename = $vars['filename']; if (in_array($filename,$custom_filenames)) { return array("skipMainBodyContainer" => true); } } add_hook("ClientAreaPage", 1, "client_custom_pages_hook"); ?> so in the above example, custom.php and custom2.php pages would show their content full-width (assuming no sidebars enabled etc)... all other pages, would display as normal. 0 Quote Link to comment Share on other sites More sharing options...
Md Rasel Khan Posted February 12, 2020 Share Posted February 12, 2020 On 9/11/2018 at 9:30 PM, brian! said: let's say we create a *very* basic PHP custom page - no sidebars, no login requirement and no breadcrumbs... <?php use WHMCS\ClientArea; define('CLIENTAREA', true); require __DIR__ . '/init.php'; $ca = new ClientArea(); $ca->setPageTitle('Custom Page'); $ca->initPage(); $ca->setTemplate('custom'); $ca->output(); and then in the custom.tpl template, if we just use some Lorem Ipsum text (with no divs), that would give you the following output... there is a slight gap where the empty $breadcrumb array is outputting - they'd be a number of ways to fix that... you could pass $breadcrumb=false in header.tpl, or you could modify /includes/breadcrumb.tpl to only output if there are breadcrumbs in the array... however, if you're going to set the value of $skipMainBodyContainer using a hook on these custom pages, then neither Pagetitle or breadcrumbs will be shown anyway, and so you'll see full-width output... and the hook to set custom page(s) full width, would be... <?php # Set Selected Custom Pages Full Width Hook # Written by brian! function client_custom_pages_hook($vars) { $custom_filenames = ['custom','custom2']; $filename = $vars['filename']; if (in_array($filename,$custom_filenames)) { return array("skipMainBodyContainer" => true); } } add_hook("ClientAreaPage", 1, "client_custom_pages_hook"); ?> so in the above example, custom.php and custom2.php pages would show their content full-width (assuming no sidebars enabled etc)... all other pages, would display as normal. Thanks @brian! 0 Quote Link to comment Share on other sites More sharing options...
mandibl Posted August 20, 2020 Share Posted August 20, 2020 On 2/12/2020 at 9:41 AM, Md Rasel Khan said: Thanks @brian! Where to add this hook Im not getting it.. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted August 21, 2020 Share Posted August 21, 2020 21 hours ago, mandibl said: Where to add this hook Im not getting it.. /includes/hooks - give it a memorable filename and ensure that the filename ends with .php 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.