Jump to content

MrFish

Members
  • Posts

    492
  • Joined

  • Last visited

Everything posted by MrFish

  1. That's the same code I used as posted in OP. I checked an old file I used on this same server which printed correctly. Started stripping it down and found it started nesting incorrectly after I took out text nodes. This now works- $DOM = new DOMDocument(); $div = $DOM->createElement("div"); $div->appendChild($DOM->createTextNode(""));$DOM->appendChild($div); $div = $DOM->createElement("div"); $div->appendChild($DOM->createTextNode(""));$DOM->appendChild($div); $div = $DOM->createElement("div"); $div->appendChild($DOM->createTextNode(""));$DOM->appendChild($div); $div = $DOM->createElement("div"); $div->appendChild($DOM->createTextNode(""));$DOM->appendChild($div);echo $DOM->saveXML(); But it seems like a cheap trick. How does this page look for you? [ URL REMOVED ] Edit: Oh wait you're right. I was viewing the page through Chromes element inspector. In the HTML it's <div/> like you said. This doesn't register as <div></div> though. Any idea how to make that print differently without text nodes?
  2. Strange. I will investigate on that and see what I can find.Could it be a PHP version issue?
  3. Hello W3S, I'm trying to use DOMDocument but when i use appendChild its not appending to the element I expect it to. Here is a simple example- $DOM = new DOMDocument();$DOM->appendChild($DOM->createElement("div"));$DOM->appendChild($DOM->createElement("div"));$DOM->appendChild($DOM->createElement("div"));$DOM->appendChild($DOM->createElement("div"));echo $DOM->saveXML(); What I expect- <body> <div></div> <div></div> <div></div> <div></div></body> What I get- <body> <div> <div> <div> <div> </div> </div> </div> </div></body> I've looked at the PHP documentation and this looks like how they did it but obviously I'm missing something. Can anyone spot my mistake? Edit: Also, i need to use createElement because I want to manipulate the elements before adding them. When you use new DOMElement() its read only for whatever reason
  4. Hello W3, I've got something I'm tossing over in my head looking for different points of view. I mostly work on sites individually site-by-site but I'm working on something that I'm trying to do differently. The idea is- A large-scale network of sites. Each site has a template (choosen from a handful) Each site has it's own database These sites all have the same type of content but have different content that needs to be managed by individuals outside our system. (ex: a car sales site. clients can upload cars and manage content but can't access the files directly) I want to figure out how to do this pretty easily. My two ideas are 1. Have a single center for all content. When a site is accessed it uses a config file for that site and dynamically pulls in all content at each page call. Each site would be a shell essentially. If you access the stylesheet.css file it would actually load like php (using mod_rewrite) and dynamically pull in the correct style. This could have complications since there wouldn't be actually be any php files. If you went to the car_search_results.php file it would send that page url to a parsing page and write the information dynamically before running it. Same with something like an about-us page. This could become complicated and lag the server too much. 2. Each site would hold their own files but any updates would need to be pushed out from the center. So if you updated the stylessheet_redtheme.css file it would push it out to every site that is configured to use that stylesheet. This would be simpler but I don't know if it would loose flexibility. Any thoughts?
  5. I'm guessing Notepad2 is Notepad++?Edit:Nope never mind. None of the above.
×
×
  • Create New...