* Graham * Waplocus And just how am I supposed to know either
2016-12-26 03:04 · (0)
* Waplocus * Graham Please graham, i have a file name "fb_glue" how can i remove the underscore using the below code?...
<!--parser:xtscript-->
var $path=<xt:url type="path">
var $pos = call strrpos $haystack=$path; $needle=/
var $name = call substr $val=$path; $start=($pos+1)
print $name
<!--/parser:xtscript-->

Copy code
2017-01-30 03:27 · (0)
* Graham * Waplocus You need to create a variable to hold the space used to replace the _
<!--parser:xtscript-->
var $spc=call chr $val=32
var $path=<xt:url type="path">
var $pos = call strrpos $haystack=$path; $needle=/
var $name = call substr $val=$path; $start=($pos+1)
var $name = call str_replace $subject=$name; $search=_ ; $replace=$spc 
print $name
<!--/parser:xtscript-->

Copy code
2017-01-30 06:07 · (0)
* Waplocus * Graham Please i have a css file.
e.g http://site.cf/aaa.css,
how can i print the size on a page?...
2017-02-02 21:22 (edited 2017-02-02 21:24 by Waplocus ) · (0)
* Graham * Waplocus use a filelist with the name of the file as the filter so it only shows 1 file
<xt:filelist folder="/folder" filter="aaa.css" template="&lt;a href=&quot;.file_url.&quot;&gt;.file_name_base_parsed.&lt;/a&gt; (.file_size.)&lt;br /&gt;"
Copy code
2017-02-03 00:04 (edited 2017-02-03 00:04 by Graham ) · (0)
* hacklord * Waplocus use this
2017-02-04 13:24 · (0)
* hacklord * Waplocus <!--parser:xtscript-->
var $sharer=<xt:url noquery="1" />
var $file_type=http://xtgem.com/images/icons/mimes
get_or_default __filelist_page;1
get detail
if $detail
goto @landing_page
endif

var $template=<table border="0" width="100%" cellspacing="1"><tbody><tr valign="top"><td width="16px" class="icon"><img src="http://xtgem.com/images/icons/mimes/.file_type..png" alt="*" /></td><td width="auto" class="title"><b><a href="?detail=.file_name.&amp;__filelist_page=1">.file_name_parsed.</a></b></td></tr><tr valign="top"><td colspan="2" class="list1">Size file: .file_size.<br>Date file: .file_date.</td></tr></tbody></table>
var $template=call htmlspecialchars $val=$template
var $list =<xt:filelist sort_type="name" sort_dir="asc" folder="/folder" template="$template" per_page="5" filter="*.*"/>
print $list
print <div class="jump"><form action="" method="get"><input type="text" name="__filelist_page" format="*N" value="" size="3" /><input type="submit" value="Jump Page" class="button" /></form></div>
goto @end
@landing_page
# landing page
# Template must be all on one line
var $query_url = call urlencode $val=$detail
var $template_detail=<div class="title"><img src="$file_type/.file_type..png" alt="*" /> <b>.file_name_parsed.</b></div><div class="list1"><div class="subtitle"><img src="http://kubang.mobie.in/images/download_package.png" class="list1" alt="*" /></div>Type File: .file_mime.<br />Date Update: .file_datetime.</div><div class="list2"><img src="http://kubang.mobie.in/images/icons/download.png" alt="*" /> <b><a href=".file_url.?__xt_download=1">Download File</a></b> (.file_size.)</div><div class="title"><b>Share Link</b></div><div class="list1">Social share: <a href="http://facebook.com/sharer.php?u=$sharer?detail=$query_url"><img src="http://kubang.mobie.in/images/icons/facebook.png" alt="*" /></a> <a href="http://twitter.com/share?url=$sharer?detail=$query_url"><img src="http://kubang.mobie.in/images/icons/twitter.png" alt="*" /></a> <a href="http://plus.google.com/share?url=$sharer?detail=$query_url"><img src="http://kubang.mobie.in/images/icons/google_plus.png" alt="*" /></a></div><div class="list1">File Address:<br><input type="text" value="$sharer?detail=$query_url" /><br>BB Code:<br><input type="text" value="[url=$sharer?detail=$query_url].file_name_parsed. (.file_size.)[/url]" /> <br>HTML Code:<br><input type="text" value="&lt;a href=&amp;quot;$sharer?detail=$query_url&amp;quot;&gt;.file_name_parsed. (.file_size.)&lt;/a&gt;" /></div>
var $template_detail=call htmlspecialchars $val=$template_detail
var $list=<xt:filelist folder="/folder" template="$template_detail" filter="$detail"/>
print $list
print <div class="list2">« <a href="?__filelist_page=$__filelist_page"/>Back to list</a></div>
endif
@end
<!--/parser:xtscript-->
2017-02-04 13:24 · (0)
* Waplocus * hacklord please sir graham help me implement this code...
<!--parser:xtscript-->
var $type = <xt:get_device_template />
if $type == mobile
print <xt:include file="/EXT/Mobile" />

elseif $type == touch
print <xt:include file="/EXT/Touch" />

elseif $type == web
print <xt:include file="/EXT/Web" />

else 
print <xt:include file="/EXT/Gen" />

endif
<!--/parser:xtscript-->

Copy code
2017-03-24 06:24 · (0)
* Graham * Waplocus There are 2 main problems here plus a load of weird little ones
first xt:get_device_template only returns web or mobile it no longer returns touch
There is a workaround hack using the blog and a custom twig file to return the value of data.device from the blog data and that does detect 'touch' devices

The other main issue is xt:includes and their 'parsing order'
in a line like
print <xt:include file="/EXT/Web" /> the issue is that the includes are parsed BEFORE the xtscript so it tries to include the contents of the file into the xtscript before the script itself is parsed and that breaks the script
it breaks because the first line of the included file replaces the xt:include in the script and the rest is included below it so it 'prints' that first line but the rest fails (unless it is xtscript codes)
you can get it to work using
print {{<xt:include file="/EXT/Web" />}} but the file being included cannot contain any other xtscripts because the include is not performed until after the xtscript has finished

you could use the xtscript include but then the file being included must be a .xt xtscript file and written in xtscript syntax

the workaround for get_device template using the blog is this
rename your current xtblog.twig to blog.twig
create a new xtblog.twig file and set this code in it
{% if 'device' in data.translations.t_no_entries_found%}
{{data.device}}
{%else%}
{%include 'blog.twig'%}
{%endif%}

Copy code

you then use <xt:blog t_no_entries_found="device" /> instead of <xt:get_device_template />
2017-03-24 08:56 (edited 2017-03-24 09:09 by Graham ) · (0)
* Waplocus * Graham Wot i'm tryin to do print a css file when the use visit with a mobile and that of javascript.
2017-03-24 12:05 · (0)

Online: Guests: 1