Jump to content

Tim32

Members
  • Posts

    13
  • Joined

  • Last visited

Everything posted by Tim32

  1. Thank you kicken. The code works perfectly.
  2. I am trying create a webpage that will automatically display new agendas as I add them to the server. I do this right now but I have to put the agendas in the agendas and the board folders. I want to simplify this by only putting the agendas in the board folder. My code kinda works but the results aren't sorted correctly. My code scans the current directory for the list of current boards. The arrary_diff removes the boards that are no longer active. It then appends the current year to the folder information. Next I glob all of the Agendas in the various directories and then I sort the resulting glob. Finally I print the results which are out of date order. I tried sort(basename($agendas)) but that is not valid syntax for sort. Then I was thinking of a 2 dimension array, the first element is the filename, the second element is the fullpath. Then I sort on the first element but I haven't figured out how to get that to work. So I went back to my first code and I am asking what did I do wrong? Am I on the right track to do what I want? The directory structure is like this: Array ( [0] => ./meeting-minutes-agendas/Board_of_Zoning_Appeals/2021/01-17-2021_Board_of_Zoning_Appeals_Agenda.pdf [1] => ./meeting-minutes-agendas/Board_of_Zoning_Appeals/2021/02-24-2021_Board_of_Zoning_Appeals_Agenda.pdf [2] => ./meeting-minutes-agendas/Board_of_Zoning_Appeals/2021/03-17-2021_Board_of_Zoning_Appeals_Agenda.pdf [3] => ./meeting-minutes-agendas/Board_of_Zoning_Appeals/2021/04-21-2021_Board_of_Zoning_Appeals_Agenda.pdf [4] => ./meeting-minutes-agendas/Economic_Development_Committee/2021/01-24-2021_EDC_Agenda.pdf [5] => ./meeting-minutes-agendas/Economic_Development_Committee/2021/02-21-2021_EDC_Agenda.pdf [6] => ./meeting-minutes-agendas/Economic_Development_Committee/2021/03-21-2021_EDC_Agenda.pdf [7] => ./meeting-minutes-agendas/Park_Board/2021/01-21-2021_Park_Board_Agenda.pdf [8] => ./meeting-minutes-agendas/Park_Board/2021/02-18-2021_Park_Board_Agenda.pdf [9] => ./meeting-minutes-agendas/Park_Board/2021/03-18-2021_Park_Board_Agenda.pdf [10] => ./meeting-minutes-agendas/Park_Board/2021/03-27-2021_Park_Board_Agenda.pdf [11] => ./meeting-minutes-agendas/Park_Board/2021/04-22-2021_Park_Board_Agenda.pdf [12] => ./meeting-minutes-agendas/Plan_Commission/2021/01-07-2021_Plan_Commission_Agenda.pdf [13] => ./meeting-minutes-agendas/Plan_Commission/2021/01-21-2021_Plan_Commission_Agenda.pdf [14] => ./meeting-minutes-agendas/Plan_Commission/2021/02-04-2021_Plan_Commission_Agenda.pdf [15] => ./meeting-minutes-agendas/Plan_Commission/2021/02-18-2021_Plan_Commission_Agenda.pdf [16] => ./meeting-minutes-agendas/Plan_Commission/2021/03-04-2021_Plan_Commission_Agenda.pdf [17] => ./meeting-minutes-agendas/Plan_Commission/2021/03-18-2021_Plan_Commission_Agenda.pdf [18] => ./meeting-minutes-agendas/Plan_Commission/2021/04-08-2021_Plan_Commission_Agenda.pdf [19] => ./meeting-minutes-agendas/Plan_Commission/2021/04-22-2021_Plan_Commission_Agenda.pdf [20] => ./meeting-minutes-agendas/Redevelopment_Commission/2021/01-17-2021_RDC_Agenda.pdf [21] => ./meeting-minutes-agendas/Redevelopment_Commission/2021/02-14-2021_RDC_Agenda.pdf [22] => ./meeting-minutes-agendas/Redevelopment_Commission/2021/03-14-2021_RDC_Agenda.pdf [23] => ./meeting-minutes-agendas/Safety_Board/2021/01-08-2021_Safety_Board_Agenda.pdf [24] => ./meeting-minutes-agendas/Safety_Board/2021/02-16-2021_Safety_Board_Agenda.pdf [25] => ./meeting-minutes-agendas/Safety_Board/2021/03-16-2021_Safety_Board_Agenda.pdf [26] => ./meeting-minutes-agendas/Safety_Board/2021/04-22-2021_Safety_Board_Agenda.pdf [27] => ./meeting-minutes-agendas/Sanitary_District/2021/01-19-2021_Sanitary_District_Agenda.pdf [28] => ./meeting-minutes-agendas/Sanitary_District/2021/02-16-2021_Sanitary_District_Agenda.pdf [29] => ./meeting-minutes-agendas/Sanitary_District/2021/03-16-2021_Sanitary_District_Agenda.pdf [30] => ./meeting-minutes-agendas/Sanitary_District/2021/03-23-2021_Sanitary_District_Agenda.pdf [31] => ./meeting-minutes-agendas/Sanitary_District/2021/03-31-2021_Sanitary_District_Agenda.pdf [32] => ./meeting-minutes-agendas/Sanitary_District/2021/04-20-2021_Sanitary_District_Agenda.pdf [33] => ./meeting-minutes-agendas/Town_Council/2021/01-13-2021_Town_Council_Agenda.pdf [34] => ./meeting-minutes-agendas/Town_Council/2021/01-27-2021_Town_Council_Agenda.pdf [35] => ./meeting-minutes-agendas/Town_Council/2021/02-02-2021_Town_Council_Agenda.pdf [36] => ./meeting-minutes-agendas/Town_Council/2021/02-24-2021_Town_Council_Agenda.pdf [37] => ./meeting-minutes-agendas/Town_Council/2021/03-03-2021_Town_Council_Agenda.pdf [38] => ./meeting-minutes-agendas/Town_Council/2021/03-24-2021_Town_Council_Agenda.pdf [39] => ./meeting-minutes-agendas/Town_Council/2021/04-14-2021_Town_Council_Special_Meeting_Agenda.pdf [40] => ./meeting-minutes-agendas/Town_Council/2021/04-14-2021_Town_Council_Study_Session_Agenda.pdf [41] => ./meeting-minutes-agendas/Waterworks_Board/2021/01-07-2021_Waterwork_Board_Agenda.pdf [42] => ./meeting-minutes-agendas/Waterworks_Board/2021/01-19-2021_Waterworks_Board_Agenda.pdf [43] => ./meeting-minutes-agendas/Waterworks_Board/2021/01-28-2021_Waterworks_Board_Agenda.pdf [44] => ./meeting-minutes-agendas/Waterworks_Board/2021/02-16-2021_Waterworks_Board_Agenda.pdf [45] => ./meeting-minutes-agendas/Waterworks_Board/2021/03-16-2021_Waterworks_Board_Agenda.pdf [46] => ./meeting-minutes-agendas/Waterworks_Board/2021/04-20-2021_Waterworks_Board_Agenda.pdf ) What I get is 04-21-2021_Board_of_Zoning_Appeals_Agenda.pdf 04-22-2021_Park_Board_Agenda.pdf 04-22-2021_Plan_Commission_Agenda.pdf 04-22-2021_Safety_Board_Agenda.pdf 04-20-2021_Sanitary_District_Agenda.pdf 04-20-2021_Waterworks_Board_Agenda.pdf when it should be: 04-20-2021_Sanitary_District_Agenda.pdf 04-20-2021_Waterworks_Board_Agenda.pdf 04-21-2021_Board_of_Zoning_Appeals_Agenda.pdf 04-22-2021_Park_Board_Agenda.pdf 04-22-2021_Plan_Commission_Agenda.pdf 04-22-2021_Safety_Board_Agenda.pdf <?php $files = array_diff(scandir('./meeting-minutes-agendas'), array('..', '.', 'Default.php', 'Agendas', 'Police_Commission', 'Utility_Board')); sort($files); foreach($files as &$file) { $file = $file . "/" . date("Y"); } unset($file); $agendas = array(); foreach($files as $file) { $temp = glob('./meeting-minutes-agendas/'. $file . "/*Agenda.pdf"); $agendas = array_merge($agendas, $temp); } unset($files); unset($temp); sort($file); foreach($agendas as $file) { $filedate = str_replace('-', '/',substr(basename($file),0,10)); if (strtotime($filedate) >= strtotime(date('m/d/Y'))) { echo "<a href='"; echo $file; echo "'>"; $file = str_replace('.php', '', $file); echo basename($file); echo "</a><br>\n"; } } unset($file); ?>
  3. Thank you very much for your help. It works perfectly now.
  4. It only works without the w3.css. With the w3.css nothing happens, or maybe something is happening but it is covered up? I even switched to using <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css" type="text/css" media="screen"> in case my copy of w3.css was bad.
  5. I am sorry I didn't get back sooner but I had a different project I had to get today. The div.w3-modal doesn't work either. Nothing happens when I click Event1.
  6. Yes they are separate files. Now Clicking on Event1 in Events.php does nothing. Clicking on Event1 in index.php opens Events.php but does nothing. <!DOCTYPE html> <html lang="en"> <title>Special Events</title> <head> <link rel="stylesheet" href="/css/w3.css"> <style> a.w3-modal:not(:target) { display: all; } </style> </head> <body> <div class="w3-container w3-center"> <div> <div class="w3-container"> <h1 class="tinted-image-white"><b>Special Events</b></h1> </div> <div class="w3-twothird w3-padding"> <div class="w3-card w3-padding w3-round-xlarge tinted-image-white"> <p>The following is a list of Special Events.</p> </div> <br> <div class="w3-card w3-padding w3-round-xlarge tinted-image-white"> <h5> <a href="#Event1">Event1</a><br> <a href="#Event2">Event2</a><br> <a href="#Event3">Event3</a><br> <a href="#Event4">Event4</a><br> <a href="#Event5">Event5</a> </h5> </div> </div> <div class="w3-third w3-center w3-padding"> <div class="tinted-image-white w3-center w3-padding w3-round-xlarge"> <h5>Some important</h5> <hr> <h5>will be posted</h5> here later </div> </div> </div> </div> <!-- Event1 --> <div class="w3-container"> <div id="Event1" class="w3-modal"> <div class="w3-modal-content w3-animate-zoom"> <div class="w3-container"> <span class="w3-button w3-display-topright">&times;</span> <h4>Event1</h4> Event information <p class="w3-right"><a href="#">Close</a></p> </div> </div> </div> </div> <!-- Event2 --> <div class="w3-container"> <div id="Event2" class="w3-modal"> <div class="w3-modal-content w3-animate-zoom"> <div class="w3-container"> <span class="w3-button w3-display-topright">&times;</span> <h4>Event2</h4> Event information <p class="w3-right"><a href="#">Close</a></p> </div> </div> </div> </div> <!-- Event3 --> <div class="w3-container"> <div id="Event3" class="w3-modal"> <div class="w3-modal-content w3-animate-zoom"> <div class="w3-container"> <span class="w3-button w3-display-topright">&times;</span> <h4>Event3</h4> Event information <p class="w3-right"><a href="#">Close</a></p> </div> </div> </div> </div> <!-- Event4 --> <div class="w3-container"> <div id="Event4" class="w3-modal"> <div class="w3-modal-content w3-animate-zoom"> <div class="w3-container"> <span class="w3-button w3-display-topright">&times;</span> <h4>Event4</h4> Event information <p class="w3-right"><a href="#">Close</a></p> </div> </div> </div> </div> <!-- Event5 --> <div class="w3-container"> <div id="Event5" class="w3-modal"> <div class="w3-modal-content w3-animate-zoom"> <div class="w3-container"> <span class="w3-button w3-display-topright">&times;</span> <h4>Event5</h4> Event information <p class="w3-right"><a href="#">Close</a></p> </div> </div> </div> </div> </body> </html>
  7. Thank you for pointing this out. I was not aware that you could pass the onclick with a href. I have tried: <a href="Events.php" onclick="document.getElementById('Event1').style.display='block'">Event1</a><br> <a href="Events.php" onclick="Event1">Event1</a><br> <a href="Events.php" onclick="getElementById('Event1').style.display='block'">Event1</a><br> <a href="Events.php" onclick="document.getElementById('Event1')">Event1</a><br> along with a dozen other variations but I can't get it work.
  8. This is my index.php which is calling the Events.php page. What I want to happen is when the user clicks on Event1 from the index.php, it opens Events.php and brings up the Event1 information. The code I have posted does this except for bringing up the Event1 information. I have to click on Event1 in the Events.php to see the information. <!DOCTYPE html> <html lang="en"> <title>Intranet</title> <div class="w3-container parallax"> <div class="w3-container"> <h1 class="tinted-image-white w3-round-xlarge"><b>Important Events you must attend this week!</b></h1> </div> <div> <a href="Events.php#Event1">Event1</a><br> <a href="Events.php#Event2">Event2</a><br> <a href="Events.php#Event3">Event3</a><br> <a href="Events.php#Event4">Event4</a> </div> </div> </body> </html>
  9. I am sorry but I don't understand what you are looking for.
  10. http://intranet.me.local/Events.php#Event2
  11. First let me say that the only php code in the file is an include which has no bearing on my question. I have a Events.php file which uses onlclick and javascript to show upcoming events that works well. I now need to be able to call Events.php and have a specific element open from my index.php. Usually I would just add <a href="Events.php#Event2">Event2</a> but that doesn't activate the onclick which displays the information. What are my options? Here is my Events.php file: <!DOCTYPE html> <html lang="en"> <title>Special Events</title> <?php include('/website/_style_include.php'); ?> <body ONKEYDOWN="if (event.keyCode == 27){ document.getElementById('Event1').style.display = 'none'; document.getElementById('Event2').style.display = 'none'; document.getElementById('Event3').style.display = 'none'; document.getElementById('Event4').style.display = 'none'; document.getElementById('Event5').style.display = 'none';}"> <div class="w3-container w3-center"> <div> <div class="w3-container"> <h1 class="tinted-image-white"><b>Special Events</b></h1> </div> <div class="w3-twothird w3-padding"> <div class="w3-card w3-padding w3-round-xlarge tinted-image-white"> <p>The following is a list of Special Events.</p> </div> <br> <div class="w3-card w3-padding w3-round-xlarge tinted-image-white"> <h5> <a href="#" onclick="document.getElementById('Event1').style.display='block'">Event1</a><br> <a href="#" onclick="document.getElementById('Event2').style.display='block'">Event2</a><br> <a href="#" onclick="document.getElementById('Event3').style.display='block'">Event3</a><br> <a href="#" onclick="document.getElementById('Event4').style.display='block'">Event4</a><br> <a href="#" onclick="document.getElementById('Event5').style.display='block'">Event5</a> </h5> </div> </div> <div class="w3-third w3-center w3-padding"> <div class="tinted-image-white w3-center w3-padding w3-round-xlarge"> <h5>Some important</h5> <hr> <h5>will be posted</h5> here later </div> </div> </div> </div> <!-- Event1 --> <div class="w3-container"> <div id="Event1" class="w3-modal"> <div class="w3-modal-content w3-animate-zoom"> <div class="w3-container"> <span onclick="document.getElementById('Event1').style.display='none'" class="w3-button w3-display-topright">&times;</span> <h4>Event1</h4> Event information <p class="w3-right"><a href="#" onclick="document.getElementById('Event1').style.display='none'">Close</a></p> </div> </div> </div> </div> <!-- Event2 --> <div class="w3-container"> <div id="Event2" class="w3-modal"> <div class="w3-modal-content w3-animate-zoom"> <div class="w3-container"> <span onclick="document.getElementById('Event2').style.display='none'" class="w3-button w3-display-topright">&times;</span> <h4>Event2</h4> Event information <p class="w3-right"><a href="#" onclick="document.getElementById('Event2').style.display='none'">Close</a></p> </div> </div> </div> </div> <!-- Event3 --> <div class="w3-container"> <div id="Event3" class="w3-modal"> <div class="w3-modal-content w3-animate-zoom"> <div class="w3-container"> <span onclick="document.getElementById('Event3').style.display='none'" class="w3-button w3-display-topright">&times;</span> <h4>Event3</h4> Event information <p class="w3-right"><a href="#" onclick="document.getElementById('Event3').style.display='none'">Close</a></p> </div> </div> </div> </div> <!-- Event4 --> <div class="w3-container"> <div id="Event4" class="w3-modal"> <div class="w3-modal-content w3-animate-zoom"> <div class="w3-container"> <span onclick="document.getElementById('Event4').style.display='none'" class="w3-button w3-display-topright">&times;</span> <h4>Event4</h4> Event information <p class="w3-right"><a href="#" onclick="document.getElementById('Event4').style.display='none'">Close</a></p> </div> </div> </div> </div> <!-- Event5 --> <div class="w3-container"> <div id="Event5" class="w3-modal"> <div class="w3-modal-content w3-animate-zoom"> <div class="w3-container"> <span onclick="document.getElementById('Event5').style.display='none'" class="w3-button w3-display-topright">&times;</span> <h4>Event5</h4> Event information <p class="w3-right"><a href="#" onclick="document.getElementById('Event5').style.display='none'">Close</a></p> </div> </div> </div> </div> </body> </html>
  12. @Barand Thank you for the ideas. I didn't know about glob. The createFromFormat is a nice way to convert the string to a date and then change the format. Thank you again, Tim
  13. I have a folder full of documents that contain meeting minutes. Each document is named like this: Board 01-02-1977.pdf Board 01-03-1976.pdf Board 01-07-1975.pdf Board 01-09-1974.pdf Board 02-01-1978.pdf Board 02-03-1979.pdf I need to display the list sorted by y-m-d. I have it working and here is my code so far: <?php $files = array_diff(scandir('./Board'), array('..', '.', 'Default.php', 'template.php')); foreach($files as $file => $item) { $filebreak = preg_split("/(-|\.)/",$item,-1,PREG_SPLIT_NO_EMPTY); $files[$file] = $filebreak[2] . $item; } sort($files); foreach($files as $file) { $file = substr($file,4); echo "<a href='./Board/"; echo $file; echo "'>"; $file = str_replace('.php', '', $file); echo $file; echo "</a><br>"; } ?> I get an arrary of the files using scandir and get rid off the files I don't want to see. Next I take the year and append it to the beginning of the filename and then sort the array. Finally I print the results. What do you guys think? Is there a better way to do this? Did I miss something?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.