Jump to content

Recommended Posts

Newbie - Sorry if stupid question.

 

I have a class that produce an html table to display MySql table records.

Added to that, it display a Navigation system (previous next ...).

 

The way the class id built, it echo the html as it produces it.

 

what i would like to modify, is to echo a temporary tag like <Mystuff:nav> somewhere along the way.

then generate the navigation html code and store it in memory.

 

now when the html table is completely echoed, iwould like to replace the <Mystuff:nav> by the navigation html code stored in memory previously.

 

Would that be possible. Oh! Could I replace text in the response buffer which would already contain the echoed html?

 

Any idea

Link to comment
https://forums.phpfreaks.com/topic/51675-solved-replace-echoed-text/
Share on other sites

You could catch all the output in the buffer and place it in a string, modify the string however you please and then output that.

 

eg;

 

<?php

  ob_start();
  echo "This is a test";
  $out = ob_get_contents();
  ob_end_clean();
  echo str_replace('test','foo',$out)

?> 

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.