XtScript – The Xtgem’s Own Server Side Scripting

Well hello dear Wapmaster, especially to Xtgem Wapmaster. As everyone know, or you don’t know? that Xtgem as one of leading free wapsite builder has provide the users with its own server side scripting language called “XtScript”.

XtScript syntax:

# You XtScript codes goes here

xtscript by weblogwap

Server Side Script is a script that work and parsed by the server before visitor opening your website.

It’s a good thing to not always rely to Javascript if the thing you need can be done by Server Side Scripting. Why? Because while in Javascript it is the visitor browser that works, in Serve Side Script it is the server that works and all visitor browser do just need to do just only downloading the page.

Xtgem’s XtScript is more less like PHP. Or it also like combining Javascript and PHP altogether in its syntax. To learn and understand XtScript effectively, I suggest you to know at least the basic understanding of this following coding language before you hit the XtScript:

  • HTML
  • CSS
  • Javascript
  • PHP (optional)

Xtgem’s XtScript – Basic of The Basic

Learn from the basic. One thing I was confused when I knew and trying to grasp XtScript was how the syntax is just too “loosy” or “freely”. There are no symbols like , ., or + to separate string, variable, and function.

XtScript Basic: Comments

All right first thing I want to start with comments so you XtScript newbies didn’t confused when I write this along my examples. What is comment is scripting? Comments is a way we can write any text, any characters and any symbols on our code BUT it WILL NOT break your code.

Leaving comments in your code is a good habit for your own (Example you have some short of acute short amnesia) or to make people who read you code understand what exactly you are doing in your code. Comments in XtScript are declared using:

  • # for single line comment.
  • /* */ for multi lines comment.

# This is a single line comment
/* SO, you want a multiple lines comments?
Then you get it
Right away friend */

print The comments will not be printed neither make your script error

The comments will not be printed neither make your script error

XtScript Basic: Print

print is the command to output string, variable, and number. In short word, print is XtScript’s “document.write()” in Javascript or “echo in PHP.

# Print a single line
print Hello friends! <br/>
print Welcome to <a href="/">Weblogwap</a> <br/>

# Print in multiple lines by putting them inside curly brackets &club;&lcub;&rcub;&rcub;
print {{ <u>I hope that you all</u>
<b>enjoy my blog and</b>
<i>my tutorials become useful</i> }}

Hello friends!
Welcome to Weblogwap
I hope that you all enjoy my blog and my tutorials become useful

XtScript Basic: Variable

For me, variable syntax in XtScript is like combining variable in Javascript and PHP. A variable in XtScript need to be declared first using var and variable name are written with $ prefix.

# Assigning string into a variable
var $name = Daryadi

# Assigning number into a variable
var $age = 24

# There are no separator between a string and a variable, except the "$" sign
print Hello friends! My name is $name and I am $age years old. <br/><br/>

# Use backlash "\" to escape a variable so we can print "$" sign
print $name is the value of \$name variable

Hello friends! My name is Daryadi and I am 24 years old.

Daryadi is the value of $name variable

XtScript Basic: Arithmetic Operation

Arithmetic operation in XtScript is no different from Javascript and PHP, except that we must put the operation inside brackets ()

var $a = 50
var $b = 4

# We assign an arithmetic operation into a variable
var $c = ($a + $b)

print \$a = $a <br/>
print \$b = $b <br/>
print \$c = $c <br/><br/>

# Or we can do arithmetic operation directly in "print" command
print \$a + \$c = ($a + $c) <br/>
print \$a - \$b = ($a - $b) <br/>
print \$a x \$b = ($a * $b) <br/>
print \$a : \$b = ($a / $b) <br/>
print \$a % \$b = ($a % $b)

$a = 50
$b = 4
$c = 54

$a + $c = 104
$a – $b = 46
$a x $b = 200
$a : $b = 12.5
$a % $b = 2

XtScript Basic: If

Now just like I said earlier, it is recommended for you at least know the basic of Javascript. If you had know the basic of if in Javascript and PHP, I’m sure you also will not find trouble in grasp the if in XtScript although the syntax is a little bit different

The condtional operation in XtScript is started with if and closed with endif.

var $number = 100
var $statement = The number is

# Simple if .. else
if $number > 50
print \$number is more than 50
print \$number is less than or equals to 50

print <br/><br/>

# if .. elseif .. else in XtScript
if $number == 50
print $statement FIFTY
elseif $number == 75
print $statement SEVENTY FIVE
elseif $number == 100
print $statement ONE HUNDRED
print There are no numbers

$number is more than 50

The number is ONE HUNDRED

By SiDar

Webmaster Assistant and Editor at

SiDar enjoying himself listening J-pop genre music and playing games, especially old school games. Sometimes he also found watching anime and reading manga are interesting when his fellow author recommend him some good titles.

Leave a Reply

Your email address will not be published. Required fields are marked *