2Hi.Biz
Trang chủ | TWIG | Xtscript | Templates | Xtgem
xtscript Việt hóa 2015
AiChat.Wap.Sh
xtfunctions in xtscript
Chức năng xt
[...] = optional ... = your value
[var $... = ]
[print[_raw]][...][...]
Code ví dụ:
<!--parser:xtscript-->
# xtfunctions can be printed out
print you are using a <xt:get_device_template /> device<br />

# Most xtfunctions can be read into variables
var $country=<xt:country type="1" />
print $country<hr />

# forums cannot be read into xtscript variables
var $forum=<xt:forum />
print $forum no forum here <hr/>

#xtfunctions can be constructed with variables
var $function=browser detail="4"
var $browser=<xt:$function />
print $browser<hr />

# The content of a file can be included in to a variable
var $included = <xt:include file="/manual/basics/examples/included"/>
print $included<hr />

# widgets are parsed separately to Xtscript so they cannot be read into variables
var $widget=<xt:widget id="flickr_random_photo"/>
print $widget no widget here <hr/>

#but they can be constructed for output
var $w = flickr_random_photo
print <xt:widget id="$w"/><hr />

# dump of variables on this page
print Variables on this page <br />
var $dump=call dump_vars
var $dump=call trim $val=$dump ; $charlist={{<pre>
Array/ }}
var $dump=call trim $val=$dump ; $charlist=( )
var $dump=call htmlspecialchars $val=$dump
#var $dump=call nl2br $val=$dump
print <pre>$dump</pre>

<!--/parser:xtscript-->
Code đã chạy;
you are using a mobile device
United States
no forum here
Unknown

no widget here

Variables on this page
    [func] => xtfunctions_in_xtscript
    [url] => 
    [___t] => 
    [__xtblog_rss] => 
    [$url] => /xtscript/index
    [$tim] => 
    [$tim2] => 
    [$v] => 1711639154
    [$func] => xtfunctions_in_xtscript
    [$country] => <img src="http://xtgem.com/images/country_flags/united states.gif" title="United States" alt="United States" />
    [$forum] => 
    [$function] => browser detail="4"
    [$browser] => <img src="http://xtgem.com/images/browsers/unknown.png" title="Unknown" alt="Unknown" />
    [$included] => 
    [$widget] => <xt:widget id="flickr_random_photo"/>
    [$w] => flickr_random_photo