Ingolme

Moderator
  • Content count

    12,930
  • Joined

  • Last visited

  • Days Won

    310

Ingolme last won the day on May 3

Ingolme had the most liked content!

Community Reputation

774 Excellent

4 Followers

About Ingolme

  • Rank
    Foxy Mod

Previous Fields

  • Languages
    Javascript, PHP, MySQL

Contact Methods

  • Website URL
    http://www.thecodingfox.com/
  • ICQ
    0

Profile Information

  • Gender
    Not Telling
  • Interests
    Web development, drawing, videogames, foxes.

Recent Profile Visitors

158,651 profile views
  1. The W3Schools staff don't read the forums. If you found a mistake on one of the pages, scroll down to the bottom of that page and click the "Report error" link.
  2. PHP doesn't work that way that I can remember, that's a Java thing. You can do an experiment to confirm.
  3. None of the syntax would have to change, he's already doing everything correctly. I assume that when PHP sees an assignment to an undeclared property it creates the property, from that moment onward everything's the same as if the property had been declared. The only thing I notice that won't work is that he's calling a method get_feed_items() which doesn't exist.
  4. I'm not sure what your question is. You seem to know how to use iframes, so you can just create a page with 10 iframes.
  5. Set the line-height to 200px, that will keep the text in the middle. This won't work if you need more than one line of text.
  6. Your questions seemed to be about what is a good practice. I believe that's already answered. If that code is working for you then there's no need to change it. The properties exist in his code and are being used correctly, the only problem is that he didn't declare them, which PHP seems to allow. The constructor is creating them using the arrow "->" syntax. The only change necessary would be to declare those properties. class rss_feed { // Declare properties here: private $db_settings; private $xmlns; private $channel_properties; private $site_url; private $site_name; private $full_feed; /** * Constructor * * @param array $a_db database settings * @param string $xmlns XML namespace * @param array $a_channel channel properties * @param string $site_url the URL of your site * @param string $site_name the name of your site * @param bool $full_feed flag for full feed (all topic content) */ public function __construct($a_db, $xmlns, $a_channel, $site_url, $site_name, $full_feed = false) { // Assign to properties here: $this->db_settings = $a_db; $this->xmlns = ($xmlns ? ' ' . $xmlns : ''); $this->channel_properties = $a_channel; $this->site_url = $site_url; $this->site_name = $site_name; $this->full_feed = $full_feed; }
  7. What he's listing in the comment are the function parameters, not the class properties. However, he hasn't declared the class properties in the class definition. Although PHP might let that slide, it's not a good idea. You should declare class properties outside of the constructor. For XML based applications I would recommend against using strings for it. I use DOMDocument to generate XML for me.
  8. What code are you using to include these files?
  9. You validate the length before hashing it. There's no reason to do anything with a password after it has been hashed outside of comparing it to another hashed string.
  10. You don't encrypt passwords, you hash them so that the information is irrecoverable. Since passwords are never printed anywhere, any character is valid because there is no risk of injection.
  11. This code won't run, those are syntax errors, except the ones that are outside the <?php ?> tags. It looks like something that passed through some other software and is supposed to be stripped out before running.
  12. Start off by reading the CSS tutorial.
  13. With pure Javascript there's a window method called saveAs() which isn't widely supported by browsers. I can't see any reference to this method on the MDN so I'm not even certain if it's a standard. Somebody built an example with a cross-browser polyfill here: https://codepen.io/davidelrizzo/pen/cxsGbI It's not exactly a library, just a fallback function that's used if the browser doesn't have native support. If you have a server-side language available you can submit a form to an invisible iframe, have the server generate the data and serve it with a "Content-Disposition: attachment" header. Here's a very simple PHP example: <form action="save-file.php" method="POST" target="filesaver"> <div> <label>Filename: <input type="text" name="filename"></label> <label>File content: <textarea name="data"></textarea> </label> <button type="submit">Save</button> </div> </form> <iframe name="filesaver" width="1" height="1" frameborder="0"></iframe> <?php // This is save-file.php $data = $_POST['data']; $filename = $_POST['filename']; header('Content-Disposition: attachment; filename="' . $filename . '"'); echo $_POST['data']; ?>
  14. This sounds like a very bad way to build a website. You really would be best off rewriting the HTML, but if you only want to target elements with a particular attribute value, use the attribute selector: font[size=6] { font-size: 18px; line-height: 18px; font-family: Verdana, sans-serif; }
  15. The parameters in the for loop are optional. There are several ways to solve the problem. You can add the x right before appending to the string: txt += "input" + (i + x) + "<br>"; You should cast x to a number before the loop to prevent it from being used as a string.