Best practice tip: Don't think WebViews think WebViewWidgets. These are a cornerstone of Lianja development.
The directives in an .rsp pages as just like those in .asp pages with the exception that you write in Lianja/VFP scripting. They therefore contain all the directives you would expect.
An .rsp page is just an HTML page with <%@ ... %> and <%= ... %> directives embedded within the HTML. You don't need to do any substitution of expressions or anything like that; I't all done by the page processor.
So if you are familiar for .asp, .php or .jsp pages. The page processor works like those do. The Lianja App Builder has this page processor built-in as does the Lianja Cloud Server.
If you want to get clever using JavaScript libraries, you write your .rsp pages as "WebViewWidgets" which I have blogged about and explained on the forums in numerous places. To get an example of a "WebViewWidget" and how to use JQuery or another JavaScript framework in them then I would suggest you select the "Library" workspace and open up calendar_view.rsp and calendar_controller.rsp and read through the code. Its well laid out and easy to follow.
The calendar_view.rsp file includes and uses various JavaScript libraries like this:
Code:
<%
text raw
<!-- Import the JavaScript libraries that our WebViewWidget uses -->
<link type="text/css" href="lib:/jquery/css/smoothness/jquery-ui.css" rel="stylesheet" />
<script type="text/javascript" src="lib:/jquery/js/jquery.min.js"></script>
<script type="text/javascript" src="lib:/jquery/js/jquery-ui.min.js"></script>
<link rel='stylesheet' type='text/css' href='lib:/fullcalendar/fullcalendar.css' />
<link rel='stylesheet' type='text/css' href='lib:/fullcalendar/fullcalendar.print.css' media='print' />
<script type='text/javascript' src='lib:/fullcalendar/fullcalendar.min.js'></script>
<script type="text/javascript" src="lib:/jquery/jquery-timepicker/jquery.timepicker.js"></script>
<link rel="stylesheet" type="text/css" href="lib:/jquery/jquery-timepicker/jquery.timepicker.css" />
<script type="text/javascript" src="lib:/jquery/jquery-timepicker/lib/base.js"></script>
<link rel="stylesheet" type="text/css" href="lib:/jquery/jquery-timepicker/lib/base.css" />
endtext
%>
If you want to use these libraries in many different WebViewWidgets you can put the code in another file and include it like this:
Code:
<%@ include="lib:/mylibraryfiles.rsp" %>
and if you want to hide all the code from prying eyes on the internet just use codebehind.
So, the code that Hank shared can be be written like this (as the page processor does all the work for you):
Code:
<body style="font-family:Verdana;" >
<%
lcPage = ""
lnMileage = nvl(curvan.vs_odom,0)
%>
<table align="center" border="0" cellpadding="1" cellspacing="1" style="width: 500px ">
<tbody>
<tr>
<td>
<span style="font-size:90%;">Van #</span></td>
<td>
<span style="font-size:90%;"><%= m.cVanNo %></span></td>
<td>
<span style="font-size:90%;"><span style="color:#ffffff;">MM</span></span></td>
<td>
<span style="font-size:90%;">Mileage</span></td>
<td>
<span style="font-size:90%;"><%= lnMileage %></span></td>
</tr>
<tr>
<td>
<span style="font-size:90%;">Make</span></td>
<td>
<span style="font-size:90%;"><%= trim(curvan.make) %></span></td>
<td>
</td>
<td>
<span style="font-size:90%;">VIN</span></td>
<td>
<span style="font-size:90%;"><%= trim(curvan.vh_vin) %></span></td>
</tr>
<tr>
<td>
<span style="font-size:90%;">Model</span></td>
<td>
<span style="font-size:90%;"><%= trim(curvan.model) %></span></td>
<td>
</td>
<td>
<span style="font-size:90%;">Lic #</span></td>
<td>
<span style="font-size:90%;"><%= trim(curvan.vh_licno) %></span></td>
</tr>
<tr>
<td>
<span style="font-size:90%;">Year</span></td>
<td>
<span style="font-size:90%;"><%= transform(curvan.vh_year) %></span></td>
<td>
</td>
<td>
<span style="font-size:90%;">Lic State</span></td>
<td>
<span style="font-size:90%;"><%= curvan.vh_licst %></span></td>
</tr>
</tbody>
</table>
</body>
Tip: WebViews and WebViewWidgets aren't used exclusively to build a web App. They are only one of the Visual elements of the UI. You build an App up out of pages; Build pages out of sections, of which WebViews are only one of the section types available.
Bookmarks