Created
September 17, 2012 03:23
-
-
Save chocnut/3735394 to your computer and use it in GitHub Desktop.
SilverStripe HTMLText Extension
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class CustomTextExtension extends Extension { | |
public function Paragraph($count){ | |
$doc = new SS_HTMLValue($this->owner->value); | |
$content = $doc->getElementsByTagName('p'); | |
$current = 0; | |
foreach($content as $p){ | |
++$current; | |
if($x == $count) | |
return $p->nodeValue; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment