date dependent link

G

Glenn

I have a link on my website to a "specials of the month" page. When you
click it, it opens a PDF file that has, obviously, the current month
specials.

I know my monthly specials for the entire year.

I have already created the pdf files for each month (Janspec.pdf,
febspec.pdf, etc.)

Is there some code I can use so that it will look at the date on my server
and provide the user with the appropriate PDF file?

Thanks.
 
T

Thomas A. Rowe

Can you run ASP?

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
T

Thomas A. Rowe

That does not answer my question, can you run ASP?

Having or not having the FP extensions on your server, has nothing do with if you can or can't run
ASP, having the extensions does however makes manage your site easier.

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
M

Mike Mueller

Having the FPSE is different than being able to use ASP

If you can use asp, then you could use a script to check the
date and call up the correct pdf:





:Glenn answered:
: Yes. I have Front Page 2002 extensions installed on the
: server.
:
:: "Thomas A. Rowe"
:: Can you run ASP?
::
::: "Glenn"queried
::: I have a link on my website to a "specials of the
::: month" page. When you click it, it opens a PDF file
::: that has, obviously, the current month specials.
:::
::: I know my monthly specials for the entire year.
:::
::: I have already created the pdf files for each month
::: (Janspec.pdf, febspec.pdf, etc.)
:::
::: Is there some code I can use so that it will look at
::: the date on my server and provide the user with the
::: appropriate PDF file?
:::
::: Thanks.
 
T

Thomas A. Rowe

Ok. On the page where the link will appear do the following:

<%
CurDate = Date()
CMth = Month(CurDate)

If CMth = 1 Then
Specials = "Janspec.pdf"
ElseIf CMth = 2 then
Specials = "Febspec.pdf"
ElseIf CMth = 3 then
..
..
..
ElseIf CMth = 12 then
Specials = "Decspec.pdf"
End If
%>

Add the above before the opening <html> tag

Then in you actual hyperlink do the following
<a href="<%=Specials%>" target="_blank">Monthly Special</a>

The above is assuming that the PDFs are in the same location as the page with the link to them.
--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
G

Glenn

I tried that and get this error:




Microsoft VBScript compilation error '800a03f6'

Expected 'End'

/Main/test.asp, line 41



(line 41 is the hyperlink)
 
T

Thomas A. Rowe

Glenn,

If you haven't solved the problem, can you post the complete block of code?

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
G

Glenn

Sure, here it is (obviously, I haven't solved the problem):

<%
CurDate = Date()
CMth = Month(CurDate)
If CMth = 1 Then
qhcsmenu = "janqhcs.pdf"
ElseIf CMth = 2 then
qhcsmenu = "febqhcs.pdf"
ElseIf CMth = 3 then
qhcsmenu = "marqhcs.pdf"
If CMth = 4 Then
qhcsmenu = "aprqhcs.pdf"
ElseIf CMth = 5 then
qhcsmenu = "mayqhcs.pdf"
ElseIf CMth = 6 then
qhcsmenu = "junqhcs.pdf"
If CMth = 7 Then
qhcsmenu = "julqhcs.pdf"
ElseIf CMth = 8 then
qhcsmenu = "augqhcs.pdf"
ElseIf CMth = 9 then
qhcsmenu = "sepqhcs.pdf"
If CMth = 10 Then
qhcsmenu = "octqhcs.pdf"
ElseIf CMth = 11 then
qhcsmenu = "novqhcs.pdf"
ElseIf CMth = 12 then
qhcsmenu = "decqhcs.pdf"
EndIf
%>

<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Menu</title>

</head>
<a href="<%=qhcsmenu%>"target="_blank">Monthly Special</a>
<body>



</body>

</html>
 
S

Stefan B Rusynko

EndIf
is supposed to be
End If




| Sure, here it is (obviously, I haven't solved the problem):
|
| <%
| CurDate = Date()
| CMth = Month(CurDate)
| If CMth = 1 Then
| qhcsmenu = "janqhcs.pdf"
| ElseIf CMth = 2 then
| qhcsmenu = "febqhcs.pdf"
| ElseIf CMth = 3 then
| qhcsmenu = "marqhcs.pdf"
| If CMth = 4 Then
| qhcsmenu = "aprqhcs.pdf"
| ElseIf CMth = 5 then
| qhcsmenu = "mayqhcs.pdf"
| ElseIf CMth = 6 then
| qhcsmenu = "junqhcs.pdf"
| If CMth = 7 Then
| qhcsmenu = "julqhcs.pdf"
| ElseIf CMth = 8 then
| qhcsmenu = "augqhcs.pdf"
| ElseIf CMth = 9 then
| qhcsmenu = "sepqhcs.pdf"
| If CMth = 10 Then
| qhcsmenu = "octqhcs.pdf"
| ElseIf CMth = 11 then
| qhcsmenu = "novqhcs.pdf"
| ElseIf CMth = 12 then
| qhcsmenu = "decqhcs.pdf"
| EndIf
| %>
|
| <html>
| <head>
| <meta http-equiv="Content-Language" content="en-us">
| <meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
| <title>Menu</title>
|
| </head>
| <a href="<%=qhcsmenu%>"target="_blank">Monthly Special</a>
| <body>
|
|
|
| </body>
|
| </html>
| | > Glenn,
| >
| > If you haven't solved the problem, can you post the complete block of
| > code?
| >
| > --
| > ==============================================
| > Thomas A. Rowe (Microsoft MVP - FrontPage)
| > WEBMASTER Resources(tm)
| >
| > FrontPage Resources, WebCircle, MS KB Quick Links, etc.
| > ==============================================
| > To assist you in getting the best answers for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| >
| > | >>I tried that and get this error:
| >>
| >>
| >>
| >>
| >> Microsoft VBScript compilation error '800a03f6'
| >>
| >> Expected 'End'
| >>
| >> /Main/test.asp, line 41
| >>
| >>
| >>
| >> (line 41 is the hyperlink)
| >>
| >> | >>> Ok. On the page where the link will appear do the following:
| >>>
| >>> <%
| >>> CurDate = Date()
| >>> CMth = Month(CurDate)
| >>>
| >>> If CMth = 1 Then
| >>> Specials = "Janspec.pdf"
| >>> ElseIf CMth = 2 then
| >>> Specials = "Febspec.pdf"
| >>> ElseIf CMth = 3 then
| >>> .
| >>> .
| >>> .
| >>> ElseIf CMth = 12 then
| >>> Specials = "Decspec.pdf"
| >>> End If
| >>> %>
| >>>
| >>> Add the above before the opening <html> tag
| >>>
| >>> Then in you actual hyperlink do the following
| >>> <a href="<%=Specials%>" target="_blank">Monthly Special</a>
| >>>
| >>> The above is assuming that the PDFs are in the same location as the page
| >>> with the link to them.
| >>> --
| >>> ==============================================
| >>> Thomas A. Rowe (Microsoft MVP - FrontPage)
| >>> WEBMASTER Resources(tm)
| >>>
| >>> FrontPage Resources, WebCircle, MS KB Quick Links, etc.
| >>> ==============================================
| >>> To assist you in getting the best answers for FrontPage support see:
| >>> http://www.net-sites.com/sitebuilder/newsgroups.asp
| >>>
| >>> | >>>>I believe I can run them. I have some .asp pages that show results from
| >>>>a database.
| >>>>
| >>>> | >>>>> Having the FPSE is different than being able to use ASP
| >>>>>
| >>>>> If you can use asp, then you could use a script to check the
| >>>>> date and call up the correct pdf:
| >>>>>
| >>>>>
| >>>>>
| >>>>>
| >>>>>
| >>>>> :Glenn answered:
| >>>>> : Yes. I have Front Page 2002 extensions installed on the
| >>>>> : server.
| >>>>> :
| >>>>> :: "Thomas A. Rowe"
| >>>>> :: Can you run ASP?
| >>>>> ::
| >>>>> ::: "Glenn"queried
| >>>>> ::: I have a link on my website to a "specials of the
| >>>>> ::: month" page. When you click it, it opens a PDF file
| >>>>> ::: that has, obviously, the current month specials.
| >>>>> :::
| >>>>> ::: I know my monthly specials for the entire year.
| >>>>> :::
| >>>>> ::: I have already created the pdf files for each month
| >>>>> ::: (Janspec.pdf, febspec.pdf, etc.)
| >>>>> :::
| >>>>> ::: Is there some code I can use so that it will look at
| >>>>> ::: the date on my server and provide the user with the
| >>>>> ::: appropriate PDF file?
| >>>>> :::
| >>>>> ::: Thanks.
| >>>>>
| >>>>>
| >>>>
| >>>>
| >>>
| >>>
| >>
| >>
| >
| >
|
|
 
G

Glenn

I noticed what have been an error (some "ifs instead of ElseIf" so I
corrected it - as below - but it still doesn't work. Should it be saved as
..asp or .aspx ?

<%
CurDate = Date()
CMth = Month(CurDate)
If CMth = 1 Then
qhcsmenu = "janqhcs.pdf"
ElseIf CMth = 2 then
qhcsmenu = "febqhcs.pdf"
ElseIf CMth = 3 then
qhcsmenu = "marqhcs.pdf"
ElseIf CMth = 4 Then
qhcsmenu = "aprqhcs.pdf"
ElseIf CMth = 5 then
qhcsmenu = "mayqhcs.pdf"
ElseIf CMth = 6 then
qhcsmenu = "junqhcs.pdf"
ElseIf CMth = 7 Then
qhcsmenu = "julqhcs.pdf"
ElseIf CMth = 8 then
qhcsmenu = "augqhcs.pdf"
ElseIf CMth = 9 then
qhcsmenu = "sepqhcs.pdf"
ElseIf CMth = 10 Then
qhcsmenu = "octqhcs.pdf"
ElseIf CMth = 11 then
qhcsmenu = "novqhcs.pdf"
ElseIf CMth = 12 then
qhcsmenu = "decqhcs.pdf"
EndIf
%>

<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Menu</title>

</head>
<a href="<%=qhcsmenu%>"target="_blank">Monthly Special</a>
<body>



</body>

</html>
 
T

Thomas A. Rowe

The page needs to have a .asp extension and insert a space in the line below between " and target:

<a href="<%=qhcsmenu%>" target="_blank">

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
G

Glenn

Great! Thank you both. Now for the next question. What if my PDF files
are in a different folder? Wherehow do I code that in? Thanks.
 
T

Thomas A. Rowe

I would change the link as needed:

<a href="../pdf/<%=qhcsmenu%>" target="_blank">

and would keep all pdf in a single folder.

Or

You could enter path in the script and leave the link unchanged.

Note: in either case FP will not manage the links for you, you have to manage them manually.
--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
G

Glenn

I'm not sure what you mean by your last line about FP will not manage the
links. ?

Thanks.
 
S

Stefan B Rusynko

FP does not manage any script links
- so if you change any file names or paths you need to edit your scripts




| I'm not sure what you mean by your last line about FP will not manage the
| links. ?
|
| Thanks.
| | >I would change the link as needed:
| >
| > <a href="../pdf/<%=qhcsmenu%>" target="_blank">
| >
| > and would keep all pdf in a single folder.
| >
| > Or
| >
| > You could enter path in the script and leave the link unchanged.
| >
| > Note: in either case FP will not manage the links for you, you have to
| > manage them manually.
| > --
| > ==============================================
| > Thomas A. Rowe (Microsoft MVP - FrontPage)
| > WEBMASTER Resources(tm)
| >
| > FrontPage Resources, WebCircle, MS KB Quick Links, etc.
| > ==============================================
| > To assist you in getting the best answers for FrontPage support see:
| > http://www.net-sites.com/sitebuilder/newsgroups.asp
| >
| > | >> Great! Thank you both. Now for the next question. What if my PDF files
| >> are in a different folder? Wherehow do I code that in? Thanks.
| >> | >>> The page needs to have a .asp extension and insert a space in the line
| >>> below between " and target:
| >>>
| >>> <a href="<%=qhcsmenu%>" target="_blank">
| >>>
| >>> --
| >>> ==============================================
| >>> Thomas A. Rowe (Microsoft MVP - FrontPage)
| >>> WEBMASTER Resources(tm)
| >>>
| >>> FrontPage Resources, WebCircle, MS KB Quick Links, etc.
| >>> ==============================================
| >>> To assist you in getting the best answers for FrontPage support see:
| >>> http://www.net-sites.com/sitebuilder/newsgroups.asp
| >>>
| >>> | >>>>I noticed what have been an error (some "ifs instead of ElseIf" so I
| >>>>corrected it - as below - but it still doesn't work. Should it be saved
| >>>>as .asp or .aspx ?
| >>>>
| >>>> <%
| >>>> CurDate = Date()
| >>>> CMth = Month(CurDate)
| >>>> If CMth = 1 Then
| >>>> qhcsmenu = "janqhcs.pdf"
| >>>> ElseIf CMth = 2 then
| >>>> qhcsmenu = "febqhcs.pdf"
| >>>> ElseIf CMth = 3 then
| >>>> qhcsmenu = "marqhcs.pdf"
| >>>> ElseIf CMth = 4 Then
| >>>> qhcsmenu = "aprqhcs.pdf"
| >>>> ElseIf CMth = 5 then
| >>>> qhcsmenu = "mayqhcs.pdf"
| >>>> ElseIf CMth = 6 then
| >>>> qhcsmenu = "junqhcs.pdf"
| >>>> ElseIf CMth = 7 Then
| >>>> qhcsmenu = "julqhcs.pdf"
| >>>> ElseIf CMth = 8 then
| >>>> qhcsmenu = "augqhcs.pdf"
| >>>> ElseIf CMth = 9 then
| >>>> qhcsmenu = "sepqhcs.pdf"
| >>>> ElseIf CMth = 10 Then
| >>>> qhcsmenu = "octqhcs.pdf"
| >>>> ElseIf CMth = 11 then
| >>>> qhcsmenu = "novqhcs.pdf"
| >>>> ElseIf CMth = 12 then
| >>>> qhcsmenu = "decqhcs.pdf"
| >>>> EndIf
| >>>> %>
| >>>>
| >>>> <html>
| >>>> <head>
| >>>> <meta http-equiv="Content-Language" content="en-us">
| >>>> <meta http-equiv="Content-Type" content="text/html;
| >>>> charset=windows-1252">
| >>>> <title>Menu</title>
| >>>>
| >>>> </head>
| >>>> <a href="<%=qhcsmenu%>"target="_blank">Monthly Special</a>
| >>>> <body>
| >>>>
| >>>>
| >>>>
| >>>> </body>
| >>>>
| >>>> </html>
| >>>> | >>>>> Sure, here it is (obviously, I haven't solved the problem):
| >>>>>
| >>>>> <%
| >>>>> CurDate = Date()
| >>>>> CMth = Month(CurDate)
| >>>>> If CMth = 1 Then
| >>>>> qhcsmenu = "janqhcs.pdf"
| >>>>> ElseIf CMth = 2 then
| >>>>> qhcsmenu = "febqhcs.pdf"
| >>>>> ElseIf CMth = 3 then
| >>>>> qhcsmenu = "marqhcs.pdf"
| >>>>> If CMth = 4 Then
| >>>>> qhcsmenu = "aprqhcs.pdf"
| >>>>> ElseIf CMth = 5 then
| >>>>> qhcsmenu = "mayqhcs.pdf"
| >>>>> ElseIf CMth = 6 then
| >>>>> qhcsmenu = "junqhcs.pdf"
| >>>>> If CMth = 7 Then
| >>>>> qhcsmenu = "julqhcs.pdf"
| >>>>> ElseIf CMth = 8 then
| >>>>> qhcsmenu = "augqhcs.pdf"
| >>>>> ElseIf CMth = 9 then
| >>>>> qhcsmenu = "sepqhcs.pdf"
| >>>>> If CMth = 10 Then
| >>>>> qhcsmenu = "octqhcs.pdf"
| >>>>> ElseIf CMth = 11 then
| >>>>> qhcsmenu = "novqhcs.pdf"
| >>>>> ElseIf CMth = 12 then
| >>>>> qhcsmenu = "decqhcs.pdf"
| >>>>> EndIf
| >>>>> %>
| >>>>>
| >>>>> <html>
| >>>>> <head>
| >>>>> <meta http-equiv="Content-Language" content="en-us">
| >>>>> <meta http-equiv="Content-Type" content="text/html;
| >>>>> charset=windows-1252">
| >>>>> <title>Menu</title>
| >>>>>
| >>>>> </head>
| >>>>> <a href="<%=qhcsmenu%>"target="_blank">Monthly Special</a>
| >>>>> <body>
| >>>>>
| >>>>>
| >>>>>
| >>>>> </body>
| >>>>>
| >>>>> </html>
| >>>>> | >>>>>> Glenn,
| >>>>>>
| >>>>>> If you haven't solved the problem, can you post the complete block of
| >>>>>> code?
| >>>>>>
| >>>>>> --
| >>>>>> ==============================================
| >>>>>> Thomas A. Rowe (Microsoft MVP - FrontPage)
| >>>>>> WEBMASTER Resources(tm)
| >>>>>>
| >>>>>> FrontPage Resources, WebCircle, MS KB Quick Links, etc.
| >>>>>> ==============================================
| >>>>>> To assist you in getting the best answers for FrontPage support see:
| >>>>>> http://www.net-sites.com/sitebuilder/newsgroups.asp
| >>>>>>
| >>>>>> | >>>>>>>I tried that and get this error:
| >>>>>>>
| >>>>>>>
| >>>>>>>
| >>>>>>>
| >>>>>>> Microsoft VBScript compilation error '800a03f6'
| >>>>>>>
| >>>>>>> Expected 'End'
| >>>>>>>
| >>>>>>> /Main/test.asp, line 41
| >>>>>>>
| >>>>>>>
| >>>>>>>
| >>>>>>> (line 41 is the hyperlink)
| >>>>>>>
| >>>>>>> | >>>>>>>> Ok. On the page where the link will appear do the following:
| >>>>>>>>
| >>>>>>>> <%
| >>>>>>>> CurDate = Date()
| >>>>>>>> CMth = Month(CurDate)
| >>>>>>>>
| >>>>>>>> If CMth = 1 Then
| >>>>>>>> Specials = "Janspec.pdf"
| >>>>>>>> ElseIf CMth = 2 then
| >>>>>>>> Specials = "Febspec.pdf"
| >>>>>>>> ElseIf CMth = 3 then
| >>>>>>>> .
| >>>>>>>> .
| >>>>>>>> .
| >>>>>>>> ElseIf CMth = 12 then
| >>>>>>>> Specials = "Decspec.pdf"
| >>>>>>>> End If
| >>>>>>>> %>
| >>>>>>>>
| >>>>>>>> Add the above before the opening <html> tag
| >>>>>>>>
| >>>>>>>> Then in you actual hyperlink do the following
| >>>>>>>> <a href="<%=Specials%>" target="_blank">Monthly Special</a>
| >>>>>>>>
| >>>>>>>> The above is assuming that the PDFs are in the same location as the
| >>>>>>>> page with the link to them.
| >>>>>>>> --
| >>>>>>>> ==============================================
| >>>>>>>> Thomas A. Rowe (Microsoft MVP - FrontPage)
| >>>>>>>> WEBMASTER Resources(tm)
| >>>>>>>>
| >>>>>>>> FrontPage Resources, WebCircle, MS KB Quick Links, etc.
| >>>>>>>> ==============================================
| >>>>>>>> To assist you in getting the best answers for FrontPage support
| >>>>>>>> see:
| >>>>>>>> http://www.net-sites.com/sitebuilder/newsgroups.asp
| >>>>>>>>
| >>>>>>>> | >>>>>>>>>I believe I can run them. I have some .asp pages that show results
| >>>>>>>>>from a database.
| >>>>>>>>>
| >>>>>>>>> | >>>>>>>>>> Having the FPSE is different than being able to use ASP
| >>>>>>>>>>
| >>>>>>>>>> If you can use asp, then you could use a script to check the
| >>>>>>>>>> date and call up the correct pdf:
| >>>>>>>>>>
| >>>>>>>>>>
| >>>>>>>>>>
| >>>>>>>>>>
| >>>>>>>>>>
| >>>>>>>>>> :Glenn answered:
| >>>>>>>>>> : Yes. I have Front Page 2002 extensions installed on the
| >>>>>>>>>> : server.
| >>>>>>>>>> :
| >>>>>>>>>> :: "Thomas A. Rowe"
| >>>>>>>>>> :: Can you run ASP?
| >>>>>>>>>> ::
| >>>>>>>>>> ::: "Glenn"queried
| >>>>>>>>>> ::: I have a link on my website to a "specials of the
| >>>>>>>>>> ::: month" page. When you click it, it opens a PDF file
| >>>>>>>>>> ::: that has, obviously, the current month specials.
| >>>>>>>>>> :::
| >>>>>>>>>> ::: I know my monthly specials for the entire year.
| >>>>>>>>>> :::
| >>>>>>>>>> ::: I have already created the pdf files for each month
| >>>>>>>>>> ::: (Janspec.pdf, febspec.pdf, etc.)
| >>>>>>>>>> :::
| >>>>>>>>>> ::: Is there some code I can use so that it will look at
| >>>>>>>>>> ::: the date on my server and provide the user with the
| >>>>>>>>>> ::: appropriate PDF file?
| >>>>>>>>>> :::
| >>>>>>>>>> ::: Thanks.
| >>>>>>>>>>
| >>>>>>>>>>
| >>>>>>>>>
| >>>>>>>>>
| >>>>>>>>
| >>>>>>>>
| >>>>>>>
| >>>>>>>
| >>>>>>
| >>>>>>
| >>>>>
| >>>>>
| >>>>
| >>>>
| >>>
| >>>
| >>
| >>
| >
| >
|
|
 
G

Glenn

Thanks. Now I have a new question.

If I wanted to add a link that would give them a preview of next month's
specials, is there code to do that?
 
T

Thomas A. Rowe

If CMth = 1 Then
qhcsmenu = "janqhcs.pdf"
nqhcsmenu = "febqhcs.pdf"

ElseIf CMth = 2 then

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================
 
Top