[PHP] so nobody knows how do get rid of everything outside or certain tags?

2002-08-15 Thread victor

I asked this question a while ago, and I am still seeking clarification,
I fooled with ereg_replace and they only do a piece of what I want, I
would like to know how to keep only a chunk of text defined between 2
tags let's say, div and /div and ignore everything else, I also have
to search and replace certain tags between, but I know how to do that
with ereg_replace. So can anyone help me echo only what is between the
div tags? Please? 

- Vic



__ 
Post your ad for free now! http://personals.yahoo.ca

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] so nobody knows how do get rid of everything outside or certain tags?

2002-08-15 Thread Jay Blanchard

[snip]
I asked this question a while ago, and I am still seeking clarification,
I fooled with ereg_replace and they only do a piece of what I want, I
would like to know how to keep only a chunk of text defined between 2
tags let's say, div and /div and ignore everything else, I also have
to search and replace certain tags between, but I know how to do that
with ereg_replace. So can anyone help me echo only what is between the
div tags? Please?
[/snip]

Why not take the the beginning div, everything in the middle, and the end
/div tag and explode() them into an array and then get what you want and
write it out? I didn't see your originl post and don't know if there was
more detail available, but I hope this helps.

Jay

I’m not tense…just terribly, terribly alert

***
* Texas PHP Developers Conf  Spring 2003  *
* T Bar M Resort  Conference Center  *
* New Braunfels, Texas*
* San Antonio Area PHP Developers Group   *
* Interested? Contact [EMAIL PROTECTED] *
***



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] so nobody knows how do get rid of everything outside or certain tags?

2002-08-15 Thread Joseph W. Goff

preg_match('!div[^]+(.*)/div!Uis',$info,$regs);
$everything_between_divs=$regs[1];

- Original Message -
From: Jay Blanchard [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, August 15, 2002 11:44 AM
Subject: RE: [PHP] so nobody knows how do get rid of everything outside or
certain tags?


 [snip]
 I asked this question a while ago, and I am still seeking clarification,
 I fooled with ereg_replace and they only do a piece of what I want, I
 would like to know how to keep only a chunk of text defined between 2
 tags let's say, div and /div and ignore everything else, I also have
 to search and replace certain tags between, but I know how to do that
 with ereg_replace. So can anyone help me echo only what is between the
 div tags? Please?
 [/snip]

 Why not take the the beginning div, everything in the middle, and the
end
 /div tag and explode() them into an array and then get what you want and
 write it out? I didn't see your originl post and don't know if there was
 more detail available, but I hope this helps.

 Jay

 I'm not tense.just terribly, terribly alert

 ***
 * Texas PHP Developers Conf  Spring 2003  *
 * T Bar M Resort  Conference Center  *
 * New Braunfels, Texas*
 * San Antonio Area PHP Developers Group   *
 * Interested? Contact [EMAIL PROTECTED] *
 ***



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] so nobody knows how do get rid of everything outside or certain tags?

2002-08-15 Thread David Buerer

Try this, it should work great.

$starttag='DIV'
$endtag='/DIV'

$pos_starttag=strpos(strtoupper($origstring),$starttag);
$pos_endtag=strrpos(strtoupper($origstring),$endtag)+strlen($endtag);
if($pos_starttag===False OR $pos_endtag===False) return 0;
$newstring = substr(origstring,$pos_starttag,$pos_endtag-$pos_startag-1);

return $newsttring;

-Original Message-
From: Joseph W. Goff [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 15, 2002 9:54 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] so nobody knows how do get rid of everything outside
or certain tags?


preg_match('!div[^]+(.*)/div!Uis',$info,$regs);
$everything_between_divs=$regs[1];

- Original Message -
From: Jay Blanchard [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, August 15, 2002 11:44 AM
Subject: RE: [PHP] so nobody knows how do get rid of everything outside or
certain tags?


 [snip]
 I asked this question a while ago, and I am still seeking clarification,
 I fooled with ereg_replace and they only do a piece of what I want, I
 would like to know how to keep only a chunk of text defined between 2
 tags let's say, div and /div and ignore everything else, I also have
 to search and replace certain tags between, but I know how to do that
 with ereg_replace. So can anyone help me echo only what is between the
 div tags? Please?
 [/snip]

 Why not take the the beginning div, everything in the middle, and the
end
 /div tag and explode() them into an array and then get what you want and
 write it out? I didn't see your originl post and don't know if there was
 more detail available, but I hope this helps.

 Jay

 I'm not tense.just terribly, terribly alert

 ***
 * Texas PHP Developers Conf  Spring 2003  *
 * T Bar M Resort  Conference Center  *
 * New Braunfels, Texas*
 * San Antonio Area PHP Developers Group   *
 * Interested? Contact [EMAIL PROTECTED] *
 ***



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] so nobody knows how do get rid of everything outside or certain tags?

2002-08-15 Thread victor

Thanks, I tried this code first, and I wrote my script like this:

?php 

$file_name = $page_name.$ext
or die ('Error 2');

$file = file($path.$file_name)
or die ('Error 3');

$str = implode(' ', $file)
or die ('Error 4');

// Original first tag
//div class=Section1
// Original last tag
///div

preg_match('!div class=Section1[^]+(.*)/div!Uis',$str,$regs);
$everything_between_divs=$regs[1];

$good = implode(' ', $everything_between_divs)
or die ('Error 5');

$clean = ereg_replace(o:p/o:p,   , $regs[1]);

echo $clean;

?

- Vic


-Original Message-
From: Joseph W. Goff [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, August 15, 2002 12:54 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] so nobody knows how do get rid of everything outside
or certain tags?

preg_match('!div[^]+(.*)/div!Uis',$info,$regs);
$everything_between_divs=$regs[1];

- Original Message -
From: Jay Blanchard [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, August 15, 2002 11:44 AM
Subject: RE: [PHP] so nobody knows how do get rid of everything outside
or
certain tags?


 [snip]
 I asked this question a while ago, and I am still seeking
clarification,
 I fooled with ereg_replace and they only do a piece of what I want, I
 would like to know how to keep only a chunk of text defined between 2
 tags let's say, div and /div and ignore everything else, I also
have
 to search and replace certain tags between, but I know how to do that
 with ereg_replace. So can anyone help me echo only what is between the
 div tags? Please?
 [/snip]

 Why not take the the beginning div, everything in the middle, and
the
end
 /div tag and explode() them into an array and then get what you want
and
 write it out? I didn't see your originl post and don't know if there
was
 more detail available, but I hope this helps.

 Jay

 I'm not tense.just terribly, terribly alert

 ***
 * Texas PHP Developers Conf  Spring 2003  *
 * T Bar M Resort  Conference Center  *
 * New Braunfels, Texas*
 * San Antonio Area PHP Developers Group   *
 * Interested? Contact [EMAIL PROTECTED] *
 ***



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


__ 
Post your ad for free now! http://personals.yahoo.ca

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] so nobody knows how do get rid of everything outside or certain tags?

2002-08-15 Thread vic

Thanks, I tried this code first, and I wrote my script like this:

?php 

$file_name = $page_name.$ext
or die ('Error 2');

$file = file($path.$file_name)
or die ('Error 3');

$str = implode(' ', $file)
or die ('Error 4');

// Original first tag
//div class=Section1
// Original last tag
///div

preg_match('!div class=Section1[^]+(.*)/div!Uis',$str,$regs);
$everything_between_divs=$regs[1];

$good = implode(' ', $everything_between_divs)
or die ('Error 5');

$clean = ereg_replace(o:p/o:p,   , $regs[1]);

echo $clean;

?


ok, I forgot to finish my message,..

now I get this error:


Notice: Undefined offset: 1 in
/home/victor/argilent-www/sites/malibu_place_2/index.php on line 104

Warning: Bad arguments to implode() in
/home/victor/argilent-www/sites/malibu_place_2/index.php on line 106
Error 5

- Vic


-Original Message-
From: Joseph W. Goff [mailto:[EMAIL PROTECTED]] 
Sent: Thursday, August 15, 2002 12:54 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Re: [PHP] so nobody knows how do get rid of everything outside
or certain tags?

preg_match('!div[^]+(.*)/div!Uis',$info,$regs);
$everything_between_divs=$regs[1];

- Original Message -
From: Jay Blanchard [EMAIL PROTECTED]
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: Thursday, August 15, 2002 11:44 AM
Subject: RE: [PHP] so nobody knows how do get rid of everything outside
or
certain tags?


 [snip]
 I asked this question a while ago, and I am still seeking
clarification,
 I fooled with ereg_replace and they only do a piece of what I want, I
 would like to know how to keep only a chunk of text defined between 2
 tags let's say, div and /div and ignore everything else, I also
have
 to search and replace certain tags between, but I know how to do that
 with ereg_replace. So can anyone help me echo only what is between the
 div tags? Please?
 [/snip]

 Why not take the the beginning div, everything in the middle, and
the
end
 /div tag and explode() them into an array and then get what you want
and
 write it out? I didn't see your originl post and don't know if there
was
 more detail available, but I hope this helps.

 Jay

 I'm not tense.just terribly, terribly alert

 ***
 * Texas PHP Developers Conf  Spring 2003  *
 * T Bar M Resort  Conference Center  *
 * New Braunfels, Texas*
 * San Antonio Area PHP Developers Group   *
 * Interested? Contact [EMAIL PROTECTED] *
 ***



 --
 PHP General Mailing List (http://www.php.net/)
 To unsubscribe, visit: http://www.php.net/unsub.php


__ 
Post your ad for free now! http://personals.yahoo.ca

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

__ 
Post your ad for free now! http://personals.yahoo.ca

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php