NetTalk Central
NetTalk Web Server => Web Server - Ask For Help => Topic started by: ntnewbies on August 05, 2020, 07:24:36 PM
-
hi friends,
i have a procedure called Product.
when i call that procedure, then the url path is localhost/product
i will be using the same procedure for other business option like Services, Consultation and so on (i provide the entry field for the customer to type their own service name).
thus, for example, if the customer select the option as Consultation, then the url should be
localhost/consultation
but since the procedure is Product, thus the url remains localhost/product
how do i achieve it as localhost/consultation
any idea?
jason
nt11.41
c11
-
It's done in the WebHandler procedure, in the _SendFile method, just after loc:filename is set.
So, for example;
if lower(loc:filename) = 'consultation'
loc:filename = 'product'
end
(This is from memory, so you may have to experiment a bit - but if you inspect loc:filename then you should see what I mean).
cheers
Bruce
-
hi bruce,
if i use your code, then the url will become locahost/product
but i want it to appear as localhost/consultation
the procedure name is product.
jason
-
Hi Jason,
As your "Product" function is really designed to perform the work of a "virtual" page, eg Consultation.
Wait until the embed point _SendFile (so any other NetTalk pages are dealt with first). If the page requested doesn't match one of your built in page names, its now the right time to check if a virtual page (one your customer has made up) has been requested.
At this time, check your database (don't bother checking if the page is .jpg, .png, .js, .css otherwise it will unnecessarily slow your system down) to see if the page requested matches one defined by your customers.
If it does, you call product and have it do the work.
Your URL will be what the human typed/followed, so it will already be correct and doesn't need fixing.
Just make sure your builtin names don't clash with arbitrary names your customers are allowed to invent.
Regards
Bill
-
>> if i use your code, then the url will become locahost/product
not in the browser.
>> but i want it to appear as localhost/consultation
in the browser will appear whatever the user "asked for".
Cheers
Bruce