Here is what I am trying to do:

include_once('PHPTAL/PreFilter.php');

class URLPreFilter extends PHPTAL_PreFilter {
public function filterDOM(PHPTAL_Dom_Element $root){
foreach($root->childNodes as $node ){
if ($node instanceof PHPTAL_Dom_Element){
$url_attribute_names = array('href', 'src');
$url = null;
foreach ($url_attribute_names as $url_attribute_name){
if ($scanned_string = $node->getAttributeNS('',$url_attribute_name)){
$url = $scanned_string;
break;
}
}
if (!empty($url)){
if (preg_match('#/?(images|css|js|javascripts?|flash)#', $url)){
$url = '/layouts/${template-id}/'.((substr($url,0,1) ==
'/')?substr($url,1):$url);
}
print "[[[ $url ]]]<br/>";
$node->setValueEscaped($url);
} else {
$this->filterDOM($node);
}
}
}
}
}

On 10/14/10 12:18, Kornel Lesiński wrote:
> On 14 Oct 2010, at 17:08, Levi Stanley wrote:
>> I am migrating over to using PreFilter and using the DOM to manipulate
>> the html document.  However, am trying to figure out the usefulness of
>> the method, filterDOM().  I have my DOM, and I am walking threw it and
>> making my changes, however, after I am finished the page still renders
>> the same, am I missing something?
>
> It might be the cache. Try PHTPAL->setForceReparse(true) during development.
>


_______________________________________________
PHPTAL mailing list
PHPTAL@lists.motion-twin.com
http://lists.motion-twin.com/mailman/listinfo/phptal

Reply via email to