Jump to content
lims

{$systemurl} for PDF

Recommended Posts

I presume you mean on invoicepdf.tpl or quotepdf.tpl?  If so, I do not believe smarty is actually used for that and so using {$systemurl} wont work.

Share this post


Link to post
Share on other sites
11 minutes ago, steven99 said:

I presume you mean on invoicepdf.tpl or quotepdf.tpl?  If so, I do not believe smarty is actually used for that and so using {$systemurl} wont work.

it is true need for invoicepdf.tpl , when using this $companyurl  its work but this come to base domain setup, so i need for subdomain or sub directory work.

i'm using barcode in my invoice PDF, for temporary using manual url to do it

any some idea ?

Share this post


Link to post
Share on other sites
13 hours ago, lims said:

any some idea ?

as you have found, $companyurl will work (which is the value from general settings -> general -> domain), but $systemurl isn't passed to the template - therefore, there are three solutions that I can think of off-hand...

  1. manually hardcode it in the template (as you have currently) - if you're not going to change your systemURL frequently, then there's probably no harm in doing that.
  2. use the Class documentation to obtain the setting...
    use WHMCS\Config\Setting;
    $systemURL = Setting::getValue('SystemURL');

    adding that code to the top of the invoicepdf.tpl, anywhere after the <?php and before you want to use the variable, will work... when you want to output the System URL setting, you can just use $systemURL in the template wherever you want.

  3. similar to 2, you query the tblconfiguration database table direct using Capsule...

    use WHMCS\Database\Capsule;
    $systemURL = Capsule::table('tblconfiguration')->where('setting','SystemURL')->value('value');

    again, adding that code to the top of the invoicepdf.tpl, anywhere after the <?php and before you want to use the variable, will work... when you want to output the System URL setting, you can just use $systemURL in the template.

  • Thanks 1

Share this post


Link to post
Share on other sites

 

Another way would be to use a global variable.

$CONFIG['SystemURL'];

 

6 hours ago, brian! said:

use WHMCS\Config\Setting; $systemURL = Setting::getValue('SystemURL');

These 2 options will return the URL without the slash at the end.

6 hours ago, brian! said:

use WHMCS\Database\Capsule; $systemURL = Capsule::table('tblconfiguration')->where('setting','SystemURL')->value('value');

This will return the URL with the slash at the end.

https://domain.whmcs.com/

  • Thanks 1

Share this post


Link to post
Share on other sites
18 hours ago, brian! said:

as you have found, $companyurl will work (which is the value from general settings -> general -> domain), but $systemurl isn't passed to the template - therefore, there are three solutions that I can think of off-hand....

  • use the Class documentation to obtain the setting...

use WHMCS\Config\Setting;
$systemURL = Setting::getValue('SystemURL');

adding that code to the top of the invoicepdf.tpl, anywhere after the <?php and before you want to use the variable, will work... when you want to output the System URL setting, you can just use $systemURL in the template wherever you want.

i'm using option 2.. this work perfect thanks you so much  @brian! and @edvancombr

Share this post


Link to post
Share on other sites
18 hours ago, edvancombr said:

Another way would be to use a global variable.

the only reason that I didn't include that as an option was because in a previous post, one of the WHMCS developers suggested not to use it... now whether that's a personal preference of his or $CONFIG is getting deprecated at some point, I don't know... although as of today, it's still perfectly acceptable to use it. 🙂

Share this post


Link to post
Share on other sites
1 minute ago, brian! said:

the only reason that I didn't include that as an option was because in a previous post, one of the WHMCS developers suggested not to use it... now whether that's a personal preference of his or $CONFIG is getting deprecated at some point, I don't know... although as of today, it's still perfectly acceptable to use it. 🙂

I was not aware of this information.

The curious thing that keeps on working.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated