Difference between revisions of "Misc"
(→Dispaying news on any page) |
|||
Line 155: | Line 155: | ||
Then use the code in the configuration, news section on any template in order to display the news. | Then use the code in the configuration, news section on any template in order to display the news. | ||
+ | |||
+ | |||
+ | ==Overridiing system generated hosting usernames and/or passwords== | ||
+ | |||
+ | If you make this file it will be included: | ||
+ | |||
+ | /includes/mycartpwd.php | ||
+ | |||
+ | The variables you will need are: | ||
+ | |||
+ | $this_username | ||
+ | $this_password | ||
+ | |||
+ | These 2 variables hold the current system generated username and password that will be written to the DB and used. | ||
+ | |||
+ | Other avaliable variables are: | ||
+ | |||
+ | $row[cartsld] is the domain sld | ||
+ | $row[carttld] is the domain tld | ||
+ | |||
+ | |||
+ | You can manipulate them as you wish here (using php code), but be sure you write your changes back the same variable names. | ||
+ | Also, be sure to respect hosting control panel rules (ex: if the username is too long or short the account creation will fail etc..). | ||
+ | |||
+ | Also, you should incorporate our username dupecheck into your routines. | ||
+ | |||
+ | $xcheck=check_username($this_username,$row[cartId]); | ||
+ | |||
+ | You would check that $xcheck is not greater than 0 and if so, re-generate the username. |
Revision as of 11:10, July 30, 2008
Contents
- 1 Using alternate package display
- 2 Displaying testimonials
- 3 Displaying the Shopping Cart Box
- 4 Changing the number of tlds displayed on the site home page
- 5 Custom User Fields
- 6 Creating Custom Variables
- 7 Dispaying news on any page
- 8 Overridiing system generated hosting usernames and/or passwords
Using alternate package display
If you wish to use the alternate display for your packages;
Enter desired information displayed in the 'Layout 2 Package Display Text' for each hosting package. You can use html code in that text area field, just be careful not to use special characters or quotes in the code. Do not include full html page tags, only enter a table or div tags to start and end your code.
In your includes directory, rename hstable-reanme-me.php to hstable.php.
This will change the display for all hosting packages in the system.
For Dedicated Servers, do the same as above, except rename the includes/dstable_rename_me.php file to dstable.php
Displaying testimonials
Add quotes you have received from your customers that you want to post on your site.
The testimonies can be displayed using these variables on any page:
<?=$quotes[0][testimonial]?> <?=$quotes[0][sig1]?> <?=$quotes[0][sig2]?> <?=$quotes[1][testimonial]?> <?=$quotes[1][sig1]?> <?=$quotes[1][sig2]?>
You can display as many as you like, just increment the $quotes number for each one. The above example will display 2 testimonials.
Also, set the number_of_quotes to a value of 2 in the Extended System Configuration. (2 to display 2 quotes at a time, adjust as per how many display code settings you put code in the template)
(As long as this number is greater than the number of quotes in the db, all will be returned into the array.)
The testimonials in your database will be randomly chosen to fill the displays.
Displaying the Shopping Cart Box
Variables used to create a 'shopping cart' box on your site:
You have <?=$curcart[items]?> items in your cart.
<a href="<?=$curcart[view]?>">View Cart</a>
<a href="<?=$curcart[checkout]?>">Checkout</a>
Changing the number of tlds displayed on the site home page
Edit the tlimit setting in the Extended System Configuration to set the number of tlds to show on your home page.
Custom User Fields
There are 3 available custom fields you can setup to gather custom information during new account creation.
To enable the custom fields, edit the includes/languages/[each_language]/createacct.php and the editprofile.php files with a text editor.
Remove the remarks (//) from the beginning of the lines for the custom fields you wish to use.
Be sure to edit the createacct.php and editprofile.php files in all languages that you offer.
Look for this section:
//CREATEACCOUNT CUSTOM FIELDS;uncomment the below variables to enable adding custom fields to the customer's record during create account //define(CUSTOM1, "custom 1 field"); //define(CUSTOM2, "custom 2 field"); //define(CUSTOM3, "custom 3 field"); //end custom fields
Example of setting up one extra field used for collecting a customer's VAT ID:
//CREATEACCOUNT CUSTOM FIELDS;uncomment the below variables to enable adding custom fields to the customer's record during create account define(CUSTOM1, "Your VAT ID"); //define(CUSTOM2, "custom 2 field"); //define(CUSTOM3, "custom 3 field"); //end custom fields
To configure the field(s) as required, edit the same files (createacct.php and editprofile.php in each language directory).
Look for this:
//v1.2.4 //define(CUSTOM1NOTREQUIRED, "1"); //define(CUSTOM2NOTREQUIRED, "1"); //define(CUSTOM3NOTREQUIRED, "1");
For the above VAT example, to make the VAT field required change to this:
//v1.2.4 define(CUSTOM1NOTREQUIRED, "1"); //define(CUSTOM2NOTREQUIRED, "1"); //define(CUSTOM3NOTREQUIRED, "1");
To make it not required, change to this:
//v1.2.4 define(CUSTOM1NOTREQUIRED, "0"); //define(CUSTOM2NOTREQUIRED, "1"); //define(CUSTOM3NOTREQUIRED, "1");
Creating Custom Variables
About
AWBS themes are customizable on many fronts. One extremely powerful customization method you can utilize is adding your custom data by placing variables and/or php scriptlets in your template files. Sometimes you may need to place the same script or value over and over again in many pages. You can do this using custom variables.
Custom variables are stored in a file called gparser_user.php, this file can be found in the includes folder in your AWBS root directory. If you installed AWBS to home/user/public_html/ on your server, gparser_user.php will be found in home/user/public_html/includes/gparser_user.php.sample - remove the sample from the file name to so it starts taking effect.
Once you renamed the file, you can start placing your variables and php scriptlets there.
Format
<?php //Use the following format for additions: //$template->set_var("template_variable", "your text"); ?>
Variable Examples
$template->set_var("my_company_name", "Advanced Webhost Billing System");
This example will set a variable $my_company_name. To display it,<?php echo $my_company_name; ?>
or<?=$my_company_name?>
Notes
- PHP Scripts, functions, classes, and globals are allowed.
- When using a custom function that returns results, make sure to parse the result in a variable
$template ->set_var("custom_variable", $your_result);
- To run MySQL Queries, you need to include dbconfig.php:
include(WORKDIR."/includes/dbconfig.php");
Dispaying news on any page
By default, the news will only display on the index page of the site.
Here is a workaround; Add these lines in your includes/gparser_user.php file (you may need to rename that file if you have never used it).
$news = build_news("1","5"); $template->set_var("news", $news);
Then use the code in the configuration, news section on any template in order to display the news.
Overridiing system generated hosting usernames and/or passwords
If you make this file it will be included:
/includes/mycartpwd.php
The variables you will need are:
$this_username $this_password
These 2 variables hold the current system generated username and password that will be written to the DB and used.
Other avaliable variables are:
$row[cartsld] is the domain sld $row[carttld] is the domain tld
You can manipulate them as you wish here (using php code), but be sure you write your changes back the same variable names.
Also, be sure to respect hosting control panel rules (ex: if the username is too long or short the account creation will fail etc..).
Also, you should incorporate our username dupecheck into your routines.
$xcheck=check_username($this_username,$row[cartId]);
You would check that $xcheck is not greater than 0 and if so, re-generate the username.