Code: Select all
this text is un-editable<br/>
<div class="e;editor"e; id="e;firstEditBox"e;>
This Can be editted
</div>
More un-editable<br/>
<div class="e;editor"e; id="e;secondEditBox"e;>
This also, can be editted
</div>
no edits hereI'm using the following code to try and find each instance of the div tags that denote the edittable area. However, as it is now, the pattern will only find one (though i thought preg_match_all() would find all occurances). It will only find the second of the two in the above example (if i invalidate the second, it finds the first).
Code: Select all
$pattern = '/<div[^>].+class="editor".+id="([\w]+[^\"]+)".*>(.*)<\/div>/i';
$try = '<div class="editor" id="introText">I can edit this text</div>text text<div class="editor" id="text">I can edit this text</div>';
preg_match_all($pattern, $try, $mat);
/* outputs:
Array
(
[0] => Array
(
[0] =>
I can edit this text
text text
I can edit this text
)
[1] => Array
(
[0] => text
)
[2] => Array
(
[0] => I can edit this text
)
)*/I'm not sure what the best way to acheive what I'm looking for, using file() to read each line into the array, or reading the whole thing using fread(). For now, I'll be the only one using this, so i can format the div tags in anyway it will work, but i'd love for it to find any of the tags i use no matter how they're formatted, as long as class="editor" and id="<any>" ... ANY help would be appreciated.
Thanks in advance...