Waplocus
Graham Thanks sir... so now since u said i can the css, please hlp me set all the <a> to "RolCont" e.g <div class="RolWrap"> » <a href="/Education/index" id="RolCont"> Education </a> » <a href="/Education/JAMB/index" id="RolCont"> JAMB </a> </div>.... THANKS
Waplocus
Waplocus Using the below code
<!--parser:xtscript-->
/* INITIALIZE VARS */
var $linkId=1
var $spc = call chr $val=32
var $path= <xt:url type="path" />/
var $offset=0
var $len=call strlen $val=$path
/* MAIN DIV*/
print <div class="RolWrap"> » $spc
/* MAIN LOOP START*/
@loop
var $strt = call strpos $haystack=$path;$needle=/;$offset=$offset
var $end= call strpos $haystack=$path;$needle=/;$offset=($strt+1)
var $link=call substr $val=$path;$start=0;$length=$end
var $linktext=call substr $val=$path;$start=($strt+1);$length=($end-$strt-1)
/* EXIT IF INDEX FILE */
if $linktext == index
goto @end
endif
/* LINKS */
if $strt >1
print $spc » $spc
endif
print <a href="$link" id="RolCont$linkId"> $linktext </a>
/* MAIN LOOP END */
var $offset=($strt+1)
var $linkId=($linkId+1)
if $end < ($len-1)
goto @loop
endif
/* END */
@end
print </div>
<!--/parser:xtscript-->
Copy code
Graham
Waplocus done but as I just said you are not supposed to use the same id on multiple elements
Waplocus
Graham Ok, I'll prefer the first one with increment RolCont1, RolCont2, RolCont3, And create exact css ID.
Graham
Waplocus Ok I re edited the script again
Waplocus
Waplocus Sir i wan to xt:include the below code from a file can u help me plz...
<xt:include file="<!--parser:xtscript-->
var $xtps= <xt:include file="
var $xtpe=" />
var $path= <xt:url type="path" />
var $lastslash = call strrpos $haystack=$path;$needle=/
var $trimmedpath = call substr $val=$path;$start=0;$length=$lastslash
print $xtps $trimmedpath $xtpe
<!--/parser:xtscript-->/SOX/HeadTag" />
Copy code ...Thanks.
Graham
Waplocus normal Includes are performed before xtscript so this will not work
includes printed by xtscript work but they are limited on content
Waplocus
Graham Sir in this filelist below how can I replace with spaces in files that contain hyphens...
<div class="PariRRFWrap">
<div id="PariRRFH">Xtgem Random Related Files: </div>
<div id="PariRRB">
<!--parser:xtscript-->
# Path to files folder
var $path_to_folder =
# this removes files with no extension
var $filter= *.*
# 0 for all items
var $number_of_items = 10
# un-encoded filelist template
var $filelist_templateXtgem = <a href=".file_url." id="PariRRFLT">.file_name_parsed.</a><b> - </b>
# Process variables
var $filelist_templateXtgem = call htmlspecialchars $val=$filelist_templateXtgem
if not $number_of_items
var $number_of_items = list.length-1
endif
<!--/parser:xtscript-->
<script>
function shuffleArrayXtgem(array) {
for (var i = array.length - 2; i > 0; i--) {
var j = Math.floor(Math.random() * (i + 1));
var temp = array[i];
array[i] = array[j];array[j] = temp;}
return array;}
var list=[<xt:filelist folder="/Zolo/Xtgem" template=" '{_$$filelist_templateXtgem |}', " filter="{_$$filter|}"/>'dummy_entry'];
var list = shuffleArrayXtgem(list);for(var i=0;i<{_$$number_of_items |};i++){
document.write(list[i]);}
var a=document.getElementById('PariRRB').getElementsByTagName('a');
for (i=0;i<a.length;i++){a[i].innerHTML=a[i].innerHTML.replace(/\-/g, " ");}
</script>
[<a href="/Zolo/Xtgem" id="PariRRFLT">+More</a>]
</div>
</div>
Copy code
Graham
Waplocus I have added a js routine that replaces any - in the link name with a space