* Graham If you don't want users to be able to post images in blog comments here is a xtscript to remove them
First a couple of notes
the #<!-- at the start and #--> at the end of the script are so the web template highlighted code editor does not parse xtscript as html and show errors caused by the xtscript syntax they do nothing else

The lines #</xt:code> above and #<xt:code> below var $blog=<xt:blog /> are so that you can still edit your blog function and create posts from the building tool and the posts will be assigned to the page correctly
Do not edit the lines var $blog= above or # below the blog with the building tool or the script will stop working


var $blog=<xt:blog />

# Main script
var $src_end=0
var $comment_start=call strpos $haystack=$blog;$needle=xt_blog_comment_content;$offset=($comment_end+3)
if not $comment_start
goto @end
var $comment_end=call strpos $haystack=$blog;$needle=</p>;$offset=($comment_start+14)
var $comment=call substr $val=$blog;$start=($comment_start+28);$length=($comment_end-$comment_start-28)
var $img_start=call strpos $haystack=$comment;$needle=img src;$offset=$src_end
if not $img_start
goto @loop
var $src_start=call strpos $haystack=$comment;$needle=";$offset=($img_start+8)
var $src_end=call strpos $haystack=$comment;$needle=";$offset=($src_start+10)
var $src=call substr $val=$comment;$start=($src_start+1);$length=($src_end-$src_start-1)
var $blog=call str_replace $subject=$blog;$search=$src;$replace=http://tutorial.graham.yn.lt/ff16x16/16/no_image.png
goto @img
print $blog

Copy code

This javascript will have the same effect but on the browser instead of the xtgem server
It must go below the blog
<script type="text/javascript">
   var a=document.getElementById('xt_blog_comments');
   if (a){
     var b=a.getElementsByTagName('p');
       var d=b[c].getElementsByTagName('img');

Copy code

it should replace images in blog comments with img
2014-03-09 10:50 (edited 2014-03-09 19:24 by Graham ) · (3)

Online: Guests: 1