Copy link to clipboard
Copied
Hello again...
My work is almost finished: Burlington County Area of NA / Home page ...have a few more questions to help me wrap things up (which I'll ask in separate threads)
For this question...I have a MEETINGS Page which has Tabs for the various days of the week.
On the site's Home Page...I need to also have the meetings for the particular day it happens to be, appear in the left column (TODAY'S MEETINGS) automatically, each day...exactly as they are listed on the MEETINGS Page (meaning I won't be required to list the meetings by hand each morning; & then re-upload the home page).
Can this be done in Bootstrap...???
thanx,
mark4man
See post above but the suggestion below might be an easier option.........using the jQuery 'load' function.
Copy the code below and paste it into the page where you have created the 'meetings' <div> directly before the closing </body> tag.
<script>
var weekday;
switch (new Date().getDay()) {
case 0:
weekday = "Sunday";
break;
case 1:
weekday = "Monday";
break;
case 2:
weekday = "Tuesday";
break;
case 3:
weekday = "Wednesday";
break;
case 4:
weekday = "Thursday";
break;
case 5:
weekday = "Friday";
break;
case 6:
weekda
...Copy link to clipboard
Copied
Bootstrap alone cannot manipulate data. Ideally, you would put meetings into an online database or array and query it with server-side or client side code. If you use MySQL and PHP, your meetings would be searchable by whatever data criteria you include -- day of week, time, location, type of meetings, etc...
Copy link to clipboard
Copied
This information looks like it might be 'static' information where the meetings occur on the same day each week?
If that IS the case you could store the information as a json object in a file called meetings_list.js which would take the form as below: (Sunday - Tuesday has been formatted)
var meetings = [
{
weekday: "Sunday",
title: "Flat Book (Step Working Guide)",
location: "Virtua Memorial Hospital",
address: "175 Madison Avenue, Mt Holly 08060",
time: "11:00am - 1:00pm (C/St)"
},
{
weekday: "Sunday",
title: "No Matter What",
location: "449 Club",
address: "6 Pemberton Street, Pemberton 0868",
time: "4:00pm - 5:30pm (O/S/D/L)"
},
{
weekday: "Sunday",
title: "Come Grow With Us",
location: "St Marys Hall",
address: "145 Broad Street, Burlington 08016",
time: "7:00pm - 8:30pm (O/S/St./D)"
},
{
weekday: "Sunday",
title: "Freedom Group (JS)",
location: "St Peter's Episcopal Church",
address: "1 hartford Road, Medford 08055",
time: "7:00pm - 8:30pm (O/S/St./D)"
},
{
weekday: "Sunday",
title: "Nothing Else Works",
location: "Mount Holly Friends Meeting",
address: "81 High Street, Mt Holly 08060",
time: "8:15 - 9:30pm (C,JFT,D)"
},
{
weekday: "Monday",
title: "Wake Up To Recovery Group (SJ)",
location: "First Baptist Church",
address: "19 West Main Street, Moorestown 08057",
time: "7:00am - 8:00am (O/S)"
},
{
weekday: "Monday",
title: "Together We Grow",
location: "",
address: "136 East Broad Street, Burlington 08016",
time: "12:00pm - 1:30pm (O/Tp/S/D)"
},
{
weekday: "Monday",
title: "Today We Live",
location: "Broad Street Methodist Church",
address: "36 East Broad Street, Burlington 08016",
time: "7:30pm - 9:15pm (O/S/St/H&W)"
},
{
weekday: "Monday",
title: "Freedom Group (SJ)",
location: "St Peter's Episcopal Church",
address: "1 Hartford Road, Medford 08055",
time: "8:00pm - 9:00pm (O/V)"
},
{
weekday: "Monday",
title: "Maple Shade Freedom Group",
location: "United Christ Church",
address: "45 North Fork Landing Road, Maple Shade 08052",
time: "8:00pm - 9:00pm (O/T/D)"
},
{
weekday: "Monday",
title: "Monday Nite Live",
location: "Saint Paul’s Lutheran Church",
address: "910 Marne Highway, Hainesport 08036",
time: "8:00pm - 9:30pm (O/S/IP/Td/An/Bk)"
},
{
weekday: "Tuesday",
title: "Together We Grow",
location: "",
address: "136 East Broad Street, Burlington 08016",
time: "12:00pm-1:30pm (O/Bk/S/D)"
},
{
weekday: "Tuesday",
title: "Women In Unity",
location: "St Luke’s Lutheran Church",
address: "Salem Road & Levitt Parkway, Willingboro 08046",
time: "7:00pm-8:30pm (O/W/S/Td)"
},
{
weekday: "Tuesday",
title: "Traditions & Concerns",
location: "Lourdes Hospital (back of cafeteria)",
address: "218 Sunset Road, Willingboro 08046",
time: "8:00pm-9:30pm (O/S/Td/D)"
},
{
weekday: "Tuesday",
title: "New Leaf",
location: "449 Club",
address: "6 Pemberton Street, Pemberton 08068",
time: "8:00pm-9:30pm (O; 1st St/D, 2nd Sp/D, 3rd Td, 4th & 5th IP/Anniv)"
},
{
weekday: "Tuesday",
title: "Strategic Recovery (SJ)",
location: "Prince of Peace Church",
address: "61 Route 70 East, Marlton 08053",
time: "8:00pm-9:00pm (Bk)"
},
{
weekday: "Tuesday",
title: "Recovery by the River",
location: "Sacred Heart Church",
address: "103 4th Street, Riverton 08077",
time: "7:00pm to 8:15pm (O/S/Tp/JFT) - NOT wheelchair accessible"
}
];
You can then use the information from the meetings_list.js file to insert into your 'Todays Meetings' panel, based on what day of the week it currently is, example code below:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>Meetings List</title>
<style>
body {
font-family: helvetica, snas-serif;
}
.meetings {
width: 30%;
margin: 0 auto;
background-color: #343a40;
padding: 30px;
}
.meetings h2 {
margin: 0;
padding: 0 0 10px 0;
color: #fff;
}
.meetings h4 {
margin: 0;
padding: 20px 0 5px 0;
font-size: 16px;
color: #fff;
}
.meetings p {
margin: 0;
padding: 0;
font-size: 16px;
line-height: 24px;
color: #fff;
}
</style>
</head>
<body>
<div class="meetings">
<h2>TODAY'S MEETINGS:</h2>
<div class="meetings_list">
</div>
<!-- end meetings_list -->
</div>
<!-- end meetings -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script src="meetings_list.js"></script>
<script>
// get date
const date = new Date()
// assign weekday to array
const weekday = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
// get current day
const day = weekday[date.getDay()];
// loop through meetings data from meetings_list.js file
$.each(meetings, function () {
if(this.weekday === day) {
// append results to meetings_list div
$('.meetings_list').append("<h4>" + this.title + "</h4><p>" + this.location + "</p><p>" + this.address + "</p><p>" + this.time + "</p>");
}
});
</script>
</body>
</html>
If the information changes regularly from week to week then you are best advised to create some kind of database solution, which is much more robust and malleable.
Copy link to clipboard
Copied
osgood...
thanx a million...but I'm completely confused as to where to insert your code [& I get the java script file part...(incidentally, I can just use MS Notepad & save it as the *.js, right?)]
You say insert into the TODAY's MEETINGS: Panel...this is where I'm lost...that 'card body' currently is this:
<div class="col-md-4 col-sm-6 pb-2">
<div class="card card-body bg-dark text-light h-100">
<h4 class="card-title">TODAY's MEETINGS:</h4>
<p class="card-text"><strong>Flat Book (Step Working Guide)</strong><br>Virtua Memorial Hospital<br>175 Madison Avenue, Mt Holly 08060<br>11:00am-1:00pm (C/St)</p>
<p class="card-text"><b>No Matter What</b><br>449 Club6 Pemberton Street, Pemberton 08068<br>4:00pm-5:30pm (O/S/D/L)</p>
<p class="card-text"><b>Come Grow With Us</b><br>Saint Mary's Hall<br>145 Broad Street, <br>Burlington 08016<br>7:00pm-8:30pm (O/S/St./D)</p>
<p class="card-text"><b>Freedom Group (SJ)</b><br>Saint Peter's Episcopal Church<br>1 Hartford Road, Medford 08055<br>8:00pm-9:00pm (O/V)</p>
<p class="card-text"><b>Nothing Else Works</b><br>Mount Holly Friends Meeting<br>81 High Street, Mt Holly 08060<br>8:15-9:30pm (C,JFT,D)</p>
</div>
<!-- end card body -->
</div>
Are you saying completely replace that...???...& insert all your code there (from <!DOCTYPE html> to </html>)? What about all the column & card body size & color?
I get that all the card text would now be gone...but am really lost about everything else.
MF
Copy link to clipboard
Copied
Just create a div after your current h4 tag and give it a class of meetings_list
Then copy the last two blocks of <script> </script> tag coding and insert it into your pages code directly before the closing </body> tag.
You dont need the jquery.min.js <script> link as bootstrap already has a link to it in your current page so you dont want to have any duplicate links
Youll have to use some css to style the presentation because you need to get rid of the static meetings code which currently follows your h4 tag or you could add the bootstrap classes to the p tags which are part of the <script> coding
Yes you can use notepad to create the meetings_list.js file
Hope that makes sense
Copy link to clipboard
Copied
very confusing, man...let's take it step by step:
Just create a div after your current h4 tag and give it a class of meetings_list
If I'm following you correctly...the column code for that card body now looks like this:
<div class="col-md-4 col-sm-6 pb-2">
<div class="card card-body bg-dark text-light h-100">
<div class="meetings">
<h2>TODAY'S MEETINGS:</h2>
<div class="meetings_list">
</div>
<!-- end meetings_list -->
</div>
<!-- end meetings -->
</div>
<!-- end card body -->
</div>
Then copy the last two blocks of <script> </script> tag coding and insert it into your pages code directly before the closing </body> tag.
insert it into WHAT page code...the MEETINGS Page...???...or the Home Page...???
oy vey
Copy link to clipboard
Copied
markf26988182 wrote
very confusing, man...let's take it step by step:
Just create a div after your current h4 tag and give it a class of meetings_list
If I'm following you correctly...the column code for that card body now looks like this:
<div class="col-md-4 col-sm-6 pb-2">
<div class="card card-body bg-dark text-light h-100">
<div class="meetings">
<h2>TODAY'S MEETINGS:</h2>
<div class="meetings_list">
</div>
<!-- end meetings_list -->
</div>
<!-- end meetings -->
</div>
<!-- end card body -->
</div>
Then copy the last two blocks of <script> </script> tag coding and insert it into your pages code directly before the closing </body> tag.
insert it into WHAT page code...the MEETINGS Page...???...or the Home Page...???
oy vey
Yes that's right, now take the code below and insert it in the page where you created the 'meetings' <div>, directly before the closing </body> tag, near the end of the page.
<script src="meetings_list.js"></script>
<script>
// get date
const date = new Date()
// assign weekday to array
const weekday = new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
// get current day
const day = weekday[date.getDay()];
// loop through meetings data from meetings_list.js file
$.each(meetings, function () {
if(this.weekday === day) {
// append results to meetings_list div
$('.meetings_list').append("<h4>" + this.title + "</h4><p>" + this.location + "</p><p>" + this.address + "</p><p>" + this.time + "</p>");
}
});
</script>
Then take the code below and insert it into a blank file named meetings_list.js......obviously you'll have to add Wednesday, Thursday, Friday and Saturday meetings details in the same format as Sunday, Monday, Tuesday.
var meetings = [
{
weekday: "Sunday",
title: "Flat Book (Step Working Guide)",
location: "Virtua Memorial Hospital",
address: "175 Madison Avenue, Mt Holly 08060",
time: "11:00am - 1:00pm (C/St)"
},
{
weekday: "Sunday",
title: "No Matter What",
location: "449 Club",
address: "6 Pemberton Street, Pemberton 0868",
time: "4:00pm - 5:30pm (O/S/D/L)"
},
{
weekday: "Sunday",
title: "Come Grow With Us",
location: "St Marys Hall",
address: "145 Broad Street, Burlington 08016",
time: "7:00pm - 8:30pm (O/S/St./D)"
},
{
weekday: "Sunday",
title: "Freedom Group (JS)",
location: "St Peter's Episcopal Church",
address: "1 hartford Road, Medford 08055",
time: "7:00pm - 8:30pm (O/S/St./D)"
},
{
weekday: "Sunday",
title: "Nothing Else Works",
location: "Mount Holly Friends Meeting",
address: "81 High Street, Mt Holly 08060",
time: "8:15 - 9:30pm (C,JFT,D)"
},
{
weekday: "Monday",
title: "Wake Up To Recovery Group (SJ)",
location: "First Baptist Church",
address: "19 West Main Street, Moorestown 08057",
time: "7:00am - 8:00am (O/S)"
},
{
weekday: "Monday",
title: "Together We Grow",
location: "",
address: "136 East Broad Street, Burlington 08016",
time: "12:00pm - 1:30pm (O/Tp/S/D)"
},
{
weekday: "Monday",
title: "Today We Live",
location: "Broad Street Methodist Church",
address: "36 East Broad Street, Burlington 08016",
time: "7:30pm - 9:15pm (O/S/St/H&W)"
},
{
weekday: "Monday",
title: "Freedom Group (SJ)",
location: "St Peter's Episcopal Church",
address: "1 Hartford Road, Medford 08055",
time: "8:00pm - 9:00pm (O/V)"
},
{
weekday: "Monday",
title: "Maple Shade Freedom Group",
location: "United Christ Church",
address: "45 North Fork Landing Road, Maple Shade 08052",
time: "8:00pm - 9:00pm (O/T/D)"
},
{
weekday: "Monday",
title: "Monday Nite Live",
location: "Saint Paul’s Lutheran Church",
address: "910 Marne Highway, Hainesport 08036",
time: "8:00pm - 9:30pm (O/S/IP/Td/An/Bk)"
},
{
weekday: "Tuesday",
title: "Together We Grow",
location: "",
address: "136 East Broad Street, Burlington 08016",
time: "12:00pm-1:30pm (O/Bk/S/D)"
},
{
weekday: "Tuesday",
title: "Women In Unity",
location: "St Luke’s Lutheran Church",
address: "Salem Road & Levitt Parkway, Willingboro 08046",
time: "7:00pm-8:30pm (O/W/S/Td)"
},
{
weekday: "Tuesday",
title: "Traditions & Concerns",
location: "Lourdes Hospital (back of cafeteria)",
address: "218 Sunset Road, Willingboro 08046",
time: "8:00pm-9:30pm (O/S/Td/D)"
},
{
weekday: "Tuesday",
title: "New Leaf",
location: "449 Club",
address: "6 Pemberton Street, Pemberton 08068",
time: "8:00pm-9:30pm (O; 1st St/D, 2nd Sp/D, 3rd Td, 4th & 5th IP/Anniv)"
},
{
weekday: "Tuesday",
title: "Strategic Recovery (SJ)",
location: "Prince of Peace Church",
address: "61 Route 70 East, Marlton 08053",
time: "8:00pm-9:00pm (Bk)"
},
{
weekday: "Tuesday",
title: "Recovery by the River",
location: "Sacred Heart Church",
address: "103 4th Street, Riverton 08077",
time: "7:00pm to 8:15pm (O/S/Tp/JFT) - NOT wheelchair accessible"
}
];
OR I have another perhaps much simpler solution for you, see next post.
Copy link to clipboard
Copied
See post above but the suggestion below might be an easier option.........using the jQuery 'load' function.
Copy the code below and paste it into the page where you have created the 'meetings' <div> directly before the closing </body> tag.
<script>
var weekday;
switch (new Date().getDay()) {
case 0:
weekday = "Sunday";
break;
case 1:
weekday = "Monday";
break;
case 2:
weekday = "Tuesday";
break;
case 3:
weekday = "Wednesday";
break;
case 4:
weekday = "Thursday";
break;
case 5:
weekday = "Friday";
break;
case 6:
weekday = "Saturday";
}
$('.meetings_list').load("meetings/" + weekday + ".html");
</script>
Create a folder in your site folder and name it - meetings - then create a blank file in the folder for each day of the week (no code in the files at all). Name them sunday.html, monday.html, tuesday.html, wednesday.html, thursday.html, friday.html, saturday.html
In each of the files insert the meeting code for each day as you have it currently formatted, then it will pick up the Bootstrap classes.....so for instance monday.html would be as follows:
<p class="card-text">
<strong>Flat Book (Step Working Guide)</strong>
<br>Virtua Memorial Hospital<br>
175 Madison Avenue, Mt Holly 08060<br>
11:00am-1:00pm (C/St)
</p>
<p class="card-text">
<strong>No Matter What</strong><br>
449 Club6 Pemberton Street, Pemberton 08068<br>
4:00pm-5:30pm (O/S/D/L)
</p>
<p class="card-text">
<strong>Come Grow With Us</strong><br>
Saint Mary's Hall<br>145 Broad Street, <br>
Burlington 08016<br>
7:00pm-8:30pm (O/S/St./D)
</p>
<p class="card-text">
<strong>Freedom Group (SJ)</strong><br>
Saint Peter's Episcopal Church<br>
1 Hartford Road, Medford 08055<br>
8:00pm-9:00pm (O/V)
</p>
<p class="card-text">
<strong>Nothing Else Works</strong><br>
Mount Holly Friends Meeting<br>
81 High Street, Mt Holly 08060<br>8:15-9:30pm (C,JFT,D)
</p>
Copy link to clipboard
Copied
THANX...!
(been extremely busy...haven't had a chance to implement yet, but I will...thanx again)
MF
Copy link to clipboard
Copied
For this advanced project, you must work in Code view.
Go to File > New > New Document. From the document type panel, select JSON and hit the Create button.
Paste Osgood's JSON code into the file and save as meetings_list.js to the root of your local site folder.
<scripts> go at the bottom of your document below jQuery, Bootstrap, etc...
Copy link to clipboard
Copied
osgood...
Your 1st method didn't work (unless I implemented it incorrectly)...but that's OK because, your 2nd method did...!!!...the one that you said was the "easier option.........using the jQuery 'load' function"...(the one that was marked as "correct")...thanx!
So...just to clarify:
1) On the home page...in the actual card body...the code you had me enter below the h4 tag...which was part of your FIRST method...that stays (& is necessary)...???
2) Do I need to keep the meetings_list.js file now...???
& again...thanx a million...you've set it all up so that the daily meeting list function is automatic...b4 this, I would have had to change that info every morning...you have saved me tons of time (& effort).
sincerely,
mark4man
Copy link to clipboard
Copied
markf26988182 wrote
osgood...
Your 1st method didn't work (unless I implemented it incorrectly)...
Probably formatted the js file incorrectly....its critical that it is formatted in the correct way, even if you miss out a comma it will fail....the oprtional method of using jQuery load is much more forgiving, if you format the code incorrectly in the loaded file it will still work.
markf26988182 wrote
one that was marked as "correct")...thanx!
So...just to clarify:
1) On the home page...in the actual card body...the code you had me enter below the h4 tag...which was part of your FIRST method...that stays (& is necessary)...???
2) Do I need to keep the meetings_list.js file now...???
1) h4 tag stays.
2) No you dont need the meetings.js file linked to the page as that is redundant if you use the jQuery load workflow
Copy link to clipboard
Copied
THANX!
Copy link to clipboard
Copied
osgood...wait a minute...
spoke too soon. Everything works fine on my home PC...but not when I upload everything to my server (???)
can't figure it out...I uploaded the new home page & the meetings folder (w/ the individual day html files)...have no idea why it's not working from my server.
The new home page is: Burlington County Area of NA / Home page
if you could help, I sure would appreciate it...thanx,
MF
Copy link to clipboard
Copied
Not at computer right now, l will have a look tomorrow. I have a feeling it is most likely that the server is case sensitive and cant recognise caps and lower case, try changing your named files to Sunday.html, Monday.html, Tuesday.html, Wednesday.html etc (upper case first letter) and see if it works on the remote server
Copy link to clipboard
Copied
osgood...
that did it, Holmes...thanx!
MF