Page 3 of 4 FirstFirst 1234 LastLast
Results 21 to 30 of 31

Thread: adding more dates e.g. good friday

  1. #21
    Join Date
    Nov 2014
    Location
    On A Scottish Island
    Posts
    453
    Thanks
    0
    Thanked 58 Times in 54 Posts

    Default

    Advent in the Church calendar only consists of the four Sundays leading up to Christmas. They should be referred to as the "First Sunday In Advent", "Second Sunday..." etc.

    "Advent Calendars" are a Victorian invention and comprise the 24 days from December 1st to Christmas Eve.

    The "12 days of Christmas" are the 12 days of celebration between Christmas Day and Epiphany (Twelfth Night). See the following links:

    https://www.christianity.com/christi...is-advent.html

    http://www.christianitytoday.com/his...christmas.html

    Hope that helps.

  2. #22
    Join Date
    Dec 2017
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    By way of explanation, the first version performs a different function. There is a header panel at the top of the page that tells what happened on any particular day and date in the 1960s. It changes every day, and there is information about events for every single day of the year that is why there is so much stuff. The second version is to call up and display holidays, and similar information at the bottom of the screen and does not show a message every single day of the year. A message will only display if the day is a holiday or similar event such as day light saving. By the way I did not include the date in the second version because it is already displayed at the top of the page in the header panel where the 1960s material is displayed. The message is all that is required. Advent should stop (last day to display Advent to be December 24th). In effect the Advent feature needs to start 4 Sundays before Christmas and the final display to appear on Christmas Eve. Christmas Eve being the last day before Christmas.

  3. #23
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,485
    Thanks
    79
    Thanked 3,446 Times in 3,407 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by styxlawyer View Post
    Advent in the Church calendar only consists of the four Sundays leading up to Christmas. They should be referred to as the "First Sunday In Advent", "Second Sunday..." etc.

    "Advent Calendars" are a Victorian invention and comprise the 24 days from December 1st to Christmas Eve.

    The "12 days of Christmas" are the 12 days of celebration between Christmas Day and Epiphany (Twelfth Night). See the following links:
    Then that makes it easier, if a bit confusing. Replace:

    Code:
    	// Advent
    	if (month === admonth && date === addate) dhtml.push("Advent Sunday");
    	adnames = ['Second', 'Third', 'Fourth', 'Fifth', 'Sixth', 'Seventh', 'Eighth', 'Ninth', 'Tenth', 'Eleventh', 'Twelfth'];
    	for(i = 0; i < adnames.length; ++i){
    		adcal.setDate(addate + 1);
    		if (month === adcal.getMonth() && date === (addate = adcal.getDate())) dhtml.push("Today is the " + adnames[i] + " Day of Advent");
    	}
    with:

    Code:
    	// Advent
    	if (month === admonth && date === addate) dhtml.push("Advent Sunday");
    	adnames = ['Second', 'Third', 'Fourth'];
    	for(i = 0; i < adnames.length; ++i){
    		if (month === 11 && date >= 25){break;}
    		adcal.setDate(addate + 7);
    		if (month === adcal.getMonth() && date === (addate = adcal.getDate())) dhtml.push(adnames[i] + " Sunday of Advent");
    	}
    And if you want to list the days of advent as Dec 1, Dec 2, and so on. But I'd do only one or the other since one is based upon Advent Sunday, and the other is based upon the tradition of advent calendars. If you try to represent both, it will likely look odd and/or be confusing. So, you could leave that part as it was before the looping, and add back your original days of advent based on Dec 1st.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  4. #24
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,485
    Thanks
    79
    Thanked 3,446 Times in 3,407 Posts
    Blog Entries
    12

    Default

    Quote Originally Posted by leccie View Post
    By way of explanation, the first version performs a different function. There is a header panel at the top of the page that tells what happened on any particular day and date in the 1960s. It changes every day, and there is information about events for every single day of the year that is why there is so much stuff. The second version is to call up and display holidays, and similar information at the bottom of the screen and does not show a message every single day of the year. A message will only display if the day is a holiday or similar event such as day light saving. By the way I did not include the date in the second version because it is already displayed at the top of the page in the header panel where the 1960s material is displayed. The message is all that is required. Advent should stop (last day to display Advent to be December 24th). In effect the Advent feature needs to start 4 Sundays before Christmas and the final display to appear on Christmas Eve. Christmas Eve being the last day before Christmas.
    Right, that's why I would recommend removing:

    Code:
    	// Easter and Related
    	if (month === emonth && date === edate) dhtml.push("Easter Sunday (Western)");
    	if (month === gfmonth && date === gfdate) dhtml.push("Good Friday (Western)");
    	if (month === wmmonth && date === wmdate) dhtml.push("Whit Monday");
    	// Advent
    	if (month === admonth && date === addate) dhtml.push("Advent Sunday");
    from the first version of this script on the page.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  5. #25
    Join Date
    Dec 2017
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    John, I am more than happy to be guided by your advice. Clearly you have a great deal of knowledge and expertise. By the way would you mind explaining the differences, and advantages of using dhtml.push instead of the document.write protocol. I find that very interesting.

  6. #26
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,485
    Thanks
    79
    Thanked 3,446 Times in 3,407 Posts
    Blog Entries
    12

    Default

    First, there's no specific such thing as dhtml.push. In this particular code I created an array named dhtml, I just made up the name and was thinking it stood for dates HTML. The .push() is a method for adding to an array. Once everything that's been configured for a given date has been added to the array (usually only one thing, but for some dates it can be two or more things), I use the innerHTML property of the target element to populate it with the date html (stored in this code in an array called html, and the dates html from the dhtml array.

    So really the difference is between using document.write and using the innerHTML property of a target element. Generally, if everything you're doing is happening as the page is loading, one can use either method. However, once code makes it out into the wild, people will often try to execute it after the page has loaded. If you do this with document.write it will obliterate everything that went before, the entire page, leaving only the new content. If you use injection to an element via its innerHTML property, only that one element is changed. Odd situations can arise with document.write where even if you think it's executing as the page is loading, some other code on the page might delay it, once that happens, your page is wiped out, even if you were using document.write "correctly". That's why it's been deprecated. It still works (within the limitations described), but it's strongly advised to get rid of it when updating code and to not use it in new code. I actually once used it to intentionally obliterate a page and replace it with other content without having to load a different page (that was for a quiz script, to load the results once the quiz was complete). But I doubt I would ever do that now because it breaks the back button, thereby making it possible for the user to lose content.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  7. #27
    Join Date
    Dec 2017
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for explaining that. No doubt you have deduced long since that I am not very conversant with the dynamics of script protocols. I do have a book (SAMS teach yourself) but despite having spent many hours pouring over its contents I have never really made much progress. That is why cut and paste scripts are so appealing. I am very grateful for your input. So, how do I incorperate the revised code into my page? The one thing that I have learned is that you have to be very careful because is so easy to screw everything up. I tend to back up all my code in a Word document so that if a major disaster happen I can recover it, and that has happened a few times I can tell you! I have certainly learned a lot from your observations on good practice.

  8. #28
    Join Date
    Nov 2014
    Location
    On A Scottish Island
    Posts
    453
    Thanks
    0
    Thanked 58 Times in 54 Posts

    Default

    Quote Originally Posted by leccie View Post
    .
    .
    .
    I tend to back up all my code in a Word document so that if a major disaster happen I can recover it, and that has happened a few times I can tell you!
    .
    .
    Word is probably not the best way to backup HTML pages as it can add all sorts of hidden undesirable stuff! What I do is just save a copy of the file adding the date and time of saving at the end of the filename in the form "yyyymmddHHMM" (eg "201712082306". That way you can quickly go back to a known working version created at a particular time on a particular day.

  9. #29
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,485
    Thanks
    79
    Thanked 3,446 Times in 3,407 Posts
    Blog Entries
    12

    Default

    Well if you're just cutting and pasting, Word is probably OK. However, the best backups for html pages is just a plain copy of them, preferably of the same name in a different folder, or numbered backup copies in the same folder.

    As for:

    Quote Originally Posted by leccie View Post
    So, how do I incorperate the revised code into my page?
    I thought I gave you a completely revised page. Didn't you get it? As for any revisions since then, If you don't know where which go, assuming you decide to use any of them, they're all optional - just talk it out here. I'm sure we can get it sorted.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  10. #30
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,485
    Thanks
    79
    Thanked 3,446 Times in 3,407 Posts
    Blog Entries
    12

    Default

    Well, anyways, I've been messing with the code some more, hopefully making it easier to use. So I will update your page using the new code and attach it here when it's done. I think a stripped down version of the script without any but the listed content from each month is right for the first one. For the second, I think I see what to do there as well, we can tweak either one later if you want.

    Also, for Advent, I' see that some Advent calendars follow the liturgical Advent, so there is at least the option of throwing out all mention of Advent in the December section, and using this code:

    Code:
    	// Liturgical Advent
    	if(month > admonth - 1){
    		if (month === admonth && date === addate) dhtml.push("Advent Sunday");
    		else if((month < 11 && date > addate) || date < 25){
    			adnames = ['Second', 'Third', 'Fourth', 'Fifth', 'Sixth', 'Seventh', 'Eighth', 'Ninth', 'Tenth', 'Eleventh', 'Twelfth', '13th',
    				   '14th', '15th', '16th', '17th', '18th', '19th', '20th', '21st', '22nd', '23rd', '24th', '25th', '26th', '27th', '28th'];
    			for(i = 0; i < adnames.length; ++i){
    				adcal.setDate(addate + 1);
    				if (month === adcal.getMonth() && date === (addate = adcal.getDate())) dhtml.push(
    					(adcal.getDay()? '' : adnames[f(i / 6 - 1)] + " Sunday, ") + adnames[i] + " Day of Advent (Liturgical)"
    				);
    			}
    		}
    	}
    That's what I'm including in the update anyway. It gives output like:

    Seventh Day of Advent (Liturgical)

    or on a Sunday during Advent:

    Second Sunday, Eighth Day of Advent (Liturgical)
    Last edited by jscheuer1; 12-10-2017 at 05:06 AM. Reason: minor code improvement
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Similar Threads

  1. Replies: 3
    Last Post: 03-04-2013, 12:25 AM
  2. different dates
    By james438 in forum Dynamic Drive scripts help
    Replies: 1
    Last Post: 06-09-2010, 06:35 AM
  3. Friday the 13th
    By magicyte in forum The lounge
    Replies: 4
    Last Post: 03-14-2009, 02:12 AM
  4. Friday 13th
    By Sikky in forum The lounge
    Replies: 26
    Last Post: 11-07-2006, 08:17 AM
  5. Dates
    By NXArmada in forum PHP
    Replies: 10
    Last Post: 05-22-2006, 05:11 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •