Page 1 of 1

Help parsing a template/if statement

Posted: Tue Apr 06, 2004 9:34 am
by THESiUS

Code: Select all

$test_string = '
	Some text goes here
	<br>
	<br>
	<if $whatever>
		Test text
		<br>
	</if>
	 Some more text
';
I have this template I made and I am trying to parse out everything between that if statement. So that it looks something like this...

Code: Select all

$test_string = '
	Some text goes here
	<br>
	<br>
	 Some more text
';
Thanks for any help I get.

Posted: Tue Apr 06, 2004 11:42 am
by TheBentinel.com
the strpos() function can help you find the <if> and the </if> tags, then you can use a couple of substr()'s to pull the data out.

http://www.php.net/strpos
http://www.php.net/substr