Jump to content

{$systemurl} for PDF


lims

Recommended Posts

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 ?

Link to comment
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.

Link to comment
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/

Link to comment
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

Link to comment
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. 🙂

Link to comment
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.

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