XtFunction is XtGem's codes. It is free, easy to use and very fantastic.
Adding an XtFunction
There are two methods of adding an XtFunction in your site. The first one, you need to add a new block and choose "XtFunction" type. You will be a given a set of XtFunctions. Note: The XtFunction given is not the full list of XtFunctions. You will know more onwards. The second way is by adding the XtFunction's code itself.
XtFunctions
• Ad: Add your ad in your site. Know more
• File list: Create a list of links to the files in the named folder. You can set the sort and direction of the list. Which folder is to be listed how many links to show on each page. This XtFunction is still under development and subject to change. Go to XtBoard thread to see what's new on that XtFunction. XtBoard thread. By using HTML code, you can also set a custom output template and filter. See all about the function settings, variable and template here.
• Local File Include: Embeds (adds) another file to the same page. HTML code:
• Counter: Add various of counter in a page of your site. You can add 4 types of counter: daily, weekly, monthly, and total. HTML code:
Change "VALUE" without quotes to one of the counter types:
1 (DAILY), 2 (WEEKLY) 3 (MONTHLY), 4 (TOTAL)
You can also set the time zone for this type 1, 2 and 3 counters will reset based on the time zone that have been set.
Change the "TIMEZONE" to the timezone level of your place (Difference of hours) in GMT.
• Online: This XtFunction shows the number of visitor(s) currently on the page.
• IP address and host: Shows the visitor's IP address and his/her HOST.
Change "VALUE" to one of these number to get a type. 1 = IP address 2 = host
• Country: Shows the visitor's country.
Change "VALUE" without quotes to 1 (for flag) or 2 (for text)
• Browser: Shows the visitor's browser.
Replace "VALUE" without quotes to one these number. 1 : low. Shows only browser name. 2 : medium. 3 : high. 4 : icon
• RSS Reader: Includes the content of the given address of the RSS to the same page. A little knowledge of HTML and XML (RSS) is required for the template.
Hidden XtFunctions
These XtFunctions are the ones which is not listed down within the building tool. All of these Hiden XtFunctions can be used in your site but the code must be pasted inside a "code" block.
• Countdown: Shows a set of time timers (or countdown or stopwatch, etc).
Change "FORMAT" to "years", "months", "days", "hours", "minutes" or "seconds". Change "TIME A" and "TIME B" to any time format as you want. "yesterday", "today", "tomorrow" or a date in format mm/dd/yy or dd month yy or a form of time hh:mm:ss. The parser also understands timezone names. Example: BST, PST, UTC, GMT etc and things like "last tuesday"!
Example:
And should become like this:
TechnoSparks is living for 9784 days now
• Random File Include: Includes only text files. The files can contain text HTML tags or scripts. Reload the page to change the included files. Code:
You can also do multiple random includes in the same folder. Take care with widgets though as some will not work in multiple random include. You will have to add an extra operator or argument pair before the file operator. This is to force the random sequence to the next value. It can be anything but X will do. Example:
You can change the x="1" to any amount.
• Random number generator: This function will produce random number from POINT A to POINT B.
Change "POINT A" to your desired start number. Change "POINT B" to your desired end number. Due to the way the function is cached, multiple calls on one page using the same input values will produce the same output (number). Example:
<xt:random from="0" to="200" /> = 143
<xt:random from="0" to="200" /> = 143
To cure the above problem, add another operator or argument pair. It's up to you but we'll use X.
<xt:random from="0" to="200" x="1" /> = 42
Change the value of X to change the output:
<xt:random from="0" to="200" x="2" /> = 164
• Referer function: This function return the visitor to the previous page. This function only functional in your site only. Code:
The attribute local="y" makes only local URL are returned. The attribute can omited if not required at all. Replace attribute default="http://SITE ADDRESS" to your site address. Non supporting browsers, page is accessed from the address bar or for off site referer will return to the address entered in the default attribute if the local="y" attribute is not omited.
• URL: This function returns the URL of a page. This function has 3 outputs.
This returns the full address of the current page. (Example: the address of this page is http://greenwap.wapgem.com/library/categories/xtgem/4.ghtml).
This returns the path address of the current page. (Example: the page of this page is /library/categories/xtgem/4.ghtml).
This returns the domain address of your site. (Example: the domain you are on is greenwap.wapgem.com)
Adding a 2 new parameters will also work as intended. Put:
Inside your URL XtFunction. This will convert ASCII characters to hexadecimal digits. Eg: An & will changes to %26.
Putting above one will strip query strings in a URL. Example: If the url of the page is http://test.net/what?query=strings the perimeter will make the address returned as http://test.net/what
Extras
These XtFunctions can be used anywhere including page titles and widget. But XtFunctions cannot be used in CSS files. To add an XtFunction in a code, you have to change the bigger code quotes. Example:
<a href="<xt:url type="path" />">
The code above will result a damaged link. To cure this, change the primary code's quotes like this one:
<a href='<xt:url type="path" />'>
Explaination: The quote " has been changed to ' to save the code from damage.
By GreenWap
Back to XtGem Tips and Tutorials
Posted 4736 days ago on
30th November 2011, 12:32pm, WED (GMT 0)
30th November 2011, 8:32pm, WED (GMT +8)
Updated 4720 days ago on
16th December 2011, 1:21pm, FRI (GMT 0)
16th December 2011, 9:21pm, FRI (GMT +8)
30th November 2011, 12:32pm, WED (GMT 0)
30th November 2011, 8:32pm, WED (GMT +8)
Updated 4720 days ago on
16th December 2011, 1:21pm, FRI (GMT 0)
16th December 2011, 9:21pm, FRI (GMT +8)