Jump to content

Removing section of text


Canman2005

Recommended Posts

Hi all

 

Wonder if someone can help

 

What I have is text for each page of my site which is stored in a sql table, to print the text on the pages I use

 

<?php
print $row['content'];
?>

 

The following is an example of the type of content stored

 

------------------------------------------------

 

Welcome to the contact page

 

*C*

page check

*C*

 

Please use the navigation bar above

 

------------------------------------------------

 

What I want to do is to remove the section of the content which is between and including

 

*C*

page check

*C*

 

So it would just print the content as

 

------------------------------------------------

 

Welcome to the contact page

 

Please use the navigation bar above

 

------------------------------------------------

 

Can this be done?

 

Any help would be great

 

Thanks in advance

 

Dave

Link to comment
Share on other sites

Thanks for that, but what I meant was that it would replace anything between

 

*C*

 

So it would basically use them as tags, I could change them all to

 

*C-start*

 

and

 

*C-end*

 

so that it knows what the start tag is and what the end tag is

 

can this be done in this case?

 

Thanks again

 

Dave

Link to comment
Share on other sites

Sorry, might not be making much sense.

 

Basically I want to get rid of everything that is held between two tags, so if the page content was

 

-----------------------

Welcome to the page

 

*C*

click here

*C*

----------------------

 

then it would strip out the following

 

*C*

click here

*C*

 

and simply print

 

--------------------------

welcome to the page

--------------------------

 

does the make any sense?

 

Thanks

Link to comment
Share on other sites

$content = str_replace("*C*", "", $content);

 

and secondly, can be it be changed so that the start tag looks like

 

*C-start*

 

and the end tag would look like

 

*C-end*

 

What does it matter; you're removing it all.

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.