Code Example |
Dynamic Result |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
1 |
## Display a simple text string put "Hello Word" |
Hello World | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2 |
## Repeat (count) ## Build a list based on the count repeat with x = 1 to 5 put "Line" && x & "<br />" end repeat |
Line 1 Line 2 Line 3 Line 4 Line 5 |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
3 |
## Mathematical Functions ## Calculate the area of a circle put 5 into tRadius put pi & (tRadius * tRadius) into tArea put round(tArea, 2) into tArea put tArea |
78.54 | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
4 |
## Strip a filename off a URL string put "http://serversamples.livecode.com/basic.lc" into tURL set the itemDel to "/" delete the last item of tURL put tURL |
http://samples.on-rev.com | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
5 |
## Generate the 10 times table put "<table cellpadding='2'>" repeat with x = 1 to 10 put "<tr>" repeat with y = 1 to 10 put "<td>" & (x * y) & "</td>" end repeat put "</tr>" end repeat put "</table>" |
|
Let's start by looking at the basics of using LiveCode to script a website. LiveCode can be embedded into a webpage in much the same was as other web scripting languages such as PHP or ASP. When a visitor to your website loads a page containing LiveCode code, the LiveCode server engine executes any code it finds. All that you have to do is place your code snippets in between special tags:
<?lc -LiveCode Code Here- ?>
Those who have built a website in PHP or ASP will be familiar with this sort of scripting. LiveCode follows the same structure as other web scriting languages but allows you to do it in LiveCode! We have provided a number of very basic examples and the results they produce. You can start experimenting right away by signing up for your LiveCode Hosting account at https://livecode.com/hosting.