Anyway, how do you use scripts like this in a NT web app?
Hello Don,
Nettalk-Webserver can serve two sorts of pages: static pages and dynamically created pages.
For those static ones you are responsible to include such custom .JS. You do this in the HTML-Editor of your choice.
In these dynamically generated paged you tell Nettalk to do that for you.
This takes place in the webhandler procedure.
There you find a method called .IncludeScripts().
Here you can add your own snippet to the automatical generated yaddayadda.
The official yaddayadda is in PARENT.IncludeScripts(). When you do a RETURN = 'your own' & 'official yaddayadda' BEFORE the ParentCall, like this:
p_web.IncludeScripts PROCEDURE
ReturnValue ANY
! Start of "NetTalk Method Data Section"
! [Priority 5000]
! End of "NetTalk Method Data Section"
CODE
! Start of "NetTalk Method Executable Code Section"
! [Priority 4500]
return('<script src="/scripts/your.new.script.js" type="text/javascript"></script> <13,10>' & |
PARENT.IncludeScripts())
! Parent Call
ReturnValue = PARENT.IncludeScripts()
then your dynamically generated header looks like this:
<head>
....
<script src="/scripts/your.new.script.js" type="text/javascript"></script>
<script src="/scripts/all.js" type="text/javascript"></script>
....
</head>
You also can swap places, let you custom JS be at the end.
(I have left out the styles and all other distracting stuff from the header - the <13,10> is inserted for better readability in case you look at the source of your webpage).
NB: I have tried you cool find from DynamiDrive, but it seems not to work with Nettalk-WS 4. Once I removed "all.js" from the pages, then it worked well - but as the rest relies on all.js, it was just an academical test. Nettalk 4 uses RiCO, while your script is utilizing the jQuery Framework.
Your custom magnifier-script works well with Nettalk 5, because it uses jQuery. In NT5 you MUST NOT add the line
<script type="text/javascript" src="
http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
because NT5 is using the more recent jQuery version 1.4!
And in addition, in my experience you have to call your custion jQuery-script AFTER the general jquery is initialized.
PARENT.IncludeScripts()) & '<script src="/scripts/your.new.script.js" type="text/javascript"></script> <13,10>'
But in general, this would be the ways to add custom javascripts to your webserver.
hth
Wolfgang
P. S.: of course you can add a script in the
Webserver-Extension (which is the easiest way of all), but in this case the required
Copyright-Notice is not included!