How to store an HTML code in a string variable??

BlitzMax Forums/BlitzMax Beginners Area/How to store an HTML code in a string variable??

Pyrael(Posted 2011) [#1]
Hello all,

I try to store some kind of HTML (file) tags in an string variable

e.g. like this:

LOCAL html:string

html = "<BR><HR><BR>
<table width="100%" border="1" cellpadding="0" cellspacing="2">
<tr>
<th scope="row">look URL</th>
<td><img src="_varPicURL"></td>
</tr>
</table>"

goal is to handle the variable "_varPicURL" to store an URL by given of Userinput.
Variable the have to been replaced by Userinput an streamed out as file.

unlikely when I try to compile the complete code I reseve an error message like this "Compile Error - Expecting expression but encountered malformed string literal"

can someone provide me with a little hint to solve the problem with the right codesnipes??

thanks a lot


Yan(Posted 2011) [#2]
Local _varPicURL:String = "Hello, my name's Brian Blessed"
Local html:String = "<BR><HR><BR>~n<table width=~q100%~q border=~q1~q cellpadding=~q0~q cellspacing=~q2~q>~n...BLAH...~n<td><img src=~q" + _varPicURL + "~q></td>~n...BLAH..."

Print html



Czar Flavius(Posted 2011) [#3]
You can't directly put quotes in a string or it gets confused. You need to use the escape codes for quotes (and newlines) as shown by Yan.


Pyrael(Posted 2011) [#4]
wonderful - it works!!

but now one question left.....Why or better how you know that with the

~q (for quotes)
~n (for linebreak)

is it a part of the blitzmax tutorial??

how i can i find that out by myself??

thanks for your support!!!

Last edited 2011


Yan(Posted 2011) [#5]
This information can be found in the BMax documentation...

'Language' or 'Language Reference' -> Literals


Pyrael(Posted 2011) [#6]
Ok....found it...thanks a lot Yan and Czar Flavius for your help!!