Jump to content

WHMCS Function in Site Page


Alicksis

Recommended Posts

Hi,

 

I am aware of creating custom pages for WHMCS, but i'm not trying to create the page through the billing client. I want the welcome_box div with language file support to appear on the homepage. To do this I know my index.html needs to become index.php and i need to somehow load the configuaration.php and other php files, could you tell me what I need to put at the top of my page for it to be compatible with whmcs functions, language files etc.

 

Thanks

Link to comment
Share on other sites

Hello,

 

What are you trying to do? What functions are you trying to run?

 

Assuming your billing system and home page are on the same user to get the language file all you need to do is a php require():

<? 
// Change '/home/USER/public_html/WHMCS FOLDER/' to direct to your WHMCS folder
require_once("/home/USER/public_html/WHMCS FOLDER/lang/English.txt");
?>

 

To output any of the language file settings:

<?
// To get a complete list of all the lang variables open up the language file.
echo $_LANG['creditcardnostore'];
?>

 

Please note, some strings have specific formats that dynamically add in variables to the string. You will notice the '%s' on some of the string values. To load the dynamic string look into sprintf(). You may need to connect to the database to get the information you need to dynamically edit the string.

 

If you need to get database information:

<? 
// Change '/home/USER/public_html/WHMCS FOLDER/' to direct to your WHMCS folder
require_once("/home/USER/public_html/WHMCS FOLDER/dbconnect.php");
?>

 

You can then run a normal php mysql_query() command.

Link to comment
Share on other sites

Hello,

 

What are you trying to do? What functions are you trying to run?

 

Assuming your billing system and home page are on the same user to get the language file all you need to do is a php require():

<? 
// Change '/home/USER/public_html/WHMCS FOLDER/' to direct to your WHMCS folder
require_once("/home/USER/public_html/WHMCS FOLDER/lang/English.txt");
?>

 

To output any of the language file settings:

<?
// To get a complete list of all the lang variables open up the language file.
echo $_LANG['creditcardnostore'];
?>

 

Please note, some strings have specific formats that dynamically add in variables to the string. You will notice the '%s' on some of the string values. To load the dynamic string look into sprintf(). You may need to connect to the database to get the information you need to dynamically edit the string.

 

If you need to get database information:

<? 
// Change '/home/USER/public_html/WHMCS FOLDER/' to direct to your WHMCS folder
require_once("/home/USER/public_html/WHMCS FOLDER/dbconnect.php");
?>

 

You can then run a normal php mysql_query() command.

 

You'll only need the dbconnect.php included for that. The language files don't have any PHP-tags, so if you're including them, it just shows you a raw output of all defined language items. If you only include the dbconnect.php in your page, you can also use the language items:

 

<?php
require("dbconnect.php"); // Define the location of your WHMCS dbconnect.php file
?>

Link to comment
Share on other sites

You'll only need the dbconnect.php included for that. The language files don't have any PHP-tags, so if you're including them, it just shows you a raw output of all defined language items. If you only include the dbconnect.php in your page, you can also use the language items:

 

<?php
require("dbconnect.php"); // Define the location of your WHMCS dbconnect.php file
?>

 

I have no error so it looks as if I have sucessfully linked up the correct dbconnect.php

 

but on my index.php file, I am still seeing below instead of the appropriate language file alternatives.

 

Any help?

 

 

{if $loggedin}{$LANG.welcomeback}, {$clientsdetails.firstname} {$LANG.clientareanavdetails} - {$LANG.logouttitle}{else}{$LANG.please} {$LANG.loginbutton} {$LANG.or} {$LANG.clientregistertitle}{/if}

Link to comment
Share on other sites

I have no error so it looks as if I have sucessfully linked up the correct dbconnect.php

 

but on my index.php file, I am still seeing below instead of the appropriate language file alternatives.

 

Any help?

 

 

{if $loggedin}{$LANG.welcomeback}, {$clientsdetails.firstname} {$LANG.clientareanavdetails} - {$LANG.logouttitle}{else}{$LANG.please} {$LANG.loginbutton} {$LANG.or} {$LANG.clientregistertitle}{/if}

 

Everything inside the { and } will be parsed by Smarty. I guess you're not using Smarty on your index.php page. ;) The thing you want is probably described here: http://forum.whmcs.com/showthread.php?p=136028#post136028

 

That shows the user to login or register when he's not logged in, or his name and edit details/logout link when he's logged in.

Link to comment
Share on other sites

Hi

 

thanks for this support btw, much appreciated!

 

Though thats worked great, if I go to the homepage it always tells me to login or register even if I am logged on, but if i press login it will take me to the client area and at the top it says that im logged in, is this a cookies issue?

 

Thanks

Link to comment
Share on other sites

Hi

 

thanks for this support btw, much appreciated!

 

Though thats worked great, if I go to the homepage it always tells me to login or register even if I am logged on, but if i press login it will take me to the client area and at the top it says that im logged in, is this a cookies issue?

 

Thanks

 

WHMCS cookies are stored on root level for as far as I can see, so that shouldn't be a problem. I just tried this on our test environment and it just works as it should (with an index.php located at root level and the WHMCS-installation in the /whcms/ folder). Just shows me as logged in.\

 

--EDIT

When I check the "remember me" checkbox when logging in, close my browser, reopen it again and go to the index.php. It shows me as logged out. When I click on "Log in", it shows me as logged in. When returning to the index.php it also shows me as logged in. I don't have a solution for this I'm affraid.

Edited by m00
Link to comment
Share on other sites

WHMCS cookies are stored on root level for as far as I can see, so that shouldn't be a problem. I just tried this on our test environment and it just works as it should (with an index.php located at root level and the WHMCS-installation in the /whcms/ folder). Just shows me as logged in.\

 

--EDIT

When I check the "remember me" checkbox when logging in, close my browser, reopen it again and go to the index.php. It shows me as logged out. When I click on "Log in", it shows me as logged in. When returning to the index.php it also shows me as logged in. I don't have a solution for this I'm affraid.

 

Ah, could it be for me, because the whmcs is on a seperate subdomain?

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