NetTalk Central

Author Topic: HOW TO: parse my Javascript files for Net:v:xxxx ?  (Read 2619 times)

patrick de laet

  • Newbie
  • *
  • Posts: 35
    • View Profile
    • ShopPlus
    • Email
HOW TO: parse my Javascript files for Net:v:xxxx ?
« on: January 08, 2012, 04:24:21 AM »
(Using NetTalk 5.45)
I load a Javascript file via the normal <script tag in the HEAD of my page.
I'd like to replace some variables in my Javascript.
eg: to specify the open tab in my JQuery accordion.
But, apparently, my <!-- Net:v:xxxx --> tags are not parsed for my Javascript files.
Anybody an idea how to do this?

regards

Patrick De Laet


<!-- NetWebServer -->

var jQueryAccordion1Opts = {
   active: <!-- Net:v:level3 -->,
   autoHeight:   true,
   clearStyle: false,
   event: 'click',
   animated: 'slide',
   header: 'h3',
   fillSpace: false,
   navigation: false
};

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11244
    • View Profile
Re: HOW TO: parse my Javascript files for Net:v:xxxx ?
« Reply #1 on: January 08, 2012, 09:03:02 PM »
The file-types that are parsed is set by a method called .FileType in the WebHandler procedure.
currently the code in the method looks like this;

  if instring ('.htm',lower(p_FileName),1,1)
    return (1)
  end
  if instring ('.php',lower(p_FileName),1,1)
    return (1)
  end
  return (0)

As you can see .htm (and thus .html) and .php are the only files currently parsed.

you can add your own test in the WebHandlre procedure, before or after the parent call, and return true if the file should be parsed.

Note that you may want to make the test for more than just .js as parsing does impose an extra load on the server. So you might test specifically for whatever.js.

cheers
Bruce