Файл: PHP_CountryHelper/documentation/index.html
Строк: 368
<?php
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<head lang="en">
<meta http-equiv="content-type" content="text/html;charset=utf-8">
<title>PHP Country List Helper Class Documentation</title>
<!-- Framework CSS -->
<link rel="stylesheet" href="assets/blueprint-css/screen.css" type="text/css" media="screen, projection">
<link rel="stylesheet" href="assets/blueprint-css/print.css" type="text/css" media="print">
<!--[if lt IE 8]><link rel="stylesheet" href="assets/blueprint-css/ie.css" type="text/css" media="screen, projection"><![endif]-->
<link rel="stylesheet" href="assets/blueprint-css/plugins/fancy-type/screen.css" type="text/css" media="screen, projection">
<style type="text/css" media="screen">
p, table, hr, .box { margin-bottom:25px; }
.box p { margin-bottom:10px; }
pre { padding: 10px 20px; background: #f5f5f5; border: 1px solid #ddd; overflow-x: auto;}
</style>
</head>
<body>
<div class="container">
<h3 class="center alt">“PHP Country List Helper Class” Documentation by “Rajesh Saravanan” v1.0</h3>
<hr>
<h1 class="center">“PHP Country List Helper Class”</h1>
<div class="borderTop">
<div class="span-6 colborder info prepend-1">
<p class="prepend-top">
<strong>
Created: 12/23/2014<br>
By: Rajesh Saravanan<br>
Email: <a href="mailto:rajeshtomjoe@gmail.com">rajeshtomjoe@gmail.com</a>
</strong>
</p>
</div><!-- end div .span-6 -->
<div class="span-12 last">
<p class="prepend-top append-0">Thank you for purchasing my theme. If you have any questions that are beyond the scope of this help file, please feel free to email via my user page contact form <a href="http://codecanyon.net/user/rajeshtomjoe">here</a>. Thanks so much!</p>
</div>
</div><!-- end div .borderTop -->
<hr>
<h2 id="toc" class="alt">Table of Contents</h2>
<ol class="alpha">
<li><a href="#a">Installation</a></li>
<li><a href="#b">Usage</a></li>
<li><a href="#c">Methods with Example</a></li>
</ol>
<hr>
<h3 id="a"><strong>A) Installation</strong> - <a href="#toc">top</a></h3>
<p><strong>Upload files</strong></p>
<p>Upload the files in /script/ to your desired directory in your application. Navigate to the file you would like to use the helper and Include the helper file into your selected file like below</p>
<pre>
<?php
require "CountryHelper.php";
?></pre>
<hr>
<h3 id="b"><strong>B) Usage</strong> - <a href="#toc">top</a></h3>
<p>
Once the file is included in your script initialize the class like shown below.
</p>
<pre>
<?php
require "CountryHelper.php";
// initialize the helper
$countryHelper = new CountryHelper();
?></pre>
<p>
If the class is initialized and assigned to a variable then you can access the two dimensional countries array with following keys
<ul>
<li>country_name</li>
<li>country_code_alpha2</li>
<li>country_code_alpha3</li>
<li>country_curreny_name</li>
<li>country_curreny_code</li>
<li>country_calling_code</li>
</ul>
</p>
<pre>
<?php
require "CountryHelper.php";
// initialize the helper
$countryHelper = new CountryHelper();
// get the country list array
$countriesArr = $countryHelper->countries;
?></pre>
<hr>
<h3 id="c"><strong>C) Methods with Example</strong> - <a href="#toc">top</a></h3>
<p><strong>Get Country Name for given Country Code</strong></p>
<p>
Use the below function to return the Country Name for the given Country Code <br>
type - alpha2 (default) to get Country Name by ISO 3166-1 alpha-2 code (example IN - India)<br>
type - alpha3 to get Country Name by ISO 3166-1 alpha-3 code (example IND - India)
</p>
<pre>
<?php
require "CountryHelper.php";
// initialize the helper
$countryHelper = new CountryHelper();
// get the country name
$countryName = $countryHelper->getCountryNameByCode('IN'); // returns "India"
?></pre>
<p><strong>Get Country Calling Code for the given Country Code </strong></p>
<p>
Use the below function to return the Country Calling Code for the given Country Code <br>
type - alpha2 (default) to get Country Calling Code by ISO 3166-1 alpha-2 code (example IN - India)<br>
type - alpha3 to get Country Calling Code by ISO 3166-1 alpha-3 code (example IND - India)
</p>
<pre>
<?php
require "CountryHelper.php";
// initialize the helper
$countryHelper = new CountryHelper();
// get the country calling code
$countryCallingCode = $countryHelper->getCountryCallingCodeByCode('IN'); // returns "91"
?></pre>
<p><strong>Get Country Currency Code for the given Country Code </strong></p>
<p>
Use the below function to return the Country Currency Code for the given Country Code <br>
type - alpha2 (default) to get Country Currency Code by ISO 3166-1 alpha-2 code (example IN - India)<br>
type - alpha3 to get Country Currency Code by ISO 3166-1 alpha-3 code (example IND - India)
</p>
<pre>
<?php
require "CountryHelper.php";
// initialize the helper
$countryHelper = new CountryHelper();
// get the country currency code
$currencyCode = $countryHelper->getCountryCurrencyCodeByCode('IN'); // returns "INR"
?></pre>
<p><strong>Get Country Name for the given Country Calling Code </strong></p>
<p>
Use the below function to return the Country Name for the given Country Calling Code <br>
</p>
<pre>
<?php
require "CountryHelper.php";
// initialize the helper
$countryHelper = new CountryHelper();
// get the country currency code
$countryName = $countryHelper->getCountryNameByCallingCode('91'); // returns "India"
?></pre>
<p><strong>Get Value for the given Key </strong></p>
<p>
Use the below function to return the Value for the given Key <br>
param1 - value of the key to be searched <br>
param2 - value of the key to be returned <br>
param3 - value to be searched <br>
</p>
<pre>
<?php
require "CountryHelper.php";
// initialize the helper
$countryHelper = new CountryHelper();
// get the country currency name by country code
$currenyName = $countryHelper->getValueByKeys('country_code_alpha2','country_curreny_code','IN'); // returns "Indian rupee"
?></pre>
<p><strong>Get Array of Values for the given Key </strong></p>
<p>
Use the below function to return the Array of values for the given Key <br>
param1 - key to be selected <br>
</p>
<pre>
<?php
require "CountryHelper.php";
// initialize the helper
$countryHelper = new CountryHelper();
$countryCodeArr = $countryHelper->getArrayFromKey('country_code_alpha2');
/* returns
array (
"AF",
"AL",
....
);
*/
?></pre>
<p><strong>Get Array of Values with one value as key and another as value </strong></p>
<p>
Use the below function to Return the Key Value Array with an option to format the value in the array <br>
param1 - key value to be selected as the key in the returned array <br>
param2 - key value to be selected as the value in the returned array <br>
param3 - key value to be selected as the appended string to the value in the returned array <br>
param4 - format of the value in the array (default "%s")<br><br>
fromat - please refer to the specifier <a href="http://php.net/manual/en/function.sprintf.php">sprintf</a><br>
Example formats - "%s (+%d)", "%s - %s", "[%s] %s"
</p>
<pre>
<?php
require "CountryHelper.php";
// initialize the helper
$countryHelper = new CountryHelper();
$countryCodeArr = $countryHelper->getArrayFromKeys('country_code_alpha2','country_name','country_code_alpha2',"%s (%s)");
/* returns
array (
"AF"=>"Afghanistan (AF)",
"AL"=>"Albania (AL)",
....
);
*/
?></pre>
<p>The above function can be used for generating select dropdowns</p>
<hr>
<p>Once again, thank you so much for purchasing this theme. As I said at the beginning, I'd be glad to help you if you have any questions relating to this theme. No guarantees, but I'll do my best to assist. If you have a more general question relating to the themes on ThemeForest, you might consider visiting the forums and asking your question in the "Item Discussion" section.</p>
<p class="append-bottom alt large"><strong>Rajesh Saravanan</strong></p>
<p><a href="#toc">Go To Table of Contents</a></p>
<hr class="space">
</div><!-- end div .container -->
</body>
</html>
?>