Forum Moderators: open
I would like to take these sets - at least the 2 complete sets - and put them into a file (or files) that are search engine friendly, and then have javascript to "play" them each day.
From an old thread, I saw that this can be done, but I am not a code so I'm not sure how. There is reference to using the following:
"As a first step I would include all the facts into page with only one visible something like
<span id='fact1' >Blah blah .. </span>
<span id='fact2' class='hideme'>Blah blah .. </span>
etc, with suitable css entry for 'hideme' ... this way search engines will see all your facts. The job of the javascript is then to change the className of the choosen one to "" and the rest to "hideme"
However, I don't know the javascript. I'm also not quite sure how to properly alter the .txt file per the suggestion above.
Appreciate any help!
Thanks,
gckorn
You could hand convert the txt files into html pages, but better if you have access to PHP or some other server side scripting support, this needs to be done on the server side for the search engines to index it.
There is not much javascript involved, lets know when you have requirements sorted out.
Thanks for your reply. The cycle I have in mind is this (essentially a 2 1/2 year cycle):
2008 - Run B.txt (which has items for all 365 days)
2009 - Run C.txt (ditto)
2010 - Run B.txt (except the period June 18 through December 31, which runs A.txt which I will expand.
2011 - Run B.txt
2012 - Run C.txt
2013 - Run A.txt (fully expanded by then)
I have PHP server side scripting available, though I'm not sure how to code the PHP. That's pretty much it. Can you help?
Thank you in advance,
Gary
What I have is a list of "On This Day in Maine" stuff. So June 17 has a factotum relating to that date. I would need to show the June 17 fact on June 17, then the June 18 fact on June 18, etc.
First, in your text file, I would start each article with a datestamp. To convincingly put these in HTML I would divide them up monthly, that way you have quite a few pages of good content for the search engines, and it's also usable if your users decide to browse the pages.
Second, if your site is in HTML, I would take advantage of SHTMLs' #include directive to insert your 'on this day' article in the page, which could point to a simple script, written in PHP, Perl, whatever that could easily pick up the correct article, while maintaining the yearly cycle without having to change something once per year (think %3).
<?php
$file = file('data.txt');
$today = getdate();
foreach ($file as $line => $data)
{
list($month, $day, $tip) = explode('¦', trim($data) );
if ($today['month'] == $month AND $today['mday'] == $day)
{
echo $tip;
echo "<p>";
}
}
?>
gc
To make it even more maintenance free, you can use the mod operator to cycle the correct year.
For example (and I'm writing generally here, I don't do PHP but I'll assume it will work):
filenumber = ((year -2008) % 3) +2008
year -2008 will start at 0 for this year. %3 will 'loop' every 3 years, so you'll get 0, 1, 2, 0, 1, 2, etc.... By adding 2008 on again you'll get year numbers, 2008, 2009, 2010, 2008, 2009, 2010, etc....
So you can call your files by a name like 'year2008.txt' and onwards, so you'll never need to modify the script to adjust for different years, at least until you add more facts.