I have a community driven site that's been running for several years (started with D4.7). I use Views to display data using the default "teaser" display in lieu of fields... Since my users have been creating lots of html content with embedded imagery (haven't implemented imagecache yet) the page displays are all over the place. It's gotten to the point where it reminds me of myspace - lol - because there's no enforced order to how imagery is displayed. Some node teasers have small images, some have large images and some don't have any images...
So - as part of my first step in reworking the presentation of the site I'd like to eliminate any html from teasers and go to text only. I know I can use views to strip html from fields in realtime but that seems too resource intensive. Does anybody have any ideas as to how I should approach this in a more permanent fashion?
Thanks,
Chris

Comments
There are a lot of options
I'm not sure that any option would be any less resource intensive, but you could always strip the html in a theming function or a custom node.tpl.php file. PHP's strip_tags() function works very well, but may leave broken artifacts behind if the original content is malformed.
Is this for views pages or blocks?
Steve
Steve Graham
Corona, CA
http://www.linkedin.com/in/stevegraham
Hi Steve - thanks for your
Hi Steve - thanks for your input. To answer your question - this is for views pages...
Basically over the years I gave my users TinyMCE and the ability to create content as they wanted... Unfortunately that means some of the teasers have huge inline images, some have small images, some have formatted html text - it's all over the place and it's got to stop. LOL. My plan is to migrate everything to a structured, imagefield + imagecache system (no more random inline images messing up layout) that's clean and just works better for everything...
But - I'm still stuck with about 8K existing node teasers that need to be cleaned up. I'd love to find out that I missed something obvious - that I could run PHP or Views Bulk Op that'd go in and reset all the teasers to have all html stripped out w/o changing the node body... That way it'd be a one time thing that I could run overnight / cron...
Chris
Chris Grant
Senior Visualization Artist | HMC Architects
Portfolio | christophergrant.com
IE Drupal | g.d.o/inland-empire
Perhaps CDN modules
There are modules that will migrate your image pathnames from the local webserver to remote CDN machines. Perhaps this filter can be used with a destination inside the imagecache folder?
Peter
LA's Open Source User Group Advocate - Volunteer at DrupalCamp LA and SCALE
Save it as a new revision
The simple answer might be that you create a new revision of all the content that you are cleaning up - if something goes wrong that you have missed, you could have all the content revert back to a revision just prior to it (if you create a module out of what you want to do, you could create another table with fields like nid, cur_vid, prev_vid) and reset everything to use the prior revision fairly easily that way.
I've been playing a lot with the batch api (and will soon be playing with either job_queue or drupal_queue (the latter of which is a backport of the queue module that is in Drupal 7 core) for scheduling tasks in cron) and that would be a good way to run what you have in 'one' operation - they're both going to be somewhat resource intensive (though strip_tags isn't particularly resource intensive as Steve mentioned above) but they'll get the job done fairly gracefully. Creating it as a drush task would be another.
As always, test this all out on a dev machine and don't forget to make a (or a series of) backup(s) :)
Filter for teaser
http://drupal.org/node/819682 at the bottom has an api method that might be used? Change the code to not just filter, but to save_node. But that changes the entire node, so if you want just the teaser, you will need to install a module that creates separate teasers (I just read about that one - not sure which drupal release). So, install the teaser module, and save new teasers there?
Peter
LA's Open Source User Group Advocate - Volunteer at DrupalCamp LA and SCALE