Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 06-05-2007, 07:18 PM   PM User | #1
matak
Banned

 
Join Date: Apr 2007
Posts: 428
Thanks: 29
Thanked 5 Times in 5 Posts
matak is on a distinguished road
Getting a larger piece of matched text

Thanks guys for the great help on breaking those strings apart, and adding html tags. Now i have another idea, i can't pull out myself. It's something like this.
When using that function which matches strings, i can highlight matched text. Next for me to figure out is how to get those tags where matched text is in. All of the HTML text i'm reading and higlighting is between some tags, and now i need to figure out how to get the text until the > on the beggining side, and the < on the end side.
I'm thinking, and thinking, and doing some more thinking, and nope, i still don't have the answer.

To make it a bit more visual here's the "pseudo" code

PHP Code:
$match "bit of text";

$whole_text "<h1>This is the whole text title<h1><p>In which i have this bit of text i want to take out of the text. That bit of text is my keyword, blah blah</p>..";

if 
$match == $whole_text {
//get the whole text after the > and before the < of p opening and the ending //tags
}

//output would be
""Your matched text was found in this paragraph
>In which i have this bit of text i want to take out of the textThat bit of text is my keywordblah blah<
""Thank you for using our services :)! 
Any ideas?!
matak is offline   Reply With Quote
Old 06-06-2007, 01:04 PM   PM User | #2
matak
Banned

 
Join Date: Apr 2007
Posts: 428
Thanks: 29
Thanked 5 Times in 5 Posts
matak is on a distinguished road
Ugh.. Changing the idea on getting certain paragraphs into array. Something like this
Code:
<h1>Title</h1>
<p>Description</p>

<h1>Title1</h1>
<p>Description1</p>

<h1>Title2</h1>
<p>Description2</p>
And with PHP get them into array

Code:
array ([0] => <h1>Title</h1>,
[1] => <p>Description</p>,
[2] => <h1>Title1</h1>,
.
.
.
matak is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:40 AM.


Advertisement
Log in to turn off these ads.