17-12-2016
Khi post bài ta hay dùng
và ta muốn phần code được chia sẻ nằm trong khung tags areatext để khách dùng mobile dễ ràng copy.
và để chuyển chúng vào khung ta làm như sau.
chèn code sau bên dưới function
function bbcode $text=...
@code
var $ec=call strrpos $haystack=$text;$needle=[/-code]; $offset=0
var $sc=call strrpos $haystack=$text;$needle=[-code]; $offset=0
var $code = call substr $val=$text;$start=($sc+6);$length=($ec-$sc-6);
var $copy = call str_ireplace $subject=$code;$search=<br />;$replace=;
var $text = call str_ireplace $subject=$text;$search=[-code]$code[/-code];$replace={{<div class="phpcode"><pre>$code</pre></div><div class="phpcode"><b>Copy Code</b>
<textarea cols="70" rows="2">$copy</textarea></div>}}
if $sc
goto @code
endif
Copy code