NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Robert Iliuta on October 09, 2016, 10:14:54 PM

Title: Put menu name in session value
Post by: Robert Iliuta on October 09, 2016, 10:14:54 PM
Hallo!


When I click on a menu I would like to put that menu name in a session value.
How can I do that?


Thank you,
Robert
Title: Re: Put menu name in session value
Post by: Bruce on October 11, 2016, 11:19:21 PM
Hi Robert,

When you click on a menu (in the browser) the browser reads the hyperlink to go to, and goes to that hyperlink.
There's no server-side interaction at this point.

Your best option is to add a parameter to the hyperlink (?menuitem=nnn) and then in the WebHandler, ProcessLink method test for the parameter and store it then. For example;

  self.StoreValue('menuitem')

Cheers
Bruce

 
Title: Re: Put menu name in session value
Post by: Robert Iliuta on October 12, 2016, 08:13:26 AM
Thank you Bruce! Solved.  8)

First I try like you said and works ok, just that on the link was little bit ugly (/home?menuitem=Home)
...so I try something else.


 CASE p_web.PageName
  OF 'acasa'
     p_web.SSV('menuitem','Pagina de pornire')
  OF 'programari'
     p_web.SSV('menuitem','Programari')
  OF 'istoric-mesaje'
     p_web.SSV('menuitem','Istoric')
 ....etc

This text I wanted to show in header of the page so I move the code form WebHandler > ProccesLink to Header before generate the header.
Of course I could leave this code on WebHandler > ProccesLink but this could have any impact on webserver speed? or it's the same if I leave in Header procedure?

Thank you!
Robert
Title: Re: Put menu name in session value
Post by: Bruce on October 12, 2016, 11:35:21 PM
I don't think it will have any impact on speed, so I would leave it as it is.