Jump to content

KevinM1

Moderators
  • Posts

    5,222
  • Joined

  • Last visited

  • Days Won

    26

Everything posted by KevinM1

  1. Static methods are useful when you need some functionality, but don't need an object afterwards. Factories often use static methods because most people want the object created by the factory, not the factory itself. There was a larger conversation about this here: http://www.phpfreaks.com/forums/index.php/topic,206892.0.html
  2. Ah, didn't see the absolutely positioned divs in the OP's code.
  3. This may or may not be the issue, but put your form attributes (i.e. action) within quotes (action="mypage.php"). Also, register_globals doesn't do what you think it does, and can be dangerous to have on from a security standpoint. It's best to leave it off.
  4. Are you calling session_start() at the beginning of your code?
  5. Can you show us more code?
  6. Are you sure that $_GET['t'] has a value?
  7. Try: <script type="text/javascript"> window.onload = function() { var path = "mysite.com/imgs/"; var pictures = new Array( "img1.jpg", "img2.jpg", "img3.jpg", "img4.jpg", "img6.jpg", "img7.jpg", "img8.jpg", "img9.jpg", "img10.jpg", "img11.jpg"); var count = 0; var rotator = document.getElementById("rotator"); rotator.onload = function() { setTimeout(rotatePics(), 5000); } function rotatePics() { if(count == 11) { count = 0; rotator.src = path + pictures[count]; } else { count++; rotator.src = path + pictures[count]; } } } </script> . . . <img src='imgs/img1.jpg' id='rotator' /> One nitpick: the <center> element is deprecated. Don't use it if you want valid code.
  8. It's not hard to be specific with CSS. That's why it has class selectors. And how does putting image dimension info in the markup itself help SEO? Finally, if a browser doesn't understand basic CSS1 dimension properties, it's not worth developing for. That sort of irrational fear of developing for those fringe users who still think it's 1999 is a pet peeve of mine - I cringe when I see people throw JavaScript in HTML comments, too. In any event, using CSS to modify a lot of images' sizes strikes me as lazy/sloppy design. Why? Because you're not actually shrinking the image. You're merely telling the browser to modify the way the image is displayed. If you have a 500 x 500 image, and tell it to display as 250 x 250 (or smaller, for a thumbnail), all of the info of the 500 x 500 image is still transmitted. A lot of wannabe web developers tend to go that route, preferring to force the browser to render the image differently in different situations, not realizing they're killing their own bandwidth in the process.
  9. Actually, you're right: http://www.w3.org/TR/REC-CSS2/visuren.html#positioning-scheme And, no, you don't need position: relative to center something on the screen. Merely putting margin: 0 auto will suffice.
  10. A quick code example to show a common centered fixed-width two-column layout: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>Layout</title> <style> #wrapper{ width: 800px; margin: 0 auto; border: 1px solid black; } #header{ width: 800px; border: 1px solid blue; text-align: center; } #nav{ width: 20%; padding: 2px; float: left; border: 1px solid green; } #content{ width: 78%; padding: 2px; float: left; border: 1px solid red; text-align: center; } #footer{ clear: both; width: 800px; border: 1px solid purple; text-align: center; } ul{ list-style-type: none; margin: 0; padding: 2px; } li{ border: 1px solid gray; } </style> </head> <body> <div id="wrapper"> <div id="header">Put header image here.</div> <div id="nav"> <ul> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> <li><a href="#">Link</a></li> </ul> </div> <div id="content">This is where your main content would go.</div> <div id="footer">This is where your footer info (copyright, etc) would go.</div> </div> </body> </html> In a real-world setting, the CSS would be in its own separate file, but I kept it here so you can see what I did. As you can see, there's much less HTML here than in your original code. Also, if you use an external style sheet (that is, if you put all of the CSS in a separate file), then you can have one file supplying the formatting for your entire site, which, again, saves you on writing/debugging code. I also hope this helps hopelessX. There's no need to pull fancy positioning/margin tricks to center an element on the page.
  11. Have you tried jQuery's noConflict function? http://docs.jquery.com/Core/jQuery.noConflict
  12. ive seen them do that alot, esewpecialy client side scripsts with web apps. Except the JavaScript source code isn't actually written without whitespace. Instead, it's written normally, meaning in a normal coding style so it can be read/edited, then it's either minified or packed when it's ready to go live. No one in their right mind intentionally writes code without whitespace.
  13. I only have time for a quick reply. Put everything, including navigation, in a 800px wide wrapper div. So: #wrapper{ width: 800px; margin: 0 auto; } The auto margin tells it to center itself. Next, a div for the header image: #header{ width: 800px; } For the navigation, use another div. Give it the width of your link images and 2px padding all the way arround. You need to float it to the left so it goe to the right place: #nav{ width: /* however wide your link images are */ padding: 2px; float: left; } Finally, for the main content, create a div with a width of 800px - the width of the navigation, and float it left as well: #content{ width: /* 800px - the width of the navigation */ float: left; } That should more or less give you a centered layout.
  14. Right now, since you're getting your feet wet with CSS, you should probably stick with the table layout. CSS layouts aren't hard to construct from a pure coding point of view (in fact, they're easier, which is one of the prime reasons why that method is prefered), but from a conceptual standpoint, CSS layouts tend to give newbies trouble. If you're interested in trying it anyway, read up on the Box Model and CSS positioning. You might want to consider changing your font in some sections. It looks okay on the bigger things, but with the shirt info and especially the contact info, it looks pretty cluttered and hard to read.
  15. Right off the bat, I notice that you have a lot of wasted screen space. I have a decently sized screen (1440 x 900), and about half of my browser window is empty yellow space. Why not center it all? Since you're going for a fixed-width look, center it, and do something to visually separate the functional part of the site from the background (border, slight drop shadow, something). In fact, I think you should tone down the yellow. It's not fun to look at for any length of time. You don't want to annoy/blind potential customers. As for the rest... The most beneficial thing I can say is that if you're really serious about doing this for a living, then you should learn the technologies behind it. At the very least, you should learn HTML, Cascading Style Sheets (CSS), and rudimentary JavaScript. Why? Because relying on a program to do all the technical work - even one as good as Dreamweaver - results in inefficient, and even ugly, code. Your page, for example, could be built with much less overall code. Those mouseover effects you have? There's no need to have dozens of lines of JavaScript to create those. It can be done simply with a few lines of CSS. The same goes for the overall layout. Tables really aren't used for layouts any more. Instead, <div> blocks, positioned and arranged with CSS, is considered to be best practice. I don't say this to discourage you. Hell, your first attempt here is much, much better than my first few attempts. So, keep at it, and keep learning. Your sites will improve even more with time.
  16. Well, you have to remember that a <span> is an inline element. To create a box for a tooltip, you're better off by using a <div>, which is a block element. But yeah, a CSS styled <div> should be what you're looking for.
  17. Not a problem. I had the feeling I wasn't explaining it very well, so I was hoping you'd try doing it yourself.
  18. Huh? This doesn't make much sense to you: User::promote('Bob'); ? It depends on what you're trying to do. Right now, you're telling the class User to promote the string Bob. What does promote do?
  19. Static variables/methods are in the context of an entire class, not an individual object. They're commonly used with factories, where you want to get the result of a method without instantiating an object to do so. Somethng like: $myChar = CharGenerator::makeChar("mage"); You don't want to deal with a CharGenerator object itself. Rather, you just need the results from one of its methods. Your example of promoting a user doesn't really make much sense. Why? Because there's no User object that retains that promotion. Instead, the User class as a whole gets that promotion. That's why using a normal method is important: $Bob = new Employee("Robert", "Johnson"); $Bubba = new Employee("Bubba", "Smith"); $Bob->promote(5.25); $Bubba->promote(2.35); class Employee { private $firstName; private $lastName; private $hourlyWage = 10.00; public function __construct($firstName, $lastName) { $this->firstName = $firstName; $this->lastName = $lastName; } public function promote($newWage) { $this->hourlyWage += $newWage; } } Using a static method in this case wouldn't really make any sense, and wouldn't produce the results you wanted.
  20. Slashes/escaping != HTML elements. Use either htmlentities or htmlspecialchars. Htmlentities: http://www.php.net/manual/en/function.htmlentities.php Htmlspecialchars: http://www.php.net/manual/en/function.htmlspecialchars.php
  21. I don't think that corbin's comment was based on $_REQUEST not working, but rather on it being somewhat vague compared to the specific super-globals $_GET and $_POST. In terms of function, it doesn't really matter, but semantically it's different than the other two options. Not a big deal if you're the only one working on the code, but if someone needs to track if values are being passed in by GET or POST, it may cause a problem. As for the other, just remember that when you want to access an object's properties or methods from within the object itself, you need to use the 'this' keyword. Otherwise, you're merely creating a local variable.
  22. What do you mean by "Can I just use CSS within the <span></span> tags?" In any event, you are close. You'll need to use the text() function in order to obtain the text from the list elements so you can put it in the span/div you want.
  23. Sounds like you're trying to exploit something to me.
  24. To fix your errors not being output, use $this->errors.
  25. Direct from the source - The API reference on the left has examples of all of its functions in use: http://docs.jquery.com/Main_Page
×
×
  • 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.