I'm trying to use the Filtered HTML input format to prevent layout tags from getting in my custom front_page display and messing up the layout. However, it seems that somehow input formats are not working to prevent tags like
node_teaser($nodeloaded->flexinode_6, "Filtered HTML")
$teaser = substr(node_teaser($nodeloaded->flexinode_6, "Filtered HTML"),0,140);
Filtered HTML is the default input format, by the way. I've tried specifying or not specifying the format.
Because for whatever reason node_teaser is not applying the input format when creating the teaser. So I've resorted to using this:
$search = array ('@<div[^>]*?>@i', '@<p[^>]*?>@i', '@<table[^>]*?>@i', '@<td[^>]*?>@i', '@<tr[^>]*?>@i', '@</div[^>]*?>@i', '@</p[^>]*?>@i', '@</table[^>]*?>@i', '@</td[^>]*?>@i', '@</tr[^>]*?>@i');
$replace = array ('','','','','','','','','','');
$teaser = substr(preg_replace($search, $replace, node_teaser($nodeloaded->flexinode_6, "Filtered HTML")),0,140);But this solution is not ideal because it is piecemeal blocking bad stuff, rather than blocking all and then allowing only acceptable stuff.
The reason I'm not just pulling the teaser text out of the database ($node->teaser) is because I don't want to use the flexinode default display of information (field description followed by field content).
Anybody have any ideas here? Thanks!
Comments
Dont know if is still an
Dont know if is still an issue but have you tried using the check_markup funtion to run your node content through the filter. For example:
This automatically uses the defined format on the flexinode input type. If you want to use another type you need to look up the filters(?) table in the database and use the id for the filter of choice (as opposed to the name string).
HTH
I'm replying to track this post...
As I have the same issue. When (or if) I find a solution, I will post it back here.
Thanks,
Rick
-------------------------------------------------------------------
Rick Vugteveen |rickvug.com @rickvug on Twitter