This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Pages: [1]
1
Web Server - Ask For Help / Re: How to put variables in static pages and replace at runtime
« on: May 25, 2008, 03:01:47 AM »
Hi Johan,
You can use a TAG to display a value from the Session queue.
In your code, you could do something like:
p_web.SetSessionValue ('MyText', glo:MyText)
Then in your static html page, insert a tag like this:
<!-- Net:s:MyText ->
and this should display the contents of glo:MyText on the page.
You could also use a TAG placed inside your html page to call a NetWebSource procedure which returns your variable content eg. <!-- Net:MyProc -->
In your code, you then add a NetWebSource procedure called MyProc and you can pretty much spit out any content/data at that location.
For tags to work in static html pages, the first line in your html source page must have the NetTalk webserver tag: <!-- NetWebServer -->
Hope that helps
Regards
Graham
Tags
A NetTalk Tag is basically a wrapper around some variable, or procedure, that you want to include at this point in the page. It takes the form
<!--Net:Something -->
In this case that Something are procedures, so the HTML generated by those procedures are included on the page.
If the Something is not a procedure, then it might be a session variable. For example you might have a session variable and you can include that on the page. You’ll see a lot of this happening as you progress through the examples.
Pages that contain tags have to be parsed by the server. If you hand-code a complete web page, or if you use a static page on the disk these tags can still be used. However in that case the first line of the page must be
<!-- NetWebServer -->
It's important to note that you can put any tag you like into your web page, as long as you handle it in the ProcessTag method in the WebHandler procedure. However there are some built-in Tags which you can use without having to add code ot the WebHandler procedure.
<!-- Net:FunctionName -->
This tag will call the specified function in that point in the code. This can be a function based on any of the NetWeb procedures. (Note: Not all the procedures make sense at every point though. For example embedding Forms needs to be done carefully as Forms require extra setup.)
<!-- Net:s:SessionVariable -->
This will embed the current contents of the session variable on the web page. If the variable should be formatted (for example a DATE field) then make sure the Picture parameter of the session variable is set using either
p_web.SetSessionValue('name','value','pic') or
p_web.SetSessionPicture('name','pic')
<!-- Net:v:Variable -->
This will display the current contents of a Parameter at this point in the web page. In other words the same as (2) above, but uses the Value queue, not the Session queue.
You can use a TAG to display a value from the Session queue.
In your code, you could do something like:
p_web.SetSessionValue ('MyText', glo:MyText)
Then in your static html page, insert a tag like this:
<!-- Net:s:MyText ->
and this should display the contents of glo:MyText on the page.
You could also use a TAG placed inside your html page to call a NetWebSource procedure which returns your variable content eg. <!-- Net:MyProc -->
In your code, you then add a NetWebSource procedure called MyProc and you can pretty much spit out any content/data at that location.
For tags to work in static html pages, the first line in your html source page must have the NetTalk webserver tag: <!-- NetWebServer -->
Hope that helps
Regards
Graham
Tags
A NetTalk Tag is basically a wrapper around some variable, or procedure, that you want to include at this point in the page. It takes the form
<!--Net:Something -->
In this case that Something are procedures, so the HTML generated by those procedures are included on the page.
If the Something is not a procedure, then it might be a session variable. For example you might have a session variable and you can include that on the page. You’ll see a lot of this happening as you progress through the examples.
Pages that contain tags have to be parsed by the server. If you hand-code a complete web page, or if you use a static page on the disk these tags can still be used. However in that case the first line of the page must be
<!-- NetWebServer -->
It's important to note that you can put any tag you like into your web page, as long as you handle it in the ProcessTag method in the WebHandler procedure. However there are some built-in Tags which you can use without having to add code ot the WebHandler procedure.
<!-- Net:FunctionName -->
This tag will call the specified function in that point in the code. This can be a function based on any of the NetWeb procedures. (Note: Not all the procedures make sense at every point though. For example embedding Forms needs to be done carefully as Forms require extra setup.)
<!-- Net:s:SessionVariable -->
This will embed the current contents of the session variable on the web page. If the variable should be formatted (for example a DATE field) then make sure the Picture parameter of the session variable is set using either
p_web.SetSessionValue('name','value','pic') or
p_web.SetSessionPicture('name','pic')
<!-- Net:v:Variable -->
This will display the current contents of a Parameter at this point in the web page. In other words the same as (2) above, but uses the Value queue, not the Session queue.
Pages: [1]