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
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...  :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

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