Jump to content

Ingolme

Moderator
  • Posts

    14,901
  • Joined

  • Last visited

  • Days Won

    177

Everything posted by Ingolme

  1. This does not look like code from any database library I'm familiar with. You're at high risk of hacking through SQL injection because you're putting user input straight into the query. Wherever in your code the database object's fetch() method is, you would put the loop there.
  2. You're going to have to build this using either Javascript's Canvas API or PHP's GD library or ImageMagick library. Both Javascript and PHP solutions will require a considerable amount of work and advanced programming knowledge.
  3. Ingolme

    PHP mail

    The only problem I see is that you're sending the mail twice. What happens when you run the code?
  4. If Google thinks that your site description is too short it just makes up one that it likes better. Make your page descriptions long and descriptive.
  5. Don't use a button element, instead give the btnMenu class to the link itself.
  6. Make sure that any PHP errorson your site are fixed and the only thing you can do is to wait for Google to crawl it again and hopefully your site will not be broken when that happens. Google webmaster tools may have something to speed up the process.
  7. Since they use the float property text align has no effect. To center the menu you will have to remove the float property and set the display of the menu items to inline-block. Then you can use text-align on the container.
  8. The problem is likely that you're mixing tabs and spaces. Use either one or the other. Not all editors have the same size tabs which is why your indentation goes wrong when pasting it on the forum.
  9. The style element only changes the appearance of the page, not the data or content. You will need to write Javascript code to check the innerWidth property of the window when the page is loaded or resized.
  10. It would be a good idea to explain the solution you proposed, otherwise nothing will be learned. If I'm remembering correctly, the NC flag makes the rule case-insensitive.
  11. Use inline elements inside the paragraph, like <span> instead of <div>.
  12. Elements hidden by CSS are still in the DOM and can still be accessed by Javascript. If there are values in the AJAX response that shouldn't be on the page, then don't put it on the page. You can store the result of an AJAX request in a variable instead of printing it.
  13. If you decide to go with that approach, it is. The server would return a JSON structure a bit like this: { "html" : "<div class=\"something\">Some content</div>", "stylesheet" : "/css/style.css" } There are hundreds of potential solutions, that's just one of them. Programming is about identifying and solving problems. I'm not saying this is the best solution for your project, it is just one of them.
  14. I'm don't know how your entire website is structured. Are you using a content management system? Whichever system you're using, it should provide a way to modify content in the head of the page. The browser should only see one <head> element per document, otherwise your HTML is invalid. If you want to add a stylesheet after an AJAX call, you can generate it using Javascript. Have the server return the URL of the stylesheet and have Javascript use the URL to generate a <link> tag. // Assuming AJAX returned a JSON object in the data variable if(data.stylesheet) { var link = document.createElement("link"); link.rel = "stylesheet"; link.href = data.stylesheet; document.getElementsByTagName("head")[0].appendChild(link); }
  15. I would recommend against it. Since not all browsers support the scoped attribute you'll find that in some browsers your CSS is applying to elements outside of your scoped area. Aside from that, doing it this way means your CSS is scattered all over the place which is harder to maintain. If you don't have a <head> section then where is all the metadata for your page?
  16. The only advice I'd give is to not generate the stylesheet with PHP since you want the stylesheet to be cached by the user's browser. Outside of that, it really doesn't matter. It's common to have PHP compile a list of necessary stylesheet URLs and then have the template create <link> tags for them in the <head> section. With this approach, different sections of your program can append stylesheets to the list if they need one of their own.
  17. I suspect that your iPad's browser is very out of date. From your screenshot I would guess that it does not support the CSS transform property.
  18. I disagree. From my experience, general-purpose content management systems often fail to meet requirements and often get in the way when trying to code a solution. Their main purpose is to provide a way to make website to those without coding skills.
  19. You're trying to compare objects again. These objects cannot be compared using < or >. Get the timestamp from them using ->getTimestamp() and compare those. I still suspect that the dates you're getting are Monday today and Sunday next week, but you can find that out very easily by printing their values: echo 'Start: ' . $start->format('M d') . "\n<br>"; echo 'End: ' . $end->format('M d') . "\n<br>";
  20. I would guess that Sunday is six days after Monday. According to the manual: http://php.net/manual/en/datetime.formats.relative.php Weeks always start on Monday. A weekday name moves to the next day of the given name.
  21. The DateTime objects can't be compared with the usual comparison operators because they're not primitive data types. Compare their timestamps instead: $dtA->getTimestamp() > $dtB->getTimestamp()
  22. Vertical-align only applies to inline elements, inline-blocks and table cells. If you want the "1" further up, try reducing the line-height.
  23. The easiest solution would be to set the textarea to readonly by giving it a readonly attribute. You can style it to not look like a text area by giving it a transparent background and no border. If you actually want to copy text from an element that's not a textarea I would actually have to do some tests to see what the browsers do and don't allow.
  24. I can't tell for sure why that's happening just from the screenshot, I would need to actually see the image and code, or the page itself, in order to be sure. If that is a background image which is not extending to the full width of the element then it means the image is not large enough, you can set the background-size to "100% auto" (100% wide and height adjusts based on the image's aspect ratio) or center the image if you prefer. If the background image is large enough and is actually reaching the full size of the container then that means something is getting outside of the container and you would need to find out why.
  25. I am not entirely sure what exactly you're trying to argue for. You bring up the fact that we have billions of colors but still seem to want to use names to select them. No matter how many human-readable names you give to these colors the set of named colors will only ever be a minuscule subset of all the colors that are available. The only way to have full color freedom is by referring to them through numbers. Named colors, while good for communication between humans, are not good at all for actually identifying colors. When you tell somebody "blue" it does not say anything about exactly which shade of blue you're referring to. If somebody asks you to make their website blue, which color are you going to use? Blue Blue Blue Blue Blue When people are selecting a color for paint or a light bulb, somebody has to provide them with a sheet showing all the available colors and allowing them to pick one, or in online businesses you present them with a color picker. The color they end up selecting will most likely not have a specific name but rather an identifier and on the web, that identifier is almost always a color code in RGB format. I'll repeat that X11 is not a web standard, it is merely mentioned in a W3C document ( https://www.w3.org/TR/2002/WD-css3-color-20020418/#x11-color ). The document shows a list of X11 color names that are supported by popular browsers at the time of writing, but the specification neither requires the browsers to support them nor guarantees that this support will continue in the future. Again, it's not really clear exactly what you're asking for, could you summarize your idea in one sentence?
×
×
  • Create New...