Jump to content
Larry Ullman's Book Forums

DaveCoast

Members
  • Posts

    9
  • Joined

  • Last visited

  • Days Won

    1

DaveCoast last won the day on November 9 2012

DaveCoast had the most liked content!

DaveCoast's Achievements

Newbie

Newbie (1/14)

3

Reputation

  1. Great, glad it's working and glad you mentioned the PHP books - I'm planning on heading to the Advanced OOP PHP book next - just about finished with this one. That does bring up an interesting question - is the value property only available with form fields? Does it just not make any sense to try and set the value property on a DIV element as tried above. I do remember reading about innerHTML risks vs innerText/textContent and some stuff regarding a separate text node (guess I'll have to review that chapter). Does anyone have a good explanation about how they approach setting various values?
  2. What happens if you step through the Javascript in debug? Are you using FF Firebug? Any console errors? Do you see your XHR Get in the console?
  3. I look at it this way: Your site must provide basic functionality to the lowest common denominator that you wish to support (like older IE and people that have Javascript disabled). Once the basics are working you can then progressively enhance your site with spiffy features for those visitors that have the supporting technology. For example, if you have a form - the fields are validated and processed with standard php which would work without Javascript. Then your Javascript can take over (when available) and say skip the old php stuff I've got it covered (hence preventing default behavior - another key concept from the book - at least to me).
  4. Finally got it resolved with my hosting provider - 10 hours and painfully trying to get them to understand the issue. The solution is granting SELECT access to table mysql.time_zone for all of my MySQL accounts. Now it's time to progressively enhance my auction site with the spiffy stuff.
  5. Help - My logged in formatted dates (closed or submitted) are NULL in my sql result set. This only happens on my shared host site (local XAMPP works fine). FYI - I did execute my SQL request with the CONVERT_TZ via phpMyAdmin and that is where I see my column value = NULL. Is there some kind of time zone feature I need to have my hosting provider enable or is this a setting I should be able to set myself or is it time to find a new provider? I'm currently testing the PHP only (non JS) version. All seems to be working fine on my local dev box (XAMPP on Win7). Just for fun - I ftp'd the site up to an Addon Domain on my shared host - MyTestSite with user01/user01pass or user02/user02pass. Here's the SQL setup: // Set the time zone if visitor is logged in $localDateClosed = setItDateClosedTimeZone(); $sql = " SELECT itId, itItem, COALESCE(MAX(btBid), itOpeningPrice) as sqlPrice, IF($localDateClosed < DATE_ADD(UTC_TIMESTAMP(), INTERVAL 24 HOUR), DATE_FORMAT($localDateClosed, '%l:%i %p'), DATE_FORMAT($localDateClosed, '%M %D @ %l:%i %p')) as sqlClose FROM ch15itemtable LEFT JOIN ch15bidtable on itId = btItemId WHERE itDateClosed > UTC_TIMESTAMP() GROUP BY itID ORDER BY itDateClosed ASC"; Here's the timezone setup code: <?php function setItDateClosedTimeZone() { if (isset($_SESSION['utTimeZone'])) { $tz_column = "CONVERT_TZ(itDateClosed, 'UTC', '{$_SESSION['utTimeZone']}')"; } else { $tz_column = 'itDateClosed'; } return $tz_column; } function setBtDateSubmittedTimeZone() { if (isset($_SESSION['utTimeZone'])) { $tz_column = "CONVERT_TZ(btDateSubmitted, 'UTC', '{$_SESSION['utTimeZone']}')"; } else { $tz_column = 'btDateSubmitted'; } return $tz_column; } ?> Thanks - I appreciate the knowledge gleaned from this forum, Dave
  6. Nice explanation of the function reference - thanks. A couple of follow up questions: Does this mean that you cannot pass an argument to a function referenced on an event handler - or rather is there a way to pass arguments? Also, is the optional event object (commonly "e") the only available argument to event listener functions?
  7. I think the error is the last line of code in the window.onload anonymous function. var themeSet = COOKIE.getCookie('theme'); // theme is our cookie's literal name if (themeSet) { setTheme(themeSet) // Set Theme when cookie exists }; The function to call is setTheme() not setThemeCookie(). You just retrieved the cookie so it doesn't make sense to reset the cookie. We want to set the theme based on the cookie value.
  8. If the previous theme does not show after shutting down the browser then the code is not working (he said with a friendly smile). The e variable in the function setThemeCookie(e) is the event object (see Chapter 8 Advanced Event Handling). It's value happens when one of the event listeners in the window.onload anonymous function is triggered (clicking on the link). document.getElementById('aThemeId').onclick = setThemeCookie; From the event object we use the preventDefault() method to keep from following the href URL, the .target property to know which link was clicked and .id property to get the actual element id attribute from the HTML. Regarding not showing the correct theme after shutdown nothing pops out in your code as bad (you are missing the semi-colon on line 6 - which doesn't matter on my chrome or firefox browsers). It does sound like something is wrong in either storing your cookie or retrieving it. You don't show your COOKIE code - I would check that out and run through firebug if you can and it should be pretty easy to find the flaw. Do you have any console errors? Hope that helps a little - Dave
×
×
  • Create New...