Jump to content

KevinM1

Moderators
  • Posts

    5,222
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by KevinM1

  1. I think you'll find that a lot of us are self-taught. PHP has a low bar for entry, so you should be able to learn it on your own if you stay disciplined. You'll need good resources, though. Since PHP is so popular, there are a ton of free tutorials floating around out there. Unfortunately, a lot of them are crap. I find that it's better to have a small, solid library of books than to jump from tutorial to tutorial. Here's what I'd use: Start with the official online manual: http://www.php.net/manual/en/langref.php Use this book as a companion: http://www.amazon.com/PHP-World-Wide-Web-Second/dp/0321245652/ref=sr_1_17?ie=UTF8&qid=1305891226&sr=8-17 It's old, but it teaches the fundamentals. Once you're comfortable there, it's time to get serious with this book: http://www.amazon.com/Objects-Patterns-Practice-Experts-Source/dp/143022925X/ref=sr_1_1?ie=UTF8&qid=1305891305&sr=8-1 For 'graduate' work, see this book: http://www.amazon.com/Design-Patterns-Elements-Reusable-Object-Oriented/dp/0201633612/ref=pd_sim_b_39 This track should get you from beginner to capable. Be sure to actually write code while you progress. There's nothing as useful as getting the concepts and examples found in these resources to work. Finally, stay away from w3schools. It's not affiliated at all with the W3C, and contains incorrect information.
  2. It depends on what you want to aim for. Web browser? Either Flash/Actionscript, Java, or JavaScript + HTML 5. XBox Live? C# with the XNA framework. A more robust console experience? C++. PC? C++ or Python.
  3. This topic has been moved to PHP Freelancing. http://www.phpfreaks.com/forums/index.php?topic=333553.0
  4. I believe it would still be in memory, but I'm not 100% certain. Static methods should only be used if you don't need to retain state. They're used pretty frequently with the various factory patterns. A common example would be something like: $user = UserFactory::findById(549); UserFactory::findById() would accept an integer id as a parameter and return a User object. The method is static because the factory itself does not have to retain any data after a User is created. It simply takes raw material (an integer id number) and returns a useful product (a User object). Just like a factory in real life.
  5. KevinM1

    goto

    When I was trying to get my CS degree, 'goto' was considered a four letter word. If you're thinking about using it, your design is bad.
  6. The code you saw was invoking a static method. It also looks like old, PHP 4 code as it returns a reference (the '&' symbol), which is very rarely used in PHP. http://php.net/manual/en/language.oop5.static.php You can't do something like: $obj = class:); Because it makes no sense, logically. A constructor creates a new, singular object of its class. Static denotes class functionality that is invoked without an object.
  7. Have you tried alert(x[0].coord); ?
  8. Download and install Firefox, Chrome, or Opera?
  9. Your input id is clientFName, but the input name is yourname. $_POST uses input names, not ids, as its element keys, so you have no $_POST['clientFName'] input according to PHP. You either need to change the input name in your HTML or change the key to $_POST['yourname'] in your validation code.
  10. PHP is not interactive. It has no concept of events, and cannot react to a user doing something to the rendered output. All PHP does is respond to HTTP requests - GET or POST - and that requires a page load, either a refresh or a new load based on the user being redirected to another page.
  11. Look into the MVC pattern. Better yet, look at frameworks which implement the pattern (Code Igniter, Kohana, Zend Framework, etc.).
  12. It's not that one can do something better than the other, it's that each offers different capabilities, and each is used for different purposes. PHP is a back end processing language. As such, it's responsible for handling data requests (saving/retrieving data from a database) and showing the results of those requests. JavaScript is a language primarily used to manipulate the Document Object Model (DOM) of an HTML page. It's essentially used as a user interface scripting language, which allows sites to be more interactive. The two languages are used together with AJAX, which allows you to send a request to your PHP script through JavaScript, and then process the return data with JavaScript, removing page refreshes from the process. That is how apps like Google Maps work.
  13. Yes: $myArr = array("Hi", "I'm", "an", "array"); $an = $myArr[2]; echo $an;
  14. We have a list of web hosts in this thread: http://www.phpfreaks.com/forums/index.php?topic=117475.0 I use ICDSoft: http://www.icdsoft.com/ Very affordable, and a great, no nonsense control panel. For content management systems, Joomla is probably the biggest, but there are others. You can test some out for free here: http://php.opensourcecms.com/scripts/show.php?pagenumber=1 The list is ordered according to popularity. I've used Joomla and PHP-Fusion, but not for e-commerce, so I can't comment on how they perform there.
  15. KevinM1

    AJAX tut

    You may want to look at the w3fools site again, as it isn't just a warning about certifications. w3schools is a flawed resource, as they get a lot wrong. Mistakes, bad practices, wrong information, etc. There are better resources out there. In fact, w3fools lists them. Here's all you need to know about AJAX, straight from the people who make JavaScript: https://developer.mozilla.org/en/AJAX
  16. If Weebly won't cut it for you, you should look into a more robust system. You can get great open source hosting for cheap ($5-$7 a month), and there are a host of quality content management systems out there that are also free.
  17. First impression - not a fan. Crits: 1. Your header image. Your 'Ecco Lights' font is blurry and hard to read. Further, your image doesn't stretch, so on any reasonably modern monitor, it ends abruptly. If you're going for a fluid layout, your header needs to be fluid, too. 2. Typography blunders abound. First, italics are supposed to be used for emphasis. Having all of your text italic is overkill. It also makes it hard to read. Second, you use center justify for your text, which only exacerbates the problem. Readability is key, and you're forcing your potential users' eyes to jump around, negating any sense of flow. Finally, text should be black. High contrast makes it easier for people with vision problems to read what you write. 3. There's no real sense of structure. You have a huge gap between your navigation and your content. Your center justified text only adds to the chaos. Your padding or margins also appear to be uneven. Your mailing list box is closer to your main content than your main content is to the left side of the browser window. 4. Your footer is all but impossible to read. Gray text on a gray background does not work. I'm not trying to be harsh for the sake of it. It looks like it was built using a free service, which it was, and I just expect more from a site which is, ultimately, asking for someone's hard earned money. You need to put at least as much work into this as the products you sell. Do your homework. Look at other small business e-commerce sites. Look at how they structure their pages. You don't need complicated graphics, but you do need to provide structure, clarity, and an overall sense of familiarity to your potential users. They need to be able to navigate and, more importantly for you, order products without having to think about it. Thought = a user who likely won't be coming back. I'm not sure how flexible Weebly is, but you should really try to address the problems as best you can within its framework.
  18. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=333337.0
  19. Amazingly, PHP Coding Help != JavaScript Help. This topic has been moved to JavaScript Help. http://www.phpfreaks.com/forums/index.php?topic=333336.0
  20. Have you checked your file/folder permissions?
  21. Look at your text highlighting with the code you just posted. You're missing the opening ' in your first include statement.
  22. PHP is not like JavaScript. PHP is run on the server, JavaScript in the browser. As such, PHP has no notion of a submit event (or any DOM event). By the time your form is displayed on the screen, your PHP script has finished running. You need something along the lines of: <?php session_start(); function checkContent() { $errors = array(); if (empty($_POST['name'])) { $errors['name'] = "Please enter your name"; } else { $_SESSION['name'] = $_POST['name']; } if (empty($_POST['favcolor'])) { $errors['favcolor'] = "Please enter your favorite color"; } else { // store favcolor in a cookie } if (count($errors) > 0) { foreach($errors as $error) { echo $error . '<br />'; } } else { echo "Go to <a href='http://localhost/webadv1011/PHPCookiesSessies/sescook2.php'>next page</a>"; } } if (isset($_POST['submit')) { checkContent(); } ?> <form name="color" method="post" action="<?php echo $_SERVER['PHP_SELF'];?>"> <p>Name: <input type="text" name="name" /></p> <p>Favourite color: <input type="text" name="favcolor" /></p> <p><input type="submit" name="submit" value="send" /></p> </form> I left the cookie-setting bit for you to do.
  23. According to YSlow, your images still take up the bulk of your load time - 1.24 seconds. You have 40 images with a total file size of 2.9 MB. In contrast, your entire site takes 54 requests, and has a file size of 3.0 MB. So, it's pretty clear that the images are the bottleneck. The largest are: frame2.jpg - 303.8 kb italyx.png - 308.6 kb scrollx.png - 339.6 kb You should see if you can make CSS sprites in order to cut down on the number of requests the browser needs to make in order to display your background images. CSS sprites are a lot like using a classic sprite sheet in computer animation. You have one background image with all or most of your background elements, and you use CSS to move and position it just so for each element. More info here: http://www.alistapart.com/articles/sprites http://css-tricks.com/css-sprites/ Finally, your SpryHTMLPanel.js and corresponding CSS files cannot be loaded. I'm getting a 404 with them.
  24. In your functions group, you should really have it say "Explain why global variables are bad practice." Using globals to pass parameters into a function is a surefire sign that the person writing the function doesn't know what they're doing. Also, I have to question the inclusion of image creation in your list. Why include that but not the ubiquitous topic of database handling?
×
×
  • 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.