| 1. |
Solve : Code to make image/text disappear after set period of time? |
|
Answer» I am the webmaster for the amateur radio club I am a member of. I recently completed a ground-up upgrade to our club's website. One of the new features on the site is a page where equipment for sale/trade/wanted may be listed. As part of the disclaimer, I put that items listed will be removed after 30 days. I remember seeing somewhere online where you can set a time-limit to remove a section of text and images after a set period of time, but I cannot remember where I saw it. An example of what I am talking about is when you go to a website and you see a "NEW" image after a listing. Usually those images are removed after a certain period of time, say 2 to 4 weeks. The website is www.ncarc.org. The page I am working on is the Swap Shop. And yes, PHP is enabled. So, there are a few different ways to approach this. WITHOUT creating a full-blown CMS, I'd be inclined to do something along the following lines:
How does that sound? It would be up to you to ensure that the file names followed your chosen convention, since there's not a lot of automation built into this.That would work. However, one thing I engineered into the website redesign is simplicity. In the unlikely event that I need to surrender my duties as webmaster for some reason, I wrote all my code so that anyone with minimal HTML experience can come in behind me and continue to maintain the website. So having a simple method to remove a post after a set period of time would be better. Quote from: kl0if on January 04, 2012, 11:29:29 AM That would work. However, one thing I engineered into the website redesign is simplicity. In the unlikely event that I need to surrender my duties as webmaster for some reason, I wrote all my code so that anyone with minimal HTML experience can come in behind me and continue to maintain the website. So having a simple method to remove a post after a set period of time would be better. You can't do this with plain HTML. period. It's going to need a server-side script of some sort.I guess it would be possible to do something similar client-side with javascript - put each item in its own DIV that contains a date stamp somewhere in its ID attribute and then only display those DIVs that are "in date". But this relies on client-side compliance (javascript being enabled; users not inspecting the code) and would be no simpler than the PHP method. Essentially, like it or not, what you're talking about is a kind of CMS feature; you are managing content automatically. Someone with only HTML experience (no javascript, no PHP) is not going to understand this. Someone with PHP experience will easily understand it however, especially if your code is well documented. Also, if you provide adequate documentation, any successor web master should be able to follow the basic pattern of creating text files complying to your file naming convention. |
|