Jump to content
Larry Ullman's Book Forums

HartleySan

Members
  • Posts

    3047
  • Joined

  • Last visited

  • Days Won

    243

Everything posted by HartleySan

  1. Yes, Larry, I believe you are right. Sorry about that, Steve. I think you're also right though Larry in that it wouldn't do you much good to run a ColdFusion file through PHP anyway.
  2. Yep, the problem is exactly as I thought. You are outputting HTML before the session_start function call, which you cannot do because the session_start function modifies the HTTP headers, which can't be done after content is output to the browser. The solution is to move all of your PHP logic to somewhere before any HTML is output. Make sense?
  3. Glad you came up with a solution. A solution is better than no solution. You cannot send or modify headers after something (even a single space) has been output to the screen. I can't really help you without more details though.
  4. $color_pallettes[$ii] is only defined because you defined it as such in your for loop. By that rationale, you can execute that same for loop any time after $color_pallettes is defined, and you've got access to the data. That answer your question?
  5. That's not how .htaccess files work. You can code an .htaccess file to redirect from one URL path to another, but you can't make the Apache server treat a ColdFusion file like a PHP file. Sorry.
  6. Hello, and welcome to the forums. Does this link answer your question: http://stackoverflow.com/questions/10306999/php-convert-date-format-dd-mm-yyyy-yyyy-mm-dd
  7. Can you please give us an example of a .cfm URL that someone would go to and what you want to transform that to? Thanks.
  8. The only thing I can figure is that for some reason, your jQuery selector isn't matching any elements in the DOM. Otherwise, I can't imagine how the functionality wouldn't work and you wouldn't get any errors. If you want to set up a test site somewhere, I could look at the code more closely, but barring that, there's really not much else I can do to help. Sorry.
  9. When you say that you "still see no errors in the browser," are you viewing the console? If you had copied and pasted my code snippet into your code, then you would absolutely see something in the console, unless of course a much larger error occurred, in which case, you wouldn't see the console output because no part of the page would be output to the browser at all. If you don't know how to view the console in your browser, I definitely recommend Googling it right away. Which browser are you using?
  10. Your JS logic looks good from what I can tell, but I wonder if the fact you're placing the JS within the head element is causing it to not work. For the sake of debugging the issue, you can either place breakpoints within your code, and step through it line by line, or if you're not sure how to do that, you can try breaking your code up into smaller pieces (i.e., without the jQuery chaining), and console-log things out after each line to confirm the intended behavior. For example: $('.image .toggles img').hover(function () { var src = $(this).attr("data-src"); console.log(src); var $main = $(this).closest(".image").find(".main"); console.log($main); $main.attr("toggle", $main.attr("src")); console.log($main.attr("toggle")); $main.attr("src", src); console.log($main.attr("src")); }, function () { var $main = $(this).closest(".image").find(".main"); console.log($main); $main.attr("src", $main.attr("toggle")); console.log($main.attr("src")); }); Please do that and let us know what you find. Thanks.
  11. What errors show up in the browser console when you run the JavaScript?
  12. Yes, you're right. There is a mistake on page 298, which is noted in the errata on the following page: http://www.larryullman.com/books/modern-javascript-develop-and-design/errata/
  13. Jane, you're code is really confusing me, and I don't see any JavaScript anywhere. If you want to do this, you're going to need to use JavaScript. I would recommend storing the alternate image for each color in a data attribute of the corresponding swatches, and when a swatch is moused over, grab that data attribute and set the value as the new src attribute of the product image. That make sense?
  14. Whether it's SQL being used to get DB data, or a file handler/parser used to get XML/JSON data, the basic steps are the same (and most of them are done for you automatically behind the scenes). Regardless of the data format though, it's always a balancing act of getting enough data up-front without getting too much, and thus slowing things down unnecessarily. Nowadays, I generally get enough data up-front to handle the page load as well as a little extra to handle common interactions; anything after that is Ajax. Of course, it's always a judgment call, and I can't tell you exactly how much to do in every scenario, but usually a bit of experimentation will get you there. Good luck!
  15. Yes, weird things sometimes happen, and all I can imagine is that they're a result of some oversight on the devs' part. That's why uninstalling and reinstalling generally fixes these things. Glad it's working now.
  16. Hello, and welcome to the forums, Marie. Your understanding seems correct, but if you get data from a JSON/XML file instead of the DB, you're not really saving any time/efficiency, as you're still getting data from a file, regardless of whether the format is XML, JSON or the DB. That make sense? Certainly, if there is some data you need on page load, then it makes sense to immediately get that data via PHP/MySQL and render it on the screen, without using JS/Ajax, but for anything after the initial page load, using Ajax could be beneficial. Does that answer your question?
  17. Unless you want to force a page reload every time the user selects something, I would do this completely in JS. To do that, you'll want a JS array with all the industries, and then another (multi-dimensional) array/object that has all the skills for each of the industries. With that data, you can easily populate as many select elements as the user needs. I wouldn't do anything fancy beyond that. As for the other thing you asked about, when the user submits the form, I would check that everything is valid, and if it is, I would change a flag in the DB, which doesn't allow the user to move on to the site unless they have selected some job skills. I know my answer is a bit vague, but does that make sense?
  18. Perhaps the PHP 5.5 version you installed does not contain the MySQLi family of functions for some reason. I can't imagine why, but maybe try installing PHP 5.5 from scratch again, and see what happens. It definitely sounds like your installation is messed up.
  19. Well, I can tell you for sure that the first time someone logs in, the $_SESSION variable is not being properly set. That's the only explanation. I would guess that the issue is in login.php, but I can't say for sure. I'd maybe temporarily remove the redirect from the login.php script, post to it, and then use the three lines of code I recommended above to check the status of the $_SESSION variable throughout the script. Hopefully, you can get it from there.
  20. Does the login.php script you're submitting the form to redirect the user back to the page above upon a successful (or failed) login?
×
×
  • Create New...