Content Expiration

S

Sean

I have some content on a web page that needs to expire on a certain
date. I'm doing a promo that ends December 31st, 2010. I need a
sentence in a paragraph to go away on January 1st, 2011.

Example:
Before Jan. 1, 2011:
Dear guest, register to win a $250 gift card. Also, receive an HP
laptop for free. Thank you!

After Jan 1, 2011:
Dear guest, register to win a $250 gift card. Thank you!
 
R

rf

Sean said:
I have some content on a web page that needs to expire on a certain
date. I'm doing a promo that ends December 31st, 2010. I need a
sentence in a paragraph to go away on January 1st, 2011.

Example:
Before Jan. 1, 2011:
Dear guest, register to win a $250 gift card. Also, receive an HP
laptop for free. Thank you!

After Jan 1, 2011:
Dear guest, register to win a $250 gift card. Thank you!

On the morning of January 1st, 2011 edit your web site and remove the
offending sentence.
 
D

Doug Miller

I have some content on a web page that needs to expire on a certain
date. I'm doing a promo that ends December 31st, 2010. I need a
sentence in a paragraph to go away on January 1st, 2011.

There's no way to do that in HTML. If your content is generated dynamically on
the server side (e.g. by PHP or ASP) then ask in a newsgroup germane to your
server-side code.
 
C

cwdjrxyz

There's no way to do that in HTML. If your content is generated dynamically on
the server side (e.g. by PHP or ASP) then ask in a newsgroup germane to your
server-side code.

It should be fairly simple using php if you have access to php on the
server you are using. Php can give you information about the time and
date including the time since a starting reference point a long time
ago. Likely instead of the paragraph you wish to remove in the future,
you will introduce a short php section. First it will find the current
reference time. You will also need to calculate the reference time
when you wish to delete or change the paragraph. The php script is
written to see if the current reference time is greater than or less
than the the cut off reference time. If less than, the php code then
writes the paragraph you need before the cut off time. If equal or
greater than, nothing is written, or you write something saying the
offer is expired. The rest of your present html page would remain the
same, except it would have to be named something.php instead of the
present something.html. I have never done exactly this with php, and
we do not have an online examle of your complete code. Thus I will not
be more specific at this time. If you have access to php I suggest you
post to comp.lang.php. Since you have a gmail address, I am guessing
you post from Google Groups. If so go to http://groups.google.com/group/comp.lang.php/topics?hl=en
.. and sign up for that group if you wish to post there.
 
S

Sean

There's no way to do that in HTML. If your content is generated dynamically on
the server side (e.g. by PHP or ASP) then ask in a newsgroup germane to your
server-side code.

yeah, i don't have access to php on my server and asp is beyond me,
it's pure html. that's what i needed to know.
 
C

cwdjrxyz

yeah, i don't have access to php on my server and asp is beyond me,
it's pure html.  that's what i needed to know.

Since php and other server side code is not possible for you, I will
mention that you likely could do this with Javascript much I outlined
for php. But Javascript can be turned off on a few computers and thus
they would not change or delete the message at the time your offer
expires. You can use a noscript path to desplay a message that script
is turned off and that Javascript is required for the page. However
the few people who have Javascript turned off for whatever reason may
be annoyed by your script message. Many banks, etc. require
Javascript, but someone is more likely to turn it on for them to be
able to view their private information correctly.
 
A

Andy Dingley

I have some content on a web page that needs to expire on a certain
date.  

Change the content being served at this time.

Before this (and quite importantly, before you even serve the offer
page) set the HTTP response headers so that the first page isn't
cached beyond that rollover date. You're best learning to set these
through .htaccess or similar, if you're only using a static server.
Otherwise serve them from your scripting language, or else (if forced
to) <meta http-equiv ... > in your HTML pages (but check that these
aren't being over-ridden by a real header coming from the server).

Find yourself either an alarm clock, or some trivial PHP scripting, to
handle the actual changeover.
 
?

.._..

Depending on how the resource is manged:

Make a batch / cron file on the server to over-write the file with one
without the paragraph in it.

Or, use the FTP scripting tools to make a batch file and command file that
uploads a pre-prepared file from the home computer.

Then trigger either of the above with the scheduler service approprate for
the OS.

I have some content on a web page that needs to expire on a certain
date.

Change the content being served at this time.

Before this (and quite importantly, before you even serve the offer
page) set the HTTP response headers so that the first page isn't
cached beyond that rollover date. You're best learning to set these
through .htaccess or similar, if you're only using a static server.
Otherwise serve them from your scripting language, or else (if forced
to) <meta http-equiv ... > in your HTML pages (but check that these
aren't being over-ridden by a real header coming from the server).

Find yourself either an alarm clock, or some trivial PHP scripting, to
handle the actual changeover.
 
B

Beauregard T. Shagnasty

..._.. said:
Depending on how the resource is manged:

Managed? ;-)
Make a batch / cron file on the server to over-write the file with one
without the paragraph in it. Or, use the FTP scripting tools to make
a batch file and command file that uploads a pre-prepared file from
the home computer.

Then trigger either of the above with the scheduler service
approprate for the OS.

It is, in this instance, far easier to simply remove the phrase " Also,
receive an HP laptop for free. " and FTP up the new version when he
comes home from the New Years Eve party. 10-15 seconds work?

Please do not top-post.
 
D

Doug Miller

Managed? ;-)

Perhaps he meant "mangled". :-b
It is, in this instance, far easier to simply remove the phrase " Also,
receive an HP laptop for free. " and FTP up the new version when he
comes home from the New Years Eve party. 10-15 seconds work?

Unless he doesn't come home from that party until 6am.
Unless he's too blasted or hung over to remember to do it.
Unless...
Unless...
Unless...

I like the idea of a cron job better. Computers don't get drunk or forget to
do things.
 
1

123Jim

Sean said:
I have some content on a web page that needs to expire on a certain
date. I'm doing a promo that ends December 31st, 2010. I need a
sentence in a paragraph to go away on January 1st, 2011.

Example:
Before Jan. 1, 2011:
Dear guest, register to win a $250 gift card. Also, receive an HP
laptop for free. Thank you!

After Jan 1, 2011:
Dear guest, register to win a $250 gift card. Thank you!

Whatever way you do it, you should probably display the message: 'offer
expires at [time] on [date]' .. that way you don't need to be too concerned
if the page remains available, in the visitors' cache
 
J

Jukka K. Korpela

cwdjrxyz said:
Since php and other server side code is not possible for you, I will
mention that you likely could do this with Javascript much I outlined
for php.

It's fairly simple in JavaScript. Example:

<div id="expires">Special offer: bla bla bla. This offer ends at the end of
year 2010.</div>
<script type="text/javascript">
var expDate = new Date("December 31, 2010");
var expElem = document.getElementById('expires');
if(expElem) {
var now = new Date();
if(now > expDate) {
expElem.innerHTML = ""; } }
</script>

I first thought of a more structured approach, using <del
datetime="...">...</del>, but that's a bad idea, since when scripting is
off, the content would be displayed in a manner that suggests that it has
bee deleted (typically, with strike over). So it's better to use
content-free markup like said:
But Javascript can be turned off on a few computers and thus
they would not change or delete the message at the time your offer
expires.

That's not a serious problem if the content clearly says the expiry date.
You can use a noscript path to desplay a message that script
is turned off and that Javascript is required for the page. However
the few people who have Javascript turned off for whatever reason may
be annoyed by your script message.

Indeed, and in a case like this, it would be really annoying since
JavaScript would not really be _needed_ for viewing the page.
 
J

Jukka K. Korpela

Doug said:
And if I have JS disabled?

Did you actually read my message? I guess not. Please do so now. It
specifically addressed the question you asked, before you even asked it.
 
S

SAZ

Sean said:
I have some content on a web page that needs to expire on a certain
date. I'm doing a promo that ends December 31st, 2010. I need a
sentence in a paragraph to go away on January 1st, 2011.

Example:
Before Jan. 1, 2011:
Dear guest, register to win a $250 gift card. Also, receive an HP
laptop for free. Thank you!

After Jan 1, 2011:
Dear guest, register to win a $250 gift card. Thank you!

Whatever way you do it, you should probably display the message: 'offer
expires at [time] on [date]' .. that way you don't need to be too concerned
if the page remains available, in the visitors' cache

That makes the most sense, and what I thought of when the OP first
posted.

"And if you register by 11:59pm on 12/31/10, you will also be entered
for an opportunity to win an HP Laptop."
 
N

Neredbojias

..
I have some content on a web page that needs to expire on a certain
date. I'm doing a promo that ends December 31st, 2010. I need a
sentence in a paragraph to go away on January 1st, 2011.

Example:
Before Jan. 1, 2011:
Dear guest, register to win a $250 gift card. Also, receive an HP
laptop for free. Thank you!

After Jan 1, 2011:
Dear guest, register to win a $250 gift card. Thank you!

Whatever way you do it, you should probably display the message:
'offer expires at [time] on [date]' .. that way you don't need to be
too concerned if the page remains available, in the visitors' cache

Yep. And that makes any cron job, certainly anything in javascript,
overkill IYAM.
 
J

Jukka K. Korpela

Neredbojias said:
Whatever way you do it, you should probably display the message:
'offer expires at [time] on [date]' .. that way you don't need to be
too concerned if the page remains available, in the visitors' cache

Yep. And that makes any cron job, certainly anything in javascript,
overkill IYAM.

Non sequitur.

It is of course usually a good idea to explicitly mention the expiry time in
page content, especially in a commercial context where this may greatly
boost sales: people are urged to buy before it is too late.

But wiping out the outdated content isn't overkill. You usually don't want
to bother visitors with outdated content. In the worst case, they might get
angry and frustrated and might refuse to buy any of the offers that are
still valid.

In such a context, the server admin has probably done his best to prevent
caching of the page, for other reasons as well, for good or bad. There are
still two reasons why it would not be overkill to have client-side
Javascript that removes the content: the page might still be retrieved from
cache for some reason (or accessed as a locally saved page); and the timed
server-side job might fail (it happens, usually due to human errors e.g. in
setting the dates, but still).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top