Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating a custom weblog using Perl CGI

Status
Not open for further replies.

j1500

Programmer
Feb 15, 2006
10
US
I need some help in creating a CGI to create a custom logfile.

The problem I have is trying to extract the URL of the page the visitor is currently on. Yes, I could use the CGI enviroment variable for this $ENV{REQUEST_URI} however the problem is that this CGI will be called from an include within the footer of a page. So if I use $ENV{REQUEST_URI} within the footer include it will return the footer filename each time of footer.jhtml. Instead I want to be able to actually extract the page URL the user is on.

What are some clever ways to achieve this.

Thank you so much for your help!
 
maybe use javascript to get the current page URL and send that to the script in the include in the uri string.
 
Aren't includes executed before the page is rendered?
So the javascript won't run until after the CGI include has run?

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
Correct, but s/he's looking for a method thats accessible to his/her form, so it's visible to the script on submission.

Or at least the's what I think ;-)
 
don't you know what page the user is on, by the fact the page is accessed.

what I mean is, the only way they can be on mypage.shtml is by being on mypage.shtml, so you could either have a hidden form field that holds what ever it is you want to pass back to the script.

OR, I use this method to track where people are via includes.

Code:
<!--#EXEC CGI="/cgi-bin/menu.cgi?PG=[b]mypage[/b]" -->

the menu cgi is the include for the header of each page, i simply pass it the get variable PG with the string of the page making the call.

the menu.cgi updates the page tracking table and return the HTML for the header/menu.

the same principle can be used for a footer or any other include on a page.

"In complete darkness we are all the same, only our knowledge and wisdom separates us, don't let your eyes deceive you.
 
except, I don't think you can't use EXEC to send parameters, yuo may have to use VIRTUAL instead.
 
Thanks everyone. Actually I don't know what I was doing wrong but it is now working when I call $ENV{REQUEST_URI} in a CGI from a footer include it reports the physical page like index.jhtml and not the footer file like footer.jhtml.

Thanks everyone for their insight!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top