Jump to content

DDmUSA

Members
  • Posts

    15
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

DDmUSA's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. The event is a seasonal thing that will only last for several dates. The sample web page that includes the dates is located here: http://mrpcweb.com/insiders/sample1/indexb.html
  2. I do not have a database in place. Let's say I have a text file with one date per line. How would I fetch the lines of text (into an array, perhaps) and then display only the dates greater than moment executed?
  3. I would like to know the best practice to achieve the following: I have a list of dates related to live events for performing artists. When someone views the web page that contains a section to display the dates, I would only want to show the dates from today into the future and not show any dates from the past. What is the best way to accomplish this? Thanks in advance...
  4. I think this code will achieve my desired result: date_default_timezone_set ( "America/New_York" ); //set timezone to Eastern. $hourmin = date("Hi"); //get 24 hour clock "hour" and 'minutes'. $currentday = date("l"); //return full text day of week $currentdate = date("l F d, Y"); //3 letter month, 1-31 no leading 0's, 4 number year, on current timestamp. if ($hourmin < 1500 && $currentday != "Saturday" && $currentday != "Sunday") { //if hour + minutes is less than 1500, and current day is not Saturday, and currentday not Sunday. $class = 'namesred'; //set class name echo "<span class=\"titlered\">Lunch Specials for <br /> $currentdate <br /> </span>"; } else if ($hourmin >= 2300 && $hourmin <=2359 && $currentday != "Saturday" && $currentday != "Sunday") { //if hour + minutes is less than 1500, and current day is not Saturday, and currentday not Sunday. $tomorrow = date("l F d, Y" , strtotime("+1 days")); echo "<span class=\"titlered\">Lunch Specials for <br /> $tomorrow <br /> </span>"; } else if ( $hourmin > 1500 && $hourmin < 2300 && $currentday != "Saturday" && $currentday != "Sunday") { //if hour + minutes is greater than 1500, and hour +minutes is less than 2300, and currentday is not Saturday, and currentday is not Sunday. $class = 'namesblue'; //set class name echo "<span class=\"titleblue\">Dinner Specials for <br />$currentday "."$currentdate <br /> </span>"; } else if ( $currentday == "Saturday" || $currentday == "Sunday") { //if currentday is equal to Saturday, or currentday is equal to Sunday $class = 'namesblue'; //set class name echo "<span class=\"titleblue\">All-Day Specials for <br />$currentday "."$currentdate <br /> </span>"; }
  5. On the daily specials page, I would like to change the title of the page based on various time scenarios: At 11:00 PM through to 2:59PM the following day for each of the weekdays (Monday through Friday), I would like to display the title: Lunch Specials for Wednesday, February 23, 2011 From 3:00 PM to 10:59 PM for each of the weekdays, I would like to display the title: Dinner Specials for Wednesday, February 23, 2011 On Saturday and Sunday, I would like to display the title: All-Day Specials for Saturday, February 26, 2011 (for example) I think I have the code correct, except for the hour between 11 PM and Midnight where I need to advance the full name for the day of the week to the next day, and the date has to advance by one as well. The code I am starting with is as follows: date_default_timezone_set ( "America/New_York" ); //set timezone to Eastern. $hourmin = date("Hi"); //get 24 hour clock "hour" and 'minutes'. $currentday = date("l"); //return full text day of week $currentdate = date("M j, Y"); //3 letter month, 1-31 no leading 0's, 4 number year, on current timestamp. if ($hourmin < 1500 && $currentday != "Saturday" && $currentday != "Sunday") { //if hour + minutes is less than 1500, and current day is not Saturday, and currentday not Sunday. echo "<span class=\"titlered\">Lunch Specials for <br />$currentday "."$currentdate <br /> </span>"; } else if ( $hourmin > 1500 && $hourmin < 2300 && $currentday != "Saturday" && $currentday != "Sunday") { //if hour + minutes is greater than 1500, and hour +minutes is less than 2300, and currentday is not Saturday, and currentday is not Sunday. echo "<span class=\"titleblue\">Dinner Specials for <br />$currentday "."$currentdate <br /> </span>"; } else if ( $currentday == "Saturday" || $currentday == "Sunday") { //if currentday is equal to Saturday, or currentday is equal to Sunday echo "<span class=\"titleblue\">All-Day Specials for <br />$currentday "."$currentdate <br /> </span>"; }
  6. Thanks for explaining my fractured or incorrect logic. Will the time zone command be processed correctly each and every time someone views the page ??? The web hosting server is a shared server with a shared PHP environment. I was noticing that the time being returned was not always Eastern time.... sometimes it was UTC.... the time of the server. Please advise...
  7. Hello again... Until I am able to learn the necessary code to fetch the desired time, I decided to change the existing code to have it based on the server time of UTC. The following code might work just fine for my situation, but I would still like to learn how to deal with the shared server environment whereby the time was not always being fetched correctly. I removed the time zone line from the original code and used the following conditional statements: if ($hourmin >= 501 && $hourmin <= 1959 && $currentday <> "Saturday" && $currentday <> "Sunday") { echo "<span class=\"titlered\">Lunch Specials for <br />$currentday "."$currentdate <br /> </span>"; echo $hourmin; } else if (( $hourmin >= 2000 && $hourmin <= 2459 && $currentday <> "Saturday" && $currentday <> "Sunday") or ( $hourmin >=0 && $hourmin <= 459 && $currentday <> "Saturday" && $currentday <> "Sunday")) { echo "<span class=\"titleblue\">Dinner Specials for <br />$currentday "."$currentdate <br /> </span>"; echo $hourmin; } else if ( $currentday == "Saturday" or $currentday == "Sunday") { echo "<span class=\"titleblue\">All-Day Specials for <br />$currentday "."$currentdate <br /> </span>"; echo $hourmin;
  8. Hello, I tried to implement some PHP code to enable a web page to show "Dinner" specials versus "Lunch" specials based on the time. The business is located in the Eastern Time Zone, so I only need to routine to work based on Eastern Time (New York). What I am noticing is that the server is processing the lines of code so fast that the command to establish the correct time for the remaining code is not always being acknowledged. This line of code appears to be processing too fast for the remaining lines of code: date_default_timezone_set ( "America/New_York" ); Is there some additional code I can put in place to make sure the correct time is always ascertained? I need the $hourmin variable to always return a combination of hour + minute based on 24-hour time and Eastern Time zone. My code is as follows: <?php $name8 = file_get_contents("test/special8name.txt"); date_default_timezone_set ( "America/New_York" ); $gethour = date("H"); $getminutes = $gettimedate["minutes"]; $gettimedate = date(); $hourmin = $gethour . $getminutes; $currentday = date("l", time()); $currentdate = date("M j, Y"); if ($hourmin < 1500 && $currentday <> "Saturday" && $currentday <> "Sunday") { echo "<span class=\"namesred\">$name8 </span>"; } else if ( $hourmin > 1500 && $hourmin < 2300 && $currentday <> "Saturday" && $currentday <> "Sunday") { echo "<span class=\"namesblue\">$name8 </span>"; } else if ( $currentday == "Saturday" or $currentday == "Sunday") { echo "<span class=\"namesblue\">$name8 </span>"; } ?>
  9. Thank you very much for solving the mystery, so to speak..... I now have a working image map. I also appreciate having learning that I can use single ticks within the HTML parameters so I don't have to escape out the double ticks.
  10. The website where I want to include the code is: collegevillediner.com/index2.html I would like to have the code replace the image map that appears on the left sidebar.
  11. Using the suggested code, I do not see the image map. What I see on the page is the following text: "; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; ?>
  12. I would specifically like to know what gets implemented to have a text field whereby the text box is a size I choose with a specific font to be used if so desired. Also, to have a field to input numbers for a time input for hours and minutes, with the colon symbol automatically appearing in the field once someone starts typing in this field. If I insert a drop-down selection using the HTML select element, the object on the screen is rather tiny. Can this appear larger when desired? How are these sorts of things accomplished?
  13. I am in the process of learning MySQL and PHP. I have a real-world application that I would like to develop for someone using MySQL and PHP, provided I can end up with the necessary user interface for the application. The user will be launching a web browser to start the application. The application will be developed for two purposes: to record employee information (name, contact info, category of worker such as: cook, dishwasher, server, host) to record the hours worked by each worker for each day and then generate a report that can be sent to the accountant by email or fax Since the interaction will take place in a web browser, what are the possibilities as far as having customization for the text fields (controllable size of text field, larger than the form element), having start and end times with the colon symbol inserted automatically, to name a few. When a text field is inserted via HTML, the rectangle is rather small. Can the default sizes of form elements be enlarged?
  14. The image map did not appear on the page. I only need one of the href values to come from a file's content within the image map. How would someone code this to happen?
  15. Hello, I have a form that ends up creating a file. The file has one of two values in the file: specials.php specials8.php Within several of my web pages, I have an image map, and I would like one of the href values to be the value that PHP would get from the underlying file. How would I code this to make the image map function accordingly? Notice the "Daily Specials" entry within the image map. It is this href that I need to become the value from the file. The unsuccessful code that I tried is: <?php $file38a = "test/activate.txt"; $file38b = file_get_contents("$file38a"); echo "<img src=\"sample2/sidebar1.jpg\" alt=\"Collegeville Diner\" width=\"94\" height=\"330\" border=\"0\" align=\"top\" usemap=\"#Map2\" longdesc=\"http://collegevillediner.com\" />"; echo "<map name=\"Map2\" id=\"Map2\">"; echo "<area shape=\"rect\" coords=\"8,102,88,152\" href=\"about.htm\" target=\"_self\" alt=\"About the Diner\" />"; echo "<area shape=\"rect\" coords=\"7,159,90,204\" href=\"menu.htm\" target=\"_self\" alt=\"Our Menu\" />"; echo "<area shape=\"rect\" coords=\"7,214,90,262\" href=\"$file38b\" target=\"_self\" alt=\"Daily Specials\" />; <area shape=\"rect\" coords=\"0,275,86,320\" href=\"desserts.htm\" target=\"_self\" />"; echo "</map>"; ?>
×
×
  • 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.