NetTalk Central

Author Topic: Static index.html and parameters  (Read 3246 times)

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Static index.html and parameters
« on: December 10, 2023, 01:26:42 PM »
Hi,

I have a static page (index.htm)
When I call for the page and send some parameters along, like /index.html?a=1&b=2,
what is the best place to "receive" the data for these parameters?
Would that be the webhandler procedure, right after the code statement?

Cheers,
Ren?
Rene Simons
NT14.14

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Static index.html and parameters
« Reply #1 on: December 11, 2023, 10:10:29 PM »
A "static page" implies "it doesn't change".
So what are you planning to do with the parameters?

If it truly is just a file off the disk, then yes, you can access the parameters in WebHandle, _SendFile method.
using p_web.GetValue('parametername')

Cheers
Bruce

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Static index.html and parameters
« Reply #2 on: December 11, 2023, 10:44:28 PM »
Hi Bruce,

Thanks for the info.
Actually, it s a static html with some <!-- Net:xxx --> thingies in it.
Some menu options refer to the same page. The parameters are used to change some session values and execute some functions in the page.

Ren?

Rene Simons
NT14.14

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: Static index.html and parameters
« Reply #3 on: December 11, 2023, 11:43:30 PM »
Hi Rene,

A better pattern is to use say a form as the container, and then allow static HTML to be injected into the form.

Your approach will work, but you'll discover it's harder to maintain, and harder to construct.

Cheers
Bruce

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Static index.html and parameters
« Reply #4 on: February 03, 2024, 10:28:15 AM »
Hi Bruce,

As I was struggeling along with my web-solution, I decided to follow your advice and create an example app.
During that process I had to trace back my steps and as a result I have a proper working example now.
So no further questions about this. Problem solved.
Thanks for your encouragement.

Cheers,
Ren?
Rene Simons
NT14.14