Again, I've made a simple code, but for some strange reason, it doesn't work...
Here it is:
PHP Code:
$FindTitles = file_get_contents("info.php"); $FoundTitles = explode('h1>',$FindTitles); echo "<p>$FoundTitles[1];</p>";
Line 1: Opens the flat file info.php into $FindTitles
Line 2: Explodes $FindTitles into the parts by any h1>, could be <h1> or </h1>, I just need what's between <h1> and </h1>.
Line 3: Since $FoundTitles is an array, we echo the first one (well really the second one), which would be, say, "Info 1 Title". Then if you change it to 2 between the [ ], you get a blank screen (as well as 3, 4, 5...)...
Why? Why doesn't it work?
What I pretty much need is the script to go in and echo everything between any h1>.
Here's my flat file:
Code:
<div class='contentboxtitle' id='Title'><h1>Info 1 Title</h1></div><div class='contentbox'>CONTENT CONTENT CONTENT</div>|
<div class='contentboxtitle' id='Title'><h1>Info 2 Title</h1></div><div class='contentbox'>CONTENT CONTENT CONTENT</div>|
<div class='contentboxtitle' id='Title'><h1>Info 3 Title</h1></div><div class='contentbox'>CONTENT CONTENT CONTENT</div>|
So I'd need the script to echo "Info 1 TitleInfo 2 TitleInfo3 Title". I don't care about spacing, I can figure that out.
But I can't get it... I have no idea, it's bothering me I'm stumped on a 3 line catastrophe... 
Last edited by Physicsguy; 11-22-2009 at 08:49 PM..
Reason: added stuff
|