First of all, I didn't want to have to rebuilt the banner for each page that is going to be retired. So, I needed a way that each instance of the banner have a way to store an individual expiration date. I also wanted a way for users who don't want their precious pages deleted to notify me. A simple email would have done, but that would have almost always involved an immediate ping back to the user asking which page. So, the banner needs a way to start an email and automatically put the URL to the page.
The implementation is pretty easy.
- First of all, get this first section of code, update 'email@company.com' to your email address on the fourth to last line and save it as pageexpiring.html in your custom content directory. Download a copy of the code here.
- Then put a browser view on the page to be retired and set the URL to point to pageexpiring.html in your custom content directory and save the view. When the page refreshes, you should see a message saying that the page has been scheduled to be retired on an unknown date.
- To add a specific date, edit the browser view and append ?expirationdate=3/31/2013 to the URL (replacing 3/31/2013 with the page retirement date).
- Repeat steps 2 and 3 for any remaining pages to be retired.
Now that you've marked a couple pages to be retired, you can use an ODBC connection to display all those pages. Here's the SelectCommand and OdbcConnection String to put in the configuration.xml:
To create the view, run the following SQL commands against the NPC server:
No comments:
Post a Comment