Monday, April 19, 2010

code of htemplate

If we want to show a code block on htemplate, we will use eval keyword for this purpose. Eval will show the code block without printing anything directly.
{eval}name = "Name: " + name.toUpperCase();{end}
Alternatively, we can write it like the following way:
{? Name = "Name: " + name.toUpperCase();}
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

haXe's htemplate system

htemplate is a powerful system for haXe template system. It is simple and easy to use. it is still growing very rapidly and day by day it is evolving with new techniques. htemplate is cross-platform. It uses hscript to perform template logic. It has a well documented, rich and growing API.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

attr of haXe templo

This is a pseudo attribute. We can use it like the following:
We will get the following result with it:
We can write it in this way also:
The attr is mainly helpful with select tag. We can generate multiple option values here. Following will the add the checked attribute when the condition is true.


Now the following will generate option values:

See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

use in haXe templo

At times we need to split our template into several different files. This will enhance reusability. The :: use :: will call en external template from our current template. The called template will share it’s context with the current template.
The ::use X:: ::fill content:: ::end:: ::end:: syntax is repetitive and this syntax is useful in website template system.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Foreach structure in Templo of haXe

Templo uses foreach to iterate over an iterable. The syntax for foreach is the following:
::foreach value iterable::
And the quantity is ::value::.
::end::
For example, here variable i iterates over iterable members.
::foreach i members::
User name is ::i::
::end::
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

haXe templo commands

Templo supports several commands to explore. These commands ease our work load. We can run the following commands:
Usage : temploc [options]
-cp : this will add file search path
-output : it will specify output directory
-macros : we can add macro definition file using this
-php : this will use php output
-debug : and this will use debug mode
-xml : don't use XHTML checks
-compare : we can compare two files or directories structurally
-compare-xml : we compare also XML files
--compare-both : this will display both files position in comparisons

See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

installation of templo of haXe

Templo is available in the Motion-Twin public haXe libraries. It is also available using cvs. Check this out:
cvs -d :pserver:anonymous@cvs.motion-twin.com:/cvsroot co haxe_mtwin
Now we need to follow the following steps:
• If we see the lib/mtwin/templo directory in the directory path, we will find a file named temploc.hxml. We will run it to produce temploc executable.
• Then we will put it under an accessible folder where Apache is able to execute it.
• And we will have mtwin package installed in our haxe library path.
We can also download and install in just two steps. To install haXe we need execute following commands:
• haxelib install templo : this will download and install templo to current directory.
• haxelib run templo : with this command we can run templo and create an executable temploc2. This will also be placed in the current directory.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

template class in haXe

haXe template class is growing fast to adorn itself with more possible options. This class has some useful methods. Many advanced template system uses this methods. Templo and htemplate uses these basic methods. Let’s discuss them one by one.
• function new( str : String ) : Void – this is the constructor of template class.
• function execute( context : Dynamic, ?macros : Dynamic ) : String – it executes the template variables with the template and returns a string. This will output the XHTML value. In the context we pass the value of the template variables and in the macros we can set an optional macro function.
• static var globals : Dynamic – global variable.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Template system in haXe

haXe comes up with a simple, easy to use, proficient, efficient template system. This template system has very simple syntax to implement. HaXe has strong template library for this purpose. HaXe.template class brings all these features to us. We can create very sophisticated templates with it. This class is lightweight and well interpreted.
As we have already learnt that a template is a string or a file that we use to produce some XHTML or XML output depending on our input. Let’s see an example:
Welcome to ::name:: template system and it is ::quality::.

Here we have two template variables - ::name:: and ::quality::. We will assign different values to them.
Now we will save the above simple code into a file named: my_sample.mtt. We will use this file in our haXe code.
class Templ {
static function main() {
var str = haxe.Resource.getString("my_sample");
var t = new haxe.Template(str);
var output = t.execute({ name : "HaXe", quality : “simple and easy”});
trace(output);
}
}
We pass value to our template variable like { name : "HaXe", quality : “simple and easy”}. Now we will compile our code. First we will create an hxml file like the following:
#-swf appTemp.swf
#-neko appTemp.n
#-js appTemp.js
-resource my_sample.mtt@my_first
-main Templ
Here we have included proper command for all the platforms. Just uncomment the specific portion that is useful for a targeted platform.
This will produce an output which will have the template variables replaced by the values that we have passed to it. They will be replaced at runtime. It will show the following output:
Welcome to HaXe template system and it is simple and easy.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Inline methods in haXe

We have seen inline variables; now we will see inline methods in haXe. When we use inline methods, the compiler will insert the complete body of the function in every place of the code where the function is called.
But this inline method feature of haXe has some drawbacks. Let’s know about them:
• We cannot redefine inline methods at runtime.
• Also we cannot override subclass in inline method.
• We cannot create inline function with a ‘super’ access or with an internal function.
• Function arguments evaluation order is undefined and every function may not be evaluated.
• If we return value with inline function, it will only return the final value.

inline function prime(flag) { return flag?0:1; } // accepted
inline function even(flag) { if( flag ) return 0; else return 1; } // accepted
inline function odd(flag) { if( flag ) return 0; return 1; } // refused
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Unknown type in haXe

In HaXe, we have a new keyword called ‘unknown’. When a type is not defined, haXe treat that as ‘unknown’. The variable that has unknown type, changes to the variable type that was used for the first time.

function notknown() {
var x;
type(x); // print Unknown<0>
x = 0;
type(x); // print Int
}
Here the function first prints ‘Unknown’ and later it prints ‘Int’.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

anonymous type in haXe

We use anonymous type for anonymously defined object. We will use this type for class declaration also. Static fields can be of type anonymous. It can also be an enum identifier having all the constructors.

Anonymous types are structural. So, we can have more fields in the value than in the type. We can declare it as follows:
var a : { count : Int, prime : Int } = { count : 36, prime : 31, q : -4.6 };
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Return type in haXe

We use return keyword to exit from a function. We also return a value from a function with this keyword. The return statement takes the general form:
Return value;
Where value is the value to be returned. Let’s see an example of return keyword.
function func( i : Int ) : Bool {
if( i % 2 != 0 ){
return true;
}
return false;
}
To return a value the above function has the return type Boolean. We write the return type after the function declaration and the type precedes a colon(:). We can use the return statement without assigning a value to it. It causes the function to return immediately, before the function’s closing curly brace is reached. Let’s see another example of it.
function nothing(x:Int) : Void {
if( x==10 ){
return;
}
// ....
}
Here the function has void return type. It checks x’s value against 10 and if it is true then it executes the return statement without any value.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Shift operator in haXe

Left bit-shift and right bit-shift operator are the two shift operators supported by HaXe.
• expression1 << number-of-bits : we will shift number-of-bits places to left and zero is brought in on the right. • expression1 >> number-of-bits : we will shift number-of-bits places to right and zero is brought in on the left.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

For conditional block in haXe

We use for loop to repeat a statement or block of statements a specified number of times. For loop is considered to be the most flexible loop. The structure of for loop is:
for(variable in initialization...limit) statement.
Here variable is the variable that loops through the specified variable, initialization is used to set an initial value to the variable and limit is the last value up to which the variable will loop.
for( i in 0...10 ) {
trace(i);
}
In this example, i iterate over 1 to 10 and it prints values from 1 to 10.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Naming convention in haXe

Every language has a naming convention. HaXe needs to support several languages, as it is a multi-platform language. So, haXe has a naming convention which enables haXe to support multi-platforms.
• Every haxe program must have a class in it.
• Every class must have a static main function.
• Class name and filename must be identical.
• Type name has to start with an uppercase letter.
• Package name is composed of several identifiers. Each of those are connected together with periods ‘.’. A package name will start with a lowercase letter.
• Class name needs to start with an uppercase letter or underscore, can contain numbers in it.
• Similarly, variable name will start with a letter or underscore, can contain numbers in it.
• Constants should always be all-uppercase, with underscores to separate words.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Function type in haXe

Functions are integral part of haXe. We can’t think of haXe without functions. It must contain at least the Main() function. A function is a code block of a program that perform a specific task and which is independent of remaining code block.
The syntax for function definitions are like the following:
Access-modifier function function-name(var-name:type):return-type{}
Here access-modifier may be public, private for the function function-name with argument var-name of type. This function will return return-type.
Like objects, HaXe functions are typed. Their type depends on two things:
• The arguments taken by the function.
• The return type of the function.
For example, we have the following function,
public function prime(even : String, odd : String) : Int
Here the function prime has arguments even and odd of type string. This returns an Int type. We can denote this as:
String->String->Int
We can even take a function as an argument to our function. And also can return a function. let’s take a look at the following function:
public function prime(even : String, odd : String->Int) : Int
We can write this like:
String->(String->Int)->Int.
Ok, now we will show a function which accepts the above arguments but returns a function with two arguments of type Int and returns a String. So, the function is like:
function m2(arg1 : String, arg2 : String->Int) : Int->Int->String;
Now let’s see how we will write that:
String->(String->Int)->(Int->Int->String)
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

sugarlist of haXe

SugarList extends a List, declares field object link references. It overrides every base List method so that they work identically. SugarList will be faster than List on SWF VM. But we can also use sugarList on other environments where List is supported.
We use Lambda methods to manipulate List. But when it is used with SugarList, it slows down the process. ListTools play an important part in manipulation in this regard. ListTool is a package of methods that we use to create list from different types of iterables. We can use an optional argument –D sugarlist which will result into sugar list types.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Iterator in haXe

Iterator, as the name suggests, is an object that iterates all the elements of a collection. In haXe, iterator follows iterator typedef:
typedef Iterator = {
function hasNext() : Bool;
function next() : T;
}
The type T denotes the iterator type.
The simplest iterator is the IntIter iterator. We can easily built it with ...(three dots). The syntax is:
for( i in 0...100 ) {
// ...
}
We don’t need to declare the type of variable i, since it is automatically declared.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Regular expressions in haXe

We generally thought regular expressions as some kind of complex topic. Let’s see them with some very simple examples. Regular expressions are a set of matching rules. The real power of regular expression comes into play when we don’t know the exact string to match.
HaXe has built-in support for regular expression. We use regular expression to match a given pattern or to extract a given pattern. In haXe, the match rule for regular expression starts with ~/ and ends with /. Let’s see the following example:
var a : EReg = ~/John/;
var msg = "welcome John";
trace(a.match(msg)); // true : 'John' was found in the string
trace(a.match("welcome !")); // false
Here a contain the matching rule. We match this rule against the msg message. When it found the matched pattern it displays true, otherwise false.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Multi-dimensional arrays in haXe

We can create arrays with two or more dimensions. Multi-dimensional arrays are arrays of array. The syntax for such arrays will be like this:
var variable-name : Array = new Array>
For extra dimension we need to declare an extra ‘’ on the left. There is no support for associative array. But we can get it using Hash. See the following example in which we implement an associative array using hash data type.

See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

arrays in haXe

Now we will see about arrays. An array is a list of elements. They are very useful in a variety of situations. Arrays form a convenient way to handle groups of related data. We can declare a one-dimensional array like this:
var variable-name:Array = new Array();
here variable-name is the name of the array variable with type of Type. For example, we can declare myarray like the following:
var myarray:Array = new Array();
An array element is accessed by indexing the array using the number of elements. To access a specified element in an array, we use the specified position number in square brackets. Like:
myarray[10] = ”even”;
This has value ‘even’ at an index of 10.
HaXe stores one-dimensional arrays in one contiguous memory location with the first element at the lowest address.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Local variable inference

Local variable inference simplifies our code. Type inference makes our code strictly typed. We don’t need to use types everywhere in the program. It is not necessary to use type for a local variable. It will infer the type at the time it is first accessed in the program.
var num;
type(num); // print Unknown<0>
num = 100;
type(num); // print Int
Here initially num has not been typed. So, it is showing type of Unknown. Then we assign a value of 100 and it then treats the variable as num.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Type inference in haXe

We will start this chapter with the excellent feature of type inference. Type inference is the way to automatically deduce the type of a variable in a program. This is a strongly static feature of haXe. What is strongly static type and dynamic type? Let’s know it first:
• We can know the type of an expression only at runtime in dynamically type language.
• If we can know the type of an expression at compile time, then it is statically typed.
HaXe uses type inference at compile time. So, if we declare a variable without a type, the type of the variable will be set when it is first used. The compiler gathers the type information as an aggregate function of expression used or by understanding implicitly the type of the values that are used.
See the book OpenCart 1.4 Template Design Cookbook. See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Sunday, April 18, 2010

Boot Loader of Haxe

We have already introduced with php boot class. HaXe and PHP are quite different in nature. Arrays in haXe start with 0 and every position between 0 and length must exist even if the value is null, but PHP is totally different from it. HaXe supports passing function by reference; we can pass function by names in PHP. The boot class unifies these differences.
Another action of boot class is autoloading feature. This feature loads the required class at runtime and it avoids static references to all the files in the lib directory. So, with this feature though we may have 100 generated files, but will use only few of them at the time of execution.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Friday, April 16, 2010

features of haXe.

We have run our first haXe program and have compiled for different targets. Cool, that’s great a feature of haXe. We have made only one haXe program which then has given us several different compiled codes targeting different platforms. That’s why HaXe is a multiplatform language.
Let’s see some other magnificent features of HaXe.
• It has complete type inference; no need to type local variables. Type inference refers to the ability to find automatically the type of a variable. So, when we set a value to a variable, the type of the variable automatically sets according to the value.
• haXe provides runtime type information. Runtime type information is a mechanism that allows the type of an object to be determined during program execution. We will implement haxe.rtti.infos to get this information.
• Conditional compilation is a process through which we can compile only selected portion of code excluding other sections. Haxe supports this feature with conditional compilation macros.
• HaXe uses Inline methods and variables. This feature increases the compiled code size and also the execution speed of the program.
• Debug compilation mode features enables the scope to debug our code in compile time. We can add additional exceptional handler in compile time for debugging purpose.
• HaXe has Optimized generics. We use generics to check the type of a collection to the compiler. When the compiler knows the element type of the collection, then the compiler checks the consistency of the collection. Then it inserts the accurate cast on values of collection.
• We can build Flash desktop application with ScreenweaverHX. Screenweaver is software for building cross platform Rich Interfaced Desktop Applications (RIDA). It separates application logic from application interface. ScreenweaverHX acts like a bridge between Neko VM and Flash.
• Strongly typed language.
• Haxe invented the useful ‘untyped’ keyword. Sometimes we want to implement a class or function or test case which is not allowed in HaXe. Then untyped keyword plays a big role.
• HaXe comes with ‘magic’ keywords.
• haXe has supports for packages.
• It uses Polymorphic methods. A polymorphic method behaves differently, depending on the object type it is called with. In this way, the nuts and bolts of the code are hidden from us. We just call the object with the operation that we need to apply to the object. We need not to know what type the object is of, or how to adapt the operation to the type.
• Unit testing support.
• Cross platform serialization to web compatible format
• High level type system: anonymous type , dynamic type,
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Installation of haXe on linux

We have seen the installation process on windows environment. Now let’s see it for Linux. As we have seen earlier, haXe has come up with automatic installer; download it and run the installer. For manual installation, we need to write some command.
The haXe compiler is written on OCaml language. First, we will install the OCaml packages and some additional packages and tools, run the following single command:
sudo apt-get install ocaml camlp4 ocaml-findlib cvs zlib1g-dev make wget tar subversion

Now create a file named linuxHaxe.sh, a shell script. This will have the following code:

#!/bin/sh
# linuxHaxe.sh

mkdir haxesrc
cd haxesrc

wget http://haxe.org/_media/install.ml
ocaml install.ml

# reset previous installations
sudo rm -rf /usr/local/haxe
sudo rm -rf /usr/local/bin/haxe*


# install haxe in /usr/local
sudo mkdir /usr/local/haxe
sudo mkdir /usr/local/haxe/bin
sudo cp bin/* /usr/local/haxe/bin
sudo cp -r haxe/std /usr/local/haxe
sudo ln -s /usr/local/haxe/bin/haxe /usr/local/bin/haxe

# setup environment variables for haxe
sudo grep "HAXE_LIBRARY_PATH" /etc/environment || echo "export HAXE_LIBRARY_PATH=/usr/local/haxe/std:." >> /etc/environment

We need to change the permission of the file with the command:
sudo chmod 0755 linuxHaxe.sh

Then run it by the command:
./linuxHaxe.sh

The installation is complete. Now we will validate installation like we did for windows earlier.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

reasons behind success of haXe

• HaXe is similar to ECMAScript. So, it is very much like to JavaScript and ActionScript.
Compare to Flex or Flash compilers, HaXe compiler is tremendously speedy. Hence, HaXe is an easy transition from non-compiled languages like PHP and JavaScript.
• Compare to Flex or Flash compilers, HaXe compiler is tremendously speedy. Hence, HaXe is an easy transition from non-compiled languages like PHP and JavaScript.
• Unusual to programming languages, HaXe comes up with both dynamic and strong type checking. Having compile-time checking, we can test our code before placing it in browser. It makes a faster workflow. But it also enables the programmer to bypass type-checking and rely on the target platform's dynamic type-handling.
• Adding lacking characteristics to targets, HaXe presents us an affluent set of quality accessible for use on all target platforms, like : inlining & generics to Flash development, packages & typing to JavaScript & PHP, dynamic objects & Runtime Type Information, enabling Reflection to C++, and much more.
• We can use same codebase for different platforms. So, we can compile same classes for many platforms. Different platforms adorn themselves with different syntax and style. Learning Haxe will relives this pain. Haxe uses single syntax and styles for its development.
• We can embed Flash in a Neko application using ScreenweaverHx. With this, we can use Flash application as a Desktop application.
• We can read/write several types of files such as ‘abc’ (ActionScript Byte Code), SWF headers, ‘PHP’ & more.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Flash targets of haXe

Flash provides an effective and easy way to develop interactive graphical applications such as games and interactive websites. Flash technology has three languages and two virtual machines: ActionScript1 and ActionScript2 run on AVM and ActionScript3 language runs on the latest AVM2. These two VM is considered as Flash and Flash9: two different platforms.
HaXe supports both of the above platforms. With features like generics and type-inference, Haxe is well thought-out as an enhanced programming language than the most recent AS3. The complier also runs faster and produces quicker code than that of AS3.
Many tools are there to leverage our existing investment with flash and use third-party Flash and AS3 libraries:
• A .swf file of Flash IDE can be used by HaXe compiler easily to get the graphic assets.
• We can use Haxe libraries from AS3 by using the SWC output of HaXe program.
• The AS3 generator of haXe can convert a haXe program to a corresponding AS3 code.
HaXe has the following features which overcomes that of flash:
• We can compile our program with HaXe to any version of Flash. Thus, haXe eases our way for backward compatibility.
• HaXe codes are generic and inline. So, its compiler runs faster than the Flex SDK.
• Haxe is fully compatible with Flex and Flash. So, we can run haXe codes in Flash or Flex easily.
• With the help of haXe we can use Haxe libraries with AS3 using SWC.
• We can access low level memory with it and hence increases speed greatly.
• Lightweight streaming videos can be obtained from haXe over RTMP protocol.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Thursday, April 15, 2010

Haxe supports of javascript target

JavaScript is a client side scripting language that runs on almost every browser. Using JavaScript, we can also dynamically reload some part of the webpage by Ajax style programming.
HaXe compiler can convert a HaXe program into .js file which can run on all browsers. It also overcomes two major drawbacks of JavaScript:
• Using static type system of HaXe, we can build and maintain larger JavaScript applications, and identify most errors at compile-time instead of runtime. It also enables our IDE to provide code completion while editing haXe/JavaScript programs.
• We use JavaScript library or a group of .js files, although most of the times we need a few part of code to meet our need. Haxe compiles only the minimal set of classes that we need, making as simple as it could be.
And it also boosted with the following features:
• Though JavaScript2 is not available yet, but Haxe comes up with lots of features of JavaScript2.
• We will see the great autocompletion of DOM using HaXe.
• We can run Haxe’s js files with other JavaScript library using extern classes.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Benefits of exception handling

Using exception handling adds some extra code to our program. Then why we will use it? It has some advantage over traditional error handling system.
We can separate error handling code from regular code using exception handling
Exception handling moves the errors up the call stack.
We can group and differentiate error types with it.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

calling Lambda methods in haXe

The calling procedure of lambda method is same for all the methods. The first parameter is an iterable. Lambda function will operate on it. We can take functions as a parameter. For instance, we can call the exists function like:
static function exists( t : Iterable , func : A -> Bool ) : Bool
Here the first parameter is iterable and the second one is a function. Lambda will iterate over iterable t. During traversing, function func will be called on every iterator. This function will take a single argument of the same type as the iterator. This function can be anonymous type.

See the book
OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Abstract class with haXe

There is no abstract class in haXe. An abstract method is a method that is declared without an implementation. We can define a private constructor. This way, such a class can't be constructed. Only subclasses might define a public constructor.

We cannot define any abstract method in haXe either. But there is a way to gain the power of abstract feature in haXe. When an abstract class is subclassed, the subclass usually provides implementations for all of the abstract methods in its parent class. So, we need to define an empty body (or maybe throw an exception) in the main class. Then these functions will be overridden in subclasses.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Auto load in haXe

HaXe uses autoloading feature of php. It dynamically autoloads the class definitions when it is needed. It has a drawback also. It checks the lib folder for type definition checking. To reduce the impact of this operation we can create a cache folder at the same level of lib and also give write permission to it to store the files. Then when we run our next haXe program, it will automatically generate a file named ‘haxe_autoload.php’. This file will contain all the necessary information for autoloading a class.
We can see the result while autoloading a large number file. We should use this feature only on production server, because in the development server we may create several classes for testing.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

override with haXe

We can override a method of super class with a method of subclass. We must precede the method with override keyword. In haXe 2.x, it is mandatory to use override keyword while overriding a method in super class with that of subclass. The override keyword brings the following features:
We know that super class method actually exists.
This prevents overriding a super class method accidentally.
Using the override keyword, we inherit the types of attributes of super class method. So, we need not to redeclare it.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

how import works in haXe

We can gain access to all the attributes of a file without needing to specify the package name using imports.
package my.pack2;
class C2 extends my.pack.C {
}
Is identical to the following :
package my.pack2;
import my.pack.C;

class C2 extends C {
}
When use imports we can have access to Enum types. This is the main difference between the above two.
We can have access to a single type with import keyword. Suppose we have a class like:
package my.pack2;
typedef A = { a : String }
typedef B = { b : String }
import my.pack2.A; we can do to load multiple types in haXe.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Interfaces in haXe

An interface is a group of related methods with empty bodies. Yes, interfaces are abstract type. We declare interface with interface keyword. The syntax for interface is like the following:
Interface interface-name
{
function func-name([arg-name:type])[:return-type];
}
Here we create an interface interface-name with method func-name. It has an optional return-type and a parameter name.
We can’t instantiate an interface. All methods are by default declared as public.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Super keyword in haXe

Using the super keyword, we can use the methods of parent class in a derived class while that method is being overridden in derived class. See the following example:
class child extends parent {
function care() : Int {
return super.care() + 1;
}
}
Here we override care() method of parent, but still we use the parent class method in it using super keyword. We can also call the constructor of parent class in our class using super:
class child extends parent {
function new(){
super();
}
}
Note that we do not use the constructor function name of parent class here, only used super(). It brings the properties of parent class to the derived class.
See the book OpenCart 1.4 Template Design Cookbook.
See the book Joomla Mobile Development Beginners Guide




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Class inheritance in haXe

Yes, we can inherit properties of one class to another in haXe. Inheritance helps us to reuse existing code with little or no modification. In haXe we can extend one class and implements many interfaces. So, we can inherit several types at same time. The new class is said as derived class and the inherited class is called as super class. Inheritance is different from subtype-polymorphism. To declare a subtype we need to define a new class.
This syntax can be shown like this:
Class super-class extends subclass1, implements subclass2, implements subclass3
{
}
Here super-class inherits properties from subclasses.
When we wish to add a single function or more to an existing class without changing the class itself, we can simple extend the class and then create our function in our new class. Let’s see an example of it.
Class brain{}
Interface eye{}
Interface hand{}
Class human extends brain, implements eye, implements hand
{
}
Here class human has its own types and also uses types of brain, eye, and hand as required. The difference with other languages is that it uses the ‘implements’ keyword for every implementations. Other languages implements interfaces like ‘implements eye, head, brain’, uses the ‘implements’ keyword only single time.




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

Public access in haXe

We use public keyword with fields, methods and constructors to impose least restriction. Public class is visible to any class in the Java program, whether these classes are in the same package or in another package. If a field or method does not have any access modifier set to it, then it is assumed that the field or method is set with public access. But it is recommended to use ‘public’ keyword when it is to be used.
The syntax for using private field is as follows:
[public] var variable-name [: type[ = value]];
We make variable-name as public by placing the public keyword in front of it. This is optional. We can set type and initialize it at the same time.
In haXe, we can write it like:
public var pound:Int;
Here integer type pound is declared as public.




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide

The constructor class of haXe

The constructor is called when the class is instantiated. In HaXe, we use new keyword to create a constructor for our class. This class does not have a return type and this function is never inherited. We can overload our constructor so that we can create more than one constructor for a class, each will have different parameters.

Now we will go through an instance of constructor.
class Student {
public var Roll : Int;
public var Marks : Int;

public function new() {
this.Roll = 0;
this.Marks = 0;
}
}
Here constructor initializes the two attributes of the class. We first declare the attributes Roll and Mark. In the constructor we assign values to them.




List of my works:

Opencart Extensions:

  1. Product Based Quantity Wise Shipping: Find it here.
  2. OpenSSLCOMMERZ: integrate SSLCOMMERZ with opencart: Find it here.
  3. Fine Search v.1.0 - Improves Opencart search feature to find relevant: Find it here.
  4. Opensweetcaptcha - An easy way to generate attractive captcha for your system!: Find it here.
  5. Custom Field Product - add unlimited custom fields to the product form: Find it here.
  6. Formcaptcha - add captcha on the register page: Find it here.

My Books:

  1. OpenCart 1.4 Template Design Cookbook.
  2. Joomla Mobile Development Beginners Guide