Jump to content

Help with a template change


kwood

Recommended Posts

Hi,
Wonder if anyone could advise please.
I am trying to either remove or alter the link of the 'portal home' but I cannot find it in the tpl. Not sure where else to look. I honestly just want to change were it points too. I have attached a copy of the HTML inspection of it, but I just cannot find it in any of the tpl files. If anyone could point me in the right direction, it would really be grateful. I am all new to php, and I am trying to teach myself as I go along.

Capture.JPG

Link to comment
Share on other sites

  • 1 month later...

You will find it in header.tpl 

        <div class="navbar navbar-light">
            <div class="container">
                <a class="navbar-brand mr-3" href="{$WEB_ROOT}/index.php">
                    {if $assetLogoPath}
                        <img src="{$assetLogoPath}" alt="{$companyname}" class="logo-img">
                    {else}
                        {$companyname}
                    {/if}
                </a>
Link to comment
Share on other sites

47 minutes ago, MrGettingRatherFrustrated said:

You will find it in header.tpl 

technically, that piece of code posted is from /templates/(six or 21)/includes/breadcrumb.tpl rather than header.tpl.

On 26/03/2021 at 09:56, kwood said:

If anyone could point me in the right direction, it would really be grateful. I am all new to php, and I am trying to teach myself as I go along.

probably the easiest way to change the link would be with PHP by using an action hook.

<?php

add_hook('ClientAreaPage', 1, function($vars) {	
	$breadcrumb = $vars['breadcrumb'];
	$breadcrumb[0]['link'] = "https://www.google.co.uk";
	return array('breadcrumb' => $breadcrumb);
});

obviously, you won't want to link to Google, so that URL can be changed to either a full URL as above, or a local page, e.g clientarea.php

Link to comment
Share on other sites

  • 2 weeks later...
  • 1 month later...
On 29/04/2021 at 1:45 PM, brian! said:

technically, that piece of code posted is from /templates/(six or 21)/includes/breadcrumb.tpl rather than header.tpl.

probably the easiest way to change the link would be with PHP by using an action hook.


<?php

add_hook('ClientAreaPage', 1, function($vars) {	
	$breadcrumb = $vars['breadcrumb'];
	$breadcrumb[0]['link'] = "https://www.google.co.uk";
	return array('breadcrumb' => $breadcrumb);
});

obviously, you won't want to link to Google, so that URL can be changed to either a full URL as above, or a local page, e.g clientarea.php

Thank you very much, this has worked nicely.

Would you mind breaking down each section of this code to explain how it works, please? I am trying to understand how this is able to do what it has done.

I am considering on going onto a PHP course.

 

Link to comment
Share on other sites

7 minutes ago, kwood said:

Would you mind breaking down each section of this code to explain how it works, please? I am trying to understand how this is able to do what it has done.

  • the add_hook line tells WHMCS which hook point to use - ClientAreaPage runs on all client area pages.
  • $breadcrumb line takes the $breadcrumb array from the template.
  • third line changes the 'link' value on the first element of the array
  • fourth line returns the modified array back to the template for it to use.
8 minutes ago, kwood said:

I am considering on going onto a PHP course.

I can think of one or two members of WHMCS staff that you could take with you!

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