Jump to content

Read/Write to an outerlying HTML tag?


nothing500

Recommended Posts

Can PHP do this?

<html>
  <?php
    // Reference that div below me.
    // Manipulate it.
    // Write it back in its same location, but with new code around it.
  ?>
  <div id="something_to_be_referenced">
    Something to be replaced.
  </div>
</html>

 

I'm trying to template my HTML page by referencing the HTML content in PHP, manipulating it as an XML object, then putting it back with the template content wrapped around it.

 

I've done a similar thing by referencing content in an external file, and then writing the manipulated content (the whole page's content, actually) into the current, blank file. Now, I want to get reference to and manipulate an outer-lying HTML tag that's in the same file as the PHP tag.

 

And I've done this with Javascript by waiting for the page to load, then writing a specific tag's inner HTML.

Link to comment
https://forums.phpfreaks.com/topic/158956-readwrite-to-an-outerlying-html-tag/
Share on other sites

Ok, so, I'm assuming you're saying it's possible. That's very motivating! PHP's DOM manual was what I've been reading for hours before posting here, but I'll keep going through it. If anyone has any other clues on how to make this happen, that'd sure be nice...  :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.