Jump to content

Jacques1

Members
  • Posts

    4,207
  • Joined

  • Last visited

  • Days Won

    209

Everything posted by Jacques1

  1. 12 p. m. in what time zone? The user's zone? The server's zone? Some other zone? Assuming the user's local time: Get the difference in milliseconds between the target time and the current time, then set a timeout for this difference. popUpTime = new Date(); popUpTime.setHours(12); popUpTime.setMinutes(0); popUpTime.setSeconds(0); popUpTime.setMilliseconds(0); now = new Date(); setTimeout(function () { alert("Oh hai."); }, popUpTime - now); I hope you're not actually using an alert(), because that's one of the most annoying misfeatures ever invented.
  2. Names do matter, because they tell us (and you) what the class is supposed to do. So a User is now responsible for authentication? The problem is that your class is little more than a container of functions. You've delegated the heavy lifting to the caller which has to execute the functions one after another, following an (unknown) protocol. It should actually be the other way round: The class is responsible for performing the task. If I'm the caller, it's not my job to look up table fields in your database. Chances are I don't even know those fields. I just want to know if a specific username/password combination is valid, so I expect a method like this: /** * Checks whether a username/password combination is valid * * @param string $username the username to be checked * @param string $password the corresponding password * * @return boolean the result of the check */ function check($username, $password) Now it's up to the class to go through all necessary steps (query the database, hash the password etc.) This is also what public/protected/private is about: A class has a public interface, consisting of all public methods and attributes. This is what gets exposed to the caller and what you would put into the documentation. Then there may be dozens of other methods and attribute which are only relevant for the inner workings of the class. This is what you make private (or protected), effectively hiding it from the caller. I't generally a good idea to start with the public interface: How is the caller supposed to interact with the class? What are the features? Then you take care of the implementation.
  3. By using a mock object instead of an actual PDO instance. But before jumping to advanced unit tests, I'd start with the basics (i. e. writing tests for a class without dependencies).
  4. You don't need the try statement either. It's actually harmful, because it swallows important information (the exact location and the stack trace) while exposing the internal error message to your users. Get rid of it and simply let PHP handle the exception.
  5. A separate class for a single query is a bit too fine-grained. I'd put the query into the Auth class and reserve the User class for general user-related data and tasks (like the name suggests). Either way, don't expect to get the perfect OO design on the first attempt. Even programmers with years of OOP experience argue about the ideal approach. You've already skipped many stages that people usually go through (the god object, hard-coded class references etc.). Now I'd simply try out different approaches, analyze the problems and look for common solutions.
  6. The User class should behave like a model. That is, one instance represents one user, all public attributes (not including the password hash and the reset token) are loaded upon instantiation and can be accessed through getter methods. I find the current approach a bit confusing, because a User, well, isn't a user. It's more like a database of all users, and you have to constantly specify which user you mean. You should also use type declarations in your methods to make sure that the $pdo argument is in fact a PDO instance.
  7. JSON.stringify() is fine, but inserting the result with innerHTML is not. Try this object, for example: {"foo": "<img src='xyz' onerror='alert(1)'>"}
  8. You have to JSON-encode the object again and put it into a text node within the div element. Don't use innerHTML, because this will interpret HTML tags. However, there are much easier ways of debugging (like the JavaScript console).
  9. *sigh* Anyway, after looking at your site and being greeted with a stream of weird server errors, I think the fudged up import is probably your least problem ...
  10. Who said anything about manual checks? Wordpress plug-ins can be extended, so the import procedure can be fixed simply by hooking into it. This is not just about the currency chaos. The problem is that you appearently accept any input without even the most basic validation and normalization. Never do that, especially when you're dealing with actual money (or is this just one of those “school projects”?).
  11. Then fix the input data as soon as it reaches your application. DRY also means that you don't repeat the same validation everywhere in your code.
  12. And don't use multiple identifiers to denote the same currency. You have “GBP”, but you also have “£”, which effectively requires you to do every check twice. Use a single unique identifier. The ISO code is a good start.
  13. For the record: There's nothing inherently wrong with having a single User class. That's not a God Object, because it has a specific purpose (representing an application user). The discussion is more about how fine-grained the class structure should be. And you shouldn't create a new class for every single task. The registration and a password reset are really just simple create/update operations in the User and Authentication class. It wouldn't make sense to keep them separate. Of course there's more than one way, but I would do something like this: if plain PDO isn't enough: a Database class PasswordHash: create($password, $parameters), check($password), parse($hash), needsUpdate($desiredParameters), ... Authentication: create($username, $password), check($username, $password), update($username, $currentPassword, $newPassword), createResetToken($username), resetPassword($username, $resetToken, $newPassword) Session: create($userId), resume(), terminate() [the user is logged out] User: representing the aspects of the account which aren't security-related (personal data etc.) Creating various e-mails can be solved with templates. I wouldn't necessarily use a separate Email class. The above classes shouldn't do too much. For example, Authentication::createResetToken() should really just generate a random token, store it and return it to the caller. Sending out an e-mail/SMS/... should be handled at a higher level, e. g. the controller. Using an object in another object is called association, and it's perfectly normal. You can avoid hard-coded class dependencies with Dependency Injection.
  14. No dissent, just a comment: When you have to choose between a single complex class (like User) and multiple simple classes (PasswordHash, Authentication, ...), I'd generally pick the latter. A “dumb” class which only takes care of one aspect is easier to understand, easier to test and more future-proof. Having a dedicated class for password hashes may sound like overkill, but there's actually more to it than creating and verifying a hash. You'll also want a parser to check the hash properties, and you have to identify obsolete hashes, analogous to the password_needs_rehash() function. In addition to that, password hashing is subject to change. I've revised my own code a couple of times, and one of the next PHP releases will introduce a more modern algorithm like Argon2. These changes shouldn't require you to mess with the inner workings of your User class. It's much safer to edit an isolated PasswordHash class while leaving everything else alone. It's the same thing with, say, user authentication. You may start with a simple passwork check, but that's not necessarily all you'll ever need. What about brute-force protection? Public-key authentication for high-value accounts? If you have a separate Authentication class, making those changes is not a problem. If everything is embedded into a User class, it's more difficult. So personally, I would create one PasswordHash class, one Authentication class, maybe a Session class and finally a User class. It's perfectly fine if each of them only contains a few lines of code.
  15. Objects aren't ordered, so the loop can start anywhere. The (inefficient) loop also isn't necessary. Use the built-in hasOwnProperty() method mentioned above.
  16. Within your getJsonData() function, alert( atts["055"] ); should display “Bluman, Anthony”. All other entries can be accessed in the same way.
  17. See the article. There's a complete example at the bottom (starting with “If you're into micro-optimization ...”). The idea is to JSON-encode the data, HTML-escape it, put it into a hidden HTML element and then parse it with JSON.parse(). Or you simply use Ajax.
  18. Inserting JSON-encoded data into a script element is unsafe. There's a FAQ article about the security problems of this approach and reasonable alternatives. The existence of properties in a JavaScript object can be checked with hasOwnProperty(). The value can be accessed with the dot or bracket syntax (foo.bar or foo['bar']).
  19. With Twig: main template {% import "form.twig" as form %} <form method="post" enctype="multipart/form-data"> {{ form.mofish_image("foo_image", "Please select an image") }} {{ form.mofish_image_alt_text("foo_image_alt_text", "Image alternative text") }} <input type="submit"> </form> macros (custom form elements) {% macro mofish_image(field_name, label) %} <div class="form-group"> <label>{{ label }}</label> <input type="file" name="{{ field_name }}"> </div> {% endmacro %} {% macro mofish_image_alt_text(field_name, label) %} <div class="form-group"> <label>{{ label }}</label> <input type="text" name="{{ field_name }}"> </div> {% endmacro %} The input gets auto-escaped, so you don't have to worry about XSS attacks. I'm not necessarily saying this is exactly how I'd do it. But it demonstrates that you can save a lot of typing and headaches if you use a professional template engine instead of trying to build your own with a bunch of DOMDocument hacks.
  20. So you want to check if the grade parameter does not exist at all? if (!isset($_POST['grade'])) ... or if (!array_key_exists('grade', $_POST)) ...
  21. This: header("Content-Type: {$mime}"); You've written a lot of code to detect the MIME type, check it, maybe store it and hopefully check it again before the header() call. But the webserver already knows the MIME type of every common extension. I'm not even sure if Apache honors the Content-Type header you're giving it. Have you checked this? It might actually ignore this declaration altogether and fall back to its own mapping.
  22. Many things are “possible”. For example, it's “possible” to implement a complete MVC framework with Brainfuck: ++++++++++[>+++++++>++++++++++>+++>+<<<<-]>>++.+++.+++++++++.+.+.>++.<-----.---------.>.<-----.+++++++++++++++.++.---------.+++.>.<------.+++++++++..---.+++++++.>+.>.+++++++++>+++++++>++++++++++>+++>+<<<<->>++++++++++++++++>++<--------------><-----+++++++++++++++++---------+++><------+++++++++---+++++++>+>+++++++>+++++++>+++++++++>++>+<<<<->>+++++++++++++++>+<-------------><----+++++++++++++++---------++><-----+++++++++--++++++++>++++++++++++>++++++++>++>+<<<->>+++++++++++++>+<------------><---++++++++++++++--------++<-----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++++++>+++++++>+++++++++>++>+<<<<->>+++++++++++++++>+<-------------><----+++++++++++++++---------++><-----+++++++++--++++++++>+++++++>+++++++>+++++++++>++>+<<<<->>+++++++++++++++>+<-------------><----+++++++++++++++---------++><-----+++++++++--++++++++>++++++++++++>++++++++>++>+<<<->>+++++++++++++>+<------------><---++++++++++++++--------++<-----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++++++++++>++++++++>++>+<<<->>+++++++++++++>+<------------><---++++++++++++++--------++<-----++++++++--+++++++>++++++>++++++>+++++++++>++>+<<<<->>+++++++++++++++>+<-------------><----+++++++++++++++---------++><-----+++++++++--++++++++>++++++++++++>++++++++>++>+<<<->>+++++++++++++>+<------------><---++++++++++++++--------++<-----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--++++++>++++++++++++>++++++++>+++<<<<->>+++++++++++++++>+<-------------><----+++++++++++++++---------++><-----+++++++++--++++++++>++++++++++++>++++++++>++>+<<<->>+++++++++++++>+<------------><---++++++++++++++--------++<-----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++>++++++++++>+++++++>+++<<<<>>++++++++++++++>+<-------------><----+++++++++++++++---------++><-----+++++++++--++++++++>++++++++++++>++++++++>++>+<<<->>+++++++++++++>+<------------><---++++++++++++++--------++<-----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-++++++>++++++++++++++++>++<<<<>>++++++++++++>+<------------><----+++++++++++++++---------++><-----+++++++++--++++++++>++++++++++++>++++++++>++>+<<<->>+++++++++++++>+<------------><---++++++++++++++--------++<-----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-++++++>++++++++++++++>++<<<>>+++++++++++>+<----------><----++++++++++++++---------++><-----+++++++++--++++++++>++++++++++++>++++++++>++>+<<<->>+++++++++++++>+<------------><---++++++++++++++--------++<-----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++++++++++++>++<<>>++++++++++>+<---------><---+++++++++++++--------++><-----+++++++++--++++++++>++++++++++++>++++++++>++>+<<<->>+++++++++++++>+<------------><---++++++++++++++--------++<-----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++>++<<->+++++++>----------+++++++-----+---+++-+++++>+++++++++++>++<<>+++++++++>+<--------><---+++++++++++--------+><-----++++++++--++++++++>++++++++++++>++++++++>++>+<<<->>+++++++++++++>+<------------><---++++++++++++++--------++<-----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++++<->+++++++>---------++++++--------+++-++++>++++++++++>++<>++++++++>+<-------><---++++++++++-------+><----+++++++--+++++++>++++++++++++>++++++++>++>+<<<->>+++++++++++++>+<------------><---++++++++++++++--------++<-----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++<->++++++>--------++++++-------++-++++>+++++++++>+<>+++++++>+<------><---+++++++++------+><----++++++--++++++>+++++++++++++++++++>++>+<<<->>+++++++++++++>+<------------><---++++++++++++++--------++<-----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++>+++++>--------+++++------++-++++++++++++>+<>++++++>+<-----><---++++++++-----+><----+++++--+++++>+++++++++++++++++>++>+<<->>+++++++++++++>+<------------><---++++++++++++++--------++<-----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++++>--------++++------+++++++++++++>+<>+++++>+<----><---+++++++-----><----++++--+++++>+++++++++++++++>+>+<<->>+++++++++++>+<------------><---++++++++++++++--------++<-----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++>-------++++-----++++++++++++>+>+++++>+<---><---++++++----><----+++--+++++>+++++++++++++>+>+<->>++++++++++>+<-----------<---++++++++++++++--------++<-----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++------++++-----++++++++++>+>++++>+<---><--++++++---><----++--+++++>+++++++++++>+>+<->+++++++++>+<----------<---++++++++++++--------++<-----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++---++++-----+++++++++>+++++>+<--><--+++++---><----+--+++++>+++++++++>+>+<->++++++++>+---------<---+++++++++++-------++<----++++++++--++++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++-+++-----++++++++>++++++<--><--++++---><---+--++++>++++++++>+>+<->+++++++>+--------<--++++++++++-------+<----+++++++--+++++++++++++++>+++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++++----++++++++++++++<--<--++++--><---+--+++>+++++++>+>+<->++++++>+-------<--+++++++++------+<---+++++++-++++++++++++++>++++++>++>+<<<->++++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++---+++++++++++++<--<--+++--><-----+++>++++++>+>+<>++++++>+------<--++++++++-----+<---++++++-++++++++++++>++++++++>+<<<->+++++++++++>+<-----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++-++++++++++++<-<--+++--<-----+++++++++>++<>+++++++------<-++++++++----+<---+++++-+++++++++++>+++++++>+<<->++++++++++>+<----------<---+++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++++++++++++<-<-+++--<----++++++++>++<>++++++-------++++++++---+<---++++-++++++++++>++++++>+<<-+++++++++>+<---------<---++++++++++++-------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++++++++++<-<-+++-<----++++++++>++<++++++------+++++++---+<---+++-++++++++++>+++++>+<<-++++++++>+<--------<--+++++++++++------++<----+++++++--+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++++++<-<-+++-<---+++++++>++<+++++------++++++---+<--+++-+++++++++>++++>+<<-+++++++>+<-------<--++++++++++-----++<---+++++++-+++++++++++++>+++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++++-<-+++-<---++++++>++<++++-----++++++---<--+++-++++++++>+++>+<<-++++++>+<------<--+++++++++----++<---++++++-++++++++++++>++++++>+++<<<->+++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++-<+++-<---+++++>++<++++----+++++---<--+++++++++++>++>+<<-+++++>+<-----<--++++++++----+<---+++++-+++++++++++>+++++>+++<<<->++++++++++><----------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++<++-<---+++++>+<++++----++++---<-++++++++++>++>+<<-++++>+<----<--+++++++----+<--+++++-+++++++++++++++>+++<<->+++++++++><---------<---++++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++-<--+++++>+<+++----++++--<-+++++++++>++>+<-++++>+<---<--++++++----+<-+++++-+++++++++++++>+++<<-+++++++++<--------<---+++++++++++------++<---++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++<--++++>+<+++---++++--<-++++++++>+>+<-+++++<---<--+++++----+-+++++-+++++++++++>+++<<-++++++++<-------<---+++++++++------++<--++++++--++++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++-+++>+<+++---+++--<-+++++++>+>+<-++++<---<-+++++---+-+++++-+++++++++++++<<-+++++++<------<---++++++++-----++<--+++++--+++++++++>++++++>+++<<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++++><+++---+++---+++++++>>+<-++++<--<-+++++--+-+++++++++++++++++<<-++++++<-----<---+++++++-----++--+++++--++++++++>+++++>+++<->++++++++++><---------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++><++---+++---++++++>>+<-+++<--<-++++--+-+++++++++++++++<<-+++++<--------++++++-----++--++++--+++++++>++++>+++<->+++++++++><--------<---++++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++++--+++---+++++>>+<-+++<-<-++++---++++++++++++++<<-++++<-------++++++----++--+++--++++++>++++>++<->++++++++><-------<---+++++++++------++---++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++--++---+++++>>+-+++<-<-+++---+++++++++++++<-++++<------+++++----++--++--++++++++++>++<-++++++++>-------<--++++++++------++--++++++-+++++++>+++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++++--+++++>>+-++<-<-+++--++++++++++++<-++++------++++----++--+--+++++++++>++<-+++++++>------<--+++++++-----++--+++++-++++++++++++>+++<<->+++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++--++++>>+-++<-<+++--+++++++++++<-+++------+++----++-+--++++++++>++<-++++++>-----<--++++++-----++-+++++-++++++++++++++<<->++++++++>------------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++++>>+-++<-<+++-++++++++++<-+++-----+++---++-+--+++++++>++<-+++++>----<--+++++-----++-++++-+++++++++++++<->+++++++>-----------+++++++++------+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++>>-++<-<+++-+++++++++<-++-----++---++-+--++++++>++-+++++>---<--+++++----++-+++-++++++++++++<->++++++>----------++++++++-----+---+++++-+++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++>-+<-<+++-++++++++<-++----++---+++--++++++++-+++++>--<--++++----++-++-+++++++++++<->+++++>---------+++++++-----+--+++++-++++++++>+++<<->++++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++<-+++-++++++++-++----++--+++--+++++++-++++>--<--+++----++-+-++++++++++<->++++>--------+++++++----+--++++-+++++++++++<<->+++++++>-----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++-++-++++++++-++---++--++--+++++++++++>--<-+++----+++-+++++++++<->++++--------++++++------++++-++++++++++<->+++++++----------++++++++-----+---++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++-+++++++-++---+--++--++++++++++>-<-+++---+++-++++++++<->+++--------+++++-----++++-+++++++++<->++++++---------+++++++-----+--++++-++++++>++<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++++++++-++---+--+--+++++++++>-<-++---+++-+++++++<->++--------++++-----+++-++++++++<->+++++--------+++++++----+--+++-++++++>+<<->+++++++>----------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++++-++---+--+--++++++++><-++---++-+++++++<>++-------++++----+++-+++++++<->++++--------++++++------+++-+++++>+<<->++++++>---------+++++++-----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++-+---+--+--+++++++><-++--++-++++++<>++------++++---+++-++++++<->++++-------+++++------++-+++++><<->+++++>--------+++++++----+---+++-++++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++--+--+--++++++><-++--++++++++<>+------+++---+++-+++++<->+++-------++++------+-+++++><<>+++++>-------++++++----+--+++-+++++<->+++++++>---------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++-+-+--++++++><-+--+++++++<>+-----+++---++++++++<->++-------+++------++++++><<>++++>------++++++---+--+++-++++<->++++++>--------++++++--------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++-+-++++++><-+--++++++<>+----+++--++++++++<>++------+++------+++++><<>+++>-----++++++-----+++-+++<->++++++--------+++++-------+++-+++<->++++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++-+++++><-+--+++++<>+----++--+++++++<>++-----+++-----+++++><<+++>-----+++++----+++-+++<-++++++-------+++++------++++++<->+++++>--------++++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++++><-+--+++++<+----++--++++++<>+-----+++----+++++><+++>----+++++----++-+++<-+++++------+++++-----++++++<>+++++>-------+++++-------++-+++>+++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-++++++><+--+++++<+---++--+++++<>+-----++----++++><+++>---+++++---++-+++<-++++------++++-----+++++<>++++>------+++++------++-+++>++++>--------+++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++<+-+++++<+---++-+++++<>+----++---++++><+++---+++++--++-+++<-+++------+++-----++++<>++++------++++------+++++>++++>-------++++------++++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++-++++<+---++-++++<>+----+---++++>+++---++++--++-+++-+++-----+++-----+++<>++++-----++++-----+++++++++>------++++-----+++++++>--------++++------+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++++++---++-++++<+----+---+++>+++--++++--++-++-+++----+++-----++<>++++----++++----++++++++>------+++-----++++++>-------++++-----+++++>-------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++++--++-++++<+---+---+++>++--++++-++-++-+++---+++----++<>++++---++++---++++++++------+++----+++++>-------+++-----++++>------++++-----+++------++++----+++---++++---+++-+++---+++++--+++-+++++--+-++++<+---+--+++>++--+++-++-+++++---+++---++<>+++---++++--++++++++-----+++---+++++>------+++----++++>-----++++----+++-----++++----+++---++++---+++-+++---+++++--+++-++++++-+++<+---+--++>++--+++-+-+++++--+++---++<+++---+++--+++++++-----+++--+++++>-----+++---++++>----++++----++-----+++----+++--++++---+++-+++---+++++--+++-+++++++++---+--++>++-+++-+-++++--+++--++<+++---++--++++++-----+++-+++++>----+++---+++>----+++----++----+++----++--++++--+++-+++--+++++--+++-+++++++--+--++>++-++-+-++++--++--++<++---++--+++++----- (taken from Brainfuck on Rails) Implementing the OP's orginal idea might be a similarly interesting intellectual challenge. I'll give you bonus points if you do it with Brainfuck. However, I believe we should concentrate more on simple, pratical solutions and less on nerd challenges. When generating a friggin' HTML form requires the OP to have advanced PHP knowledge and make fundamental changes to the underlying process, you're doing it wrong. I'm sure this can all be said in a more friendly way, but the point is really: Keep simple things simple. I can understand that the OP wants to save a few keystrokes, which is why I suggested a template engine with macro support. But a magical context-dependend, shape-shifting HTML element is just nonsense. Sorry, guys.
  23. It's not just a little strange. It makes no sense at all. Even if you could implement this with tons of code, nobody except you would understand it. And that's the last thing you want when you implement a GUI. So I suggest you get back to a more sane approach. You want a form? Write a form. You want to insert the data into an image element? Insert the data into an image tag. No magic.
  24. I understand that you want to use your mofish elements as placeholders, but putting a mofish tag into an img tag is neither valid, nor does it make any sense. You can have this: <img src="..." alt="..."> <mofish ...> <mofish ...> That's an img element followed by two mofish elements. But you cannot have this: <img <mofish> <mofish>> That's just nonsense. And again, I doubt that you're on the right track. Generating dynamic HTML with custom tags is what template engines are for. Theoretically, it's possible to implement templates with pure XML using XSLT, but this will be very complicated and may require you to rewrite large parts of your HTML documents. Because then you'll need XHTML as opposed to good old HTML.
  25. Your syntax has nothing whatsoever to do with HTML or XML, so DOMDocument has no chance of parsing it. Even if you fix the quotes, you'll only get a single img element with a very strange source URL (as opposed to an img element and a mofish element). What are you trying to do? If you want to insert data into an HTML document, you need a template engine, not an HTML parser.
×
×
  • 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.