how can i preview bbcodes in ams web object ???
Professional Software Development Tools
how can i preview bbcodes in ams web object ???
you will need to translate it in to html, like the fourm software dose
heres a link to a tool that can help with the tag conversion
http://hometown.aol.co.uk/JRMC137/BBCode2HTML/index.htm
and look up string.replace in the manual, eg:
Code:strText = String.Replace(strText, "{LEFT}", "<p align=left>", false); strText = String.Replace(strText, "{/LEFT}", "</p>", false);
Open your eyes to Narcissism, Don't let her destroy your life!!
where will i use the string.raplace code ??? on button click of preview button or somewhere else ???Code:strText = String.Replace(strText, "{LEFT}", "<p align=left>", false); strText = String.Replace(strText, "{/LEFT}", "</p>", false);
on button click of preview button
yup, then write the string to a temp html file and preview it in the browser
Open your eyes to Narcissism, Don't let her destroy your life!!
Code:strText = String.Replace(strText, "[LEFT]", "<p align=left>", false); strText = String.Replace(strText, "[/LEFT]", "</p>", false); result = Input.GetText("Input1"); TextFile.WriteFromString("C:\\temp_preview.html", "<HTML>"..result.."</HTML>", false); File.OpenURL("C:\\temp_preview.html", SW_SHOWNORMAL);
so if i have that code in preview button what else i have to do to convert "[LEFT]", "[/LEFT]" to "<p align=left>", "</p>" ????
do i have to add anything to "C:\\temp_preview.html" ???
you have nothing there calling the string.replace
1st, you get the text from the input
2nd, you translate the bbcode to html
3rd, you write the translated text to the html file and preview it
like this
PHP Code:strText = Input.GetText("Input1");-- get the text
strText = String.Replace(strText, "[left]", "<p align=left>", false);-- translate
strText = String.Replace(strText, "[/left]", "</p>", false);-- translate
TextFile.WriteFromString("C:\\temp_preview.html","<HTML>"..strText.."</HTML>",false);-- write the html file
File.OpenURL("C:\\temp_preview.html", SW_SHOWNORMAL);-- show the preview
Open your eyes to Narcissism, Don't let her destroy your life!!
thanks Rizlauk i got it
another question what will i do for ???
Code:[COLOR="Red"]GoOgle[/COLOR]Code:[SIZE="6"]GoOgle[/SIZE]Code:[font="Arial"]GoOgLe[/font]
Last edited by GoOgLe; 03-25-2007 at 04:25 PM.
do the same
strText = String.Replace(strText, "[color=", "<font color=", false);
but the last 2 should be like this to pick up on the tags that have been missed
strText = String.Replace(strText, "[", "<", false);
strText = String.Replace(strText, "]", ">", false);
Open your eyes to Narcissism, Don't let her destroy your life!!
thanks Rizlauk
can also help me with the ordered and unordered please ???
that works fine for ordered but what will i do for unordered ????Code:<ol> <li>GoOgLe</li> </ol> <ul> <li>GoOgLe</li> </ul>
strText = String.Replace(strText, "[LIST=1]", "<ol>", false);-- translate
strText = String.Replace(strText, "[/LIST]", "</ol>", false);-- translate
strText = String.Replace(strText, "[*]", "<il>", false);-- translate
Last edited by GoOgLe; 03-26-2007 at 12:08 AM.
i managed it but please correct me if i am wrong...
Code:strText = String.Replace(strText, "[LIST]", "<ul>", false);-- translate strText = String.Replace(strText, "/LIST]", "</ul>", false);-- translate strText = String.Replace(strText, "[*]", "<li>", false);-- translateCode:strText = String.Replace(strText, "[list=1]", "<ol>", false);-- translate strText = String.Replace(strText, "[/list]", "</ol>", false);-- translate strText = String.Replace(strText, "[*]", "<il>", false);-- translate
can u help with that please ???? what's the convertion of this code in html ???Code:[PHP]$myvar = 'Hello World!'; for ($i = 0; $i < 10; $i++) { echo $myvar . "\n"; }[/PHP]
Last edited by GoOgLe; 03-26-2007 at 12:55 AM.
NOTICE: Remove space in the [ php] tag in your coding... the board is confused with this code in my post.Code:strText = String.Replace(strText, "[ php]", "<? ", false);-- translate strText = String.Replace(strText, "[ /php]", " ?>", false);-- translate
Last edited by bule; 03-26-2007 at 01:41 AM.
Never know what life is gonna throw at you.
(Based on a true story.)
thanks alot blue