Teaser of full html pages without layout I have a block/view that shows teasers of the latest 3 articles.. This articles are full html, it contains layout (build with a WYSIWYG)..

On the homepage, I create a block that shows the latest 3 articles.. I can give it CSS-layout..



But because it's build with the WYSIWYG, there are extra html-tags (span, a, p, ...) in the teaser, which can be different every time. The problem is that it overwrites the default layout for the teasers..



I just want to keep the clean text on the frontpage block, and full-html on the detail page. How can I manage it?

Normally I should use strip_tags(); in PHP to remove html.. But how can I do it only for that specific block?
Add the body field and trim it.



Now in your web directory, go to /sites/all/themes/yourtheme/ folder and in template.php add the following code:

function yourtheme_preprocess_views_view_fields($vars){

  if ($vars['view']-&gt;name == "view_name" &amp;&amp; $vars['view']-&gt;current_display == "block_1") {
    $vars['fields']['body']-&gt;content = strip_tags($vars['fields']['body']-&gt;content);
  }

}



replace yourtheme with the actual name of your theme
replace view_name with the name of your view.
replace block_1 with the machine name of your view. If yours happens to be block_1 then leave it the same. 


In Drupal, clear/flush your cache to see the changes. 

Then add the other fields you want on your view, title, post date? comment link? etc... basically you create your own teaser. 

PS: You can add classes to your fields, if you need to use css on them.