NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: jhalpin on September 01, 2010, 03:41:48 AM
-
Hi. The docs make reference to the ability to use custom tags:
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.
Are there any examples of this?
Thanks,
Jim
-
Hi Jim,
Do you mean tags that include your session variables -<!-- Net:s:MyVariable -->?
or procedures as controls? <!-- Net:MyProcName -->
Chris
-
Hi, Chris
Procedures as controls. I get the session variable stuff, but I'm not sure what 'handling the tag' in the ProcessTag method is all about. If I reference a procedure directly, I don't know what embed would be required. If an embed is sometimes needed, why, and how does it work?
Thanks,
Jim
-
Pretty much any netweb procedure (I think except for NetWebPage) can be tagged into another procedure.
In the XHTML tag, add a routine, give it a reason to generate (condition),select where you want it to generate (There is a drop list of possible places) and in the editor that pops up, just include <!-- Net:thenetwebprocedurename -->
You can of course build stuff around it like putting it inside a table -
<Table><tr><td><!-- Net:thenetwebprocedurename --></td></tr></table>
or a div -
<div class="mygraphicallyinterestinglayout")<!-- Net:thenetwebprocedurename --></div>
If you make a static HTML web page, you can even put the tag in there and the webhandler will populate the browse or form for you.
hth
chris
-
Thanks, Chris, but I'm still wondering about handling it in the ProcessTag method. Where would that come into play?
-
Say that you have some site specific data that you want to create a tag; for example Company Name. In your page you could embed <!-- Net:CompanyName --> and then in the ProcessTag() method you'd add the code to replace it with the value for your site.
So given the above example you'd write something like this in the method before the parent call:
If lower(p_tagstring) = 'companyname'
someString = 'My Company Name'
Self.SendString(Self.Translate(someString), 1, Len(clip(someString) ), Net:NoHeader)
Return
End
However, you need to ensure that none of your custom tags conflict with any procedure labels.
HTH
Larry Sand
-
That's too easy!
thanks
chris
-
Cool. Thanks,
Jim