iamcorbito Posted October 11, 2018 Share Posted October 11, 2018 Is there a way to add your own full width panel above the client area home page panels? I tried looking at their documentation but i didnt find what I wanted. Or if i could make one of those panels into full width that could work too. Thanks! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 12, 2018 Share Posted October 12, 2018 On 11/10/2018 at 06:06, iamcorbito said: Is there a way to add your own full width panel above the client area home page panels? I tried looking at their documentation but i didnt find what I wanted. Or if i could make one of those panels into full width that could work too. if it's just one panel that you want to make full width, then frankly I would just fake it in the clientareahome.tpl template... you'd have to redesign the template to allow them to be full-width by default. so in the above example, i've just copied the "Overdue invoices" panel source code and pasted it in a col-12 div... <div class="client-home-panels"> <div class="row"> <div class="col-sm-12"> <div menuItemName="Full Panel 1" class="panel panel-default panel-accent-red"> <div class="panel-heading"> <h3 class="panel-title"> <div class="pull-right"> <a href="clientarea.php?action=masspay&all=true" class="btn btn-default bg-color-red btn-xs"> <i class="fas fa-arrow-right"></i>{$LANG.invoicespaynow} </a> </div> <i class="fas fa-calculator"></i> {$LANG.clientHomePanels.overdueInvoices} </h3> </div> <div class="panel-body"> <p>You have 5 overdue invoice(s) with a total balance due of £59.03 GBP. Pay them now to avoid any interruptions in service.</p> </div> <div class="panel-footer"> </div> </div> </div> <div class="col-sm-6"> {function name=outputHomePanels} in practice, what you should do is replace the titles with Language Overrides (as above) and then it's just a case of customising it for your own needs. For example, if the content of this panel needs to behave like the other panels and pull information from the database, then you'd be looking at using a ClientAreaPageHome hook to get the required information and pass it back to the template as a variable and then use that variable in the body of the panel instead of the above string. if you had multiple full-width panels, you could even do the same with the links, but I wouldn't have though it would be worth it under most circumstances. 0 Quote Link to comment Share on other sites More sharing options...
iamcorbito Posted October 16, 2018 Author Share Posted October 16, 2018 Thanks man. I will look into Language Overrides. Also can you give an example of this? On 10/12/2018 at 10:11 PM, brian! said: pass it back to the template as a variable 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 16, 2018 Share Posted October 16, 2018 On 16/10/2018 at 07:01, iamcorbito said: Also can you give an example of this? at its most basic, you're returning array(s) back to the template - they could be text strings, variables pulled from the class docs or database etc.. <?php function custom_welcome_back($vars) { $clientsdetails = $vars['clientsdetails']; $welcomemessage = Lang::trans('welcomeback').', '.$clientsdetails['firstname']; return array('welcomemessage' => $welcomemessage); } add_hook("ClientAreaPageHome",1,"custom_welcome_back"); so the above hook will create a string using a combination of a Language string and the client's first name and return it the clientareahome page template as a variable that can be output using {$welcomemessage} <div class="panel-body"> <p>{$welcomemessage}</p> </div> in many ways, it's a silly hook example because you could do all that in the template anyway without the need for a hook (using available Smarty variables in the template), but I daresay whatever example I gave probably wouldn't be applicable to your specific situation. 🙂 there are other hook examples posted in the community, by myself and others, that show how to pull information from the database and/or the Class docs - but if none of them cover what you want to do, you can always ask for advice. 0 Quote Link to comment Share on other sites More sharing options...
iamcorbito Posted October 16, 2018 Author Share Posted October 16, 2018 The above example is exactly what i need actually. Now im just trying to find out why im getting hooks.php. Error: syntax error, unexpected '}' on my error logs even though i only have the above code. 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 17, 2018 Share Posted October 17, 2018 19 hours ago, iamcorbito said: The above example is exactly what i need actually if you're not going to query the database or the class docs for information, and can get it from existing template variables, then I wouldn't bother using a hook - you're having to edit the template anyway, so just add your code using Smarty to it... e.g to reproduce that hook in your template, it just needs this... <div class="panel-body"> <p>{$LANG.welcomeback}, {$clientsdetails.firstname}.</p> </div> that said, I can't see anything wrong with the hook code as I did test it before posting and included the output it generated.. 0 Quote Link to comment Share on other sites More sharing options...
iamcorbito Posted October 22, 2018 Author Share Posted October 22, 2018 Changing the 'welcomemessage' to 'any_random_text' made it work for me. return array('welcomemessage' => $welcomemessage); it seems i cant use it. This thread can be closed. Thank you so much for the help! 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.