Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
expiring content
mogoo
We are looking for ideas on how best to post/expire content...
TechNote 048837 addresses this by suggesting attaching an expire_date metatag to the page, then do a nightly crawl of the directory tree, checking the extended attributes. This is a great solution if it's your entire page you want to post/expire. But what if you have a page of iterates, where each item in the list has it's own post/expire date?
Just wondering if anyone has encountered this issue, and what approach you took to solve it. Thanks for any input!
maureen
Find more posts tagged with
Comments
sajiddc
hmm.. "page of iterates" sounds like as if you have a page that consists of many pages. Are you using the templating solution? It would be helpful in answering your post if you could describe your process a little bit more
mogoo
OK... we have a section of announcements. We use 1 DCR, where each announcement is a replicant. Each announcement is removed after a certain date. We're looking into how to automate this process -- if the announcement is supposed to be removed on 9/1, when 9/1 rolls around, it gets automatically removed from the DCR.
Is that more clear? Just wondering if anyone's tackled this, and what process they've used. Thanks!
maureen
sajiddc
awww.. now it's crystal clear..
so did you also want to re-generate the page on 9/1 rolls around. Let me give you one suggestion:
Put a expiration date field in each of your replicant.
You have a parser that runs in the background (say the "at" service on Windows or the "cron" on Unix) every midnight, that travels thru your templatedata/data directory, reads the DCR, parses it and if the date matches, it will remove that section. Now your program should read the EA's before it opens the file and after the modification should re-apply the EA's. Then just re-generate the HTML/JSP/ASP page.
This is just one way to do it. Hope that helps you.
Bowker
We do something similiar on our intranet.
Try this:
<script>
<iw_iterate....>
if (<iw_value name="itr.expires" > < dtToday) {
document.write('<iw_value name="itr.text_to_display">');
}
</iw_iterate>
</script>
This way the content is written out when the page is displayed.
There are a few drawbacks that since it was for the intranet, we let them go...
1) Expired and non-expired announcements were actually sent to the machine. If the user did a "view source" they could see all the expired ones.
2) we counted on the date on the client machine, not the server.
You can do kinda the same thing with setting "display" attibutes of DIVs to "none" or "inline" based upon its expiration status.
mogoo
I'm following you, sajiddc, right up until the "remove that section" part. We actually put the parse and match logic into the tpl vs. the cron job... Our code is working, we just can't figure out how to automatically elimate the expired replicant from the dcr.
We're using $rootnode->set_node_list('Post List',
@newlist)
; in the TeamSite:
CRnode module, which I thought would just replace the whole list with
@newlist
, an array without the expired replicants. This isn't touching the dcr at all, though.
Is it even possible to delete a replicant section in a dcr from the tpl, or is that something that has to be done with a cron job?
Product_Release_Planning_and_Support_Duration.ppt
mogoo
We did something similar to this, bowker. It is working; the html pages are displaying as they should. However, the associated dcrs still have expired replicants in them.
I'm attempting to use TeamSite:
CRnode, but I have a couple of things I don't understand after reading the (limited) documentation. Plus, I couldn't get the examples given to work -- seems like TS doesn't like my $xml_string =<<'EOS'; Anyway...
1. Can you actually load a dcr with this line? $rootnode = TeamSite:
CRnode->new($xml_string);
The examples never demonstrated referencing an actual dcr vs. xml_string, though the description of the module implies that you can directly access/modify a dcr.
2. What is this all about and how do you use it? XML_PROCESSING_INSTRUCTION
It might be exactly what I'm looking for, not sure, no examples of it given.
So, to get around #1, I used $rootnode = iwpt_load_dcr($dcrfile); -- which works fine, I can access all the nodes in the dcr this way. So I've loaded the dcr, cycled through its list, and pushed all the non-expired replicants into an array.
Then, according to the documentation, I should be able to use this line -- $rootnode->set_node_list('Post List',
@newlist)
; -- to reset the list so it only has non-expired replicants in it.
$modified_dcr = $rootnode->get_dcr(); -- according to the docs -- should then return the modified dcr, which I could use to overwrite the old dcr via the command line. But, $modified_dcr returns the original dcr code from before I ran the set_node_list line. I've checked
@newlist
; it only has the non-expired items in it.
What am I doing wrong here??? Help!
mogoo
Never mind, after bending, twisting, and wrestling with the code, we finally figured it out.
Thanks! -maureen
sajiddc
mogoo.. Was very very busy. Hence could not reply any earlier. Not sure if you are still having the issue or not. But i will still respond to your post.
To stay on the safe side, I suggest that you do not touch the DCR from the TPL. Instead use a cron job..
mogoo
Why the suggestion of not touching the DCR via the TPL? We're currently doing this, and it seems to be working fine. A cron job regens 2 of our pages every night. With the logic in the TPL, the replicants that are expired are removed from the dcr. It's pretty simple, any caveats, what am I missing?
-maureen
sajiddc
well I guess it falls more under the best practice catagory more than anything else. But if you or your code is smart then I guess you should be fine. I was just being cautious. I doubt that you are missing anything.
mogoo
sajiddc-
Would you have any idea why this would work from the command line but not from a cron job? The cron calls on an ipl that regens an html page. The tpl of that page has logic in it to filter out the expired replicants, then rewrite the dcr. It works perfectly from the command line. But when we run the cron, it says the tpl cannot output the dcr. Any idea why?
maureen
sajiddc
Could be an ENV variable issue. Make sure that all the ENV variable are set properly
nico
This post is almost a year old and I am wondering if this is how most of you are dealing with expiring content. I've seen other cms options handle expiring content much more elegantly via the gui. But I would really like to get some feedback on best practices on expiring content in a windows environment.
Thanks,
Nico
Bowker
We are about to launch a new site that is build with a combination of JSP and XML. The JSP opens multiple XML files to populate the presentation. Each piece of data (each XML file) has on-line and off-line dates. If the data is live then it is displayed, otherwise it depends upon which part of the presentation is off-line. If it is a promotional item on the side, then it's not displayed and any other promotional items are bumped up. For the main content, a "this page has expired..click here to return to the main site (or return to the previous page)" we havn't decided on the exact text/functionality.
Our key is that the content and its experation is separate from the presentation and the presentation is smart enough to manage expired content.
nico
So this seems like more of a development solution outside of teamsite. It would appear the only part teamsite has to play in your solution is the setting of the activate and deactivation dates then your jsp logic really does the work. Is that correct?
Anyone else using a different option to expiring content?
Migrateduser
One of the solutions that I think of implementing is as follows:
1. Have a nightly cron job that traverses the file system, and find the templated files by checking the extended attributes.
2. Find the DCR of that page and look at the last modified date (file system date, not extended attribute)
3. Compare it against any date and if expired then construct some meaningful report to be sent to content/business owner
My main reasoning is that it's the DCR's modified date that I'm interested in because a change in a Presentation template can modify the time stamp on the templated pages but not on the data record. (and I'm interested in letting the content owner know rather than deleting etc.). However whenever I see discussions about expiring content I have always seen suggestion about setting and extended attribute and checking it. Am I missing something?
I'm on Solaris. Is there any risk of the DCR's getting 'touch'ed by some unknown means.
Thanks
Saravanan
mogoo
We're working on various automated expiring content things using teamsite templating...
1) A classified-ad type page, where each ad is entered as a replicant into a DCR, with an expriration date. In addition, the title & photo of each ad are listed on a home page. A nightly cron runs, deleting any expired posts & regening the 2 pages.
2) Press releases, where each DCR's archival date field is checked, and a regen is done through archive.tpl when necessary. In addition, current & past index pages are maintained by pulling the title and link to each pr page.
Migrateduser
We are using the expiring content concept for promotions pages.
We are using this concept for promotions web pages.
This is how we are using...
we have a separate dcr for each promotion with an expiration date field in it.
A perlscript at a scheduled time looks for expired promotions and generate the current promotions only.
Can send you the perl script we are using.. if interested.
Thanks, Ram
ruler
Ram Could you please send the perl script that this
thanks