ScriptBasic
May 25, 2013, 03:15:16 AM *
Welcome, Guest. Please login or register.

Login with username, password and session length
News: The ScriptBasic User, Developer and extension module guides are available at the WIKI.
 
   Home   Wiki Help Search Login Register  
Pages: [1]
  Print  
Author Topic: How to print html code?  (Read 1266 times)
votan
Newbie
*
Posts: 7


« on: February 21, 2010, 08:13:31 AM »

Is there an easy way to print html code (using sbhttpd)? So that the browser displays all the html code instead of interpreting it?
Current solution would be to parse all html and replace characters like "<>" with their chr-codes to make it work.... but there is propably an easier way to just escape that!?
Logged
support
Administrator
*****
Posts: 555



WWW
« Reply #1 on: February 21, 2010, 10:28:18 AM »

View source in your browser.

The sbhttpd server executes programs. HTML is string data to SB and whatever you send to the browser is what will be displayed in the browser.

If you asking if you can view SB code in the browser the answer is no. SB doesn't parse embedded HTML scripts like php (which is a hackers dream) but executes a CGI binary program.

You could make a copy of your SB source outside the SB proxy directory and add a .txt to the end. This way the browser sees the file as text and displays it verbatim.

Hint:

I find it easier to wrap static HTML/JavaScript text in strings and PRINT them in my output section of my script after any preprocessing that needs to be done. SB also allows (like Python) to encapsulate multiple lines of text using """ (three quotes) and it will send that string to the browser as is with line breaks, tabs, ...
Logged

ScriptBasic Project Manager
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!