Alicksis Posted February 13, 2010 Share Posted February 13, 2010 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 0 Quote Link to comment Share on other sites More sharing options...
jeremyhaber Posted February 13, 2010 Share Posted February 13, 2010 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. 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted February 13, 2010 Share Posted February 13, 2010 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 ?> 0 Quote Link to comment Share on other sites More sharing options...
Alicksis Posted February 13, 2010 Author Share Posted February 13, 2010 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} 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted February 13, 2010 Share Posted February 13, 2010 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. 0 Quote Link to comment Share on other sites More sharing options...
Alicksis Posted February 13, 2010 Author Share Posted February 13, 2010 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 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted February 13, 2010 Share Posted February 13, 2010 (edited) 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 February 13, 2010 by m00 0 Quote Link to comment Share on other sites More sharing options...
Alicksis Posted February 13, 2010 Author Share Posted February 13, 2010 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? 0 Quote Link to comment Share on other sites More sharing options...
m00 Posted February 13, 2010 Share Posted February 13, 2010 Ah, could it be for me, because the whmcs is on a seperate subdomain? Yep, see your e-mail. 0 Quote Link to comment Share on other sites More sharing options...
Alicksis Posted February 13, 2010 Author Share Posted February 13, 2010 Where should the .js go, ive tried head and the div tags, and nothing shows? also thanks for this 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.