displaying content without images

7 posts by 5 authors in: Forums > CMS Builder
Last Post: November 29, 2011   (RSS)

how do I display the content section without any placed images? this is for the list view section. here's what's there now..

<?php if ($record['content']): ?>
<?php echo $record['content'] ?>
<?php endif ?>

John Tedesco

Creative Director



JAM Graphics

Re: [jtedescojam] displaying content without images

By Jason - January 12, 2011

Hi,

You could use the php function strip_tags() to remove all the HTML tags from the content field:

<?php if ($record['content']): ?>
<?php echo strip_tags($record['content']); ?>
<?php endif ?>


Hope this helps.
---------------------------------------------------
Jason Sauchuk - Project Manager
interactivetools.com

Hire me! Save time by getting our experts to help with your project.
http://www.interactivetools.com/consulting/

Re: [Jason] displaying content without images

yes that's it!
John Tedesco

Creative Director



JAM Graphics

Re: [Jason] displaying content without images

By Mikey - November 28, 2011

Hi,

You could use the php function strip_tags() to remove all the HTML tags from the content field:

<?php if ($record['content']): ?>
<?php echo strip_tags($record['content']); ?>
<?php endif ?>


Hope this helps.


Jason, is there by chance another way to strip out photos uploaded in the content wysiwyg without stripping out HTML tags? I need to remove photos uploaded to the content, but retain HTML tags in my content for links to other websites, and such.

Thanks, Zick

Re: [zick] displaying content without images

By robin - November 29, 2011

Hey Zick,

Here is a line with a regular expression that should strip out any img tag:

echo preg_replace("/<img[^>]+\>/i", "", $record['content']);

Hope it helps you out
Robin
Robin
Programmer
interactivetools.com

Re: [robin] displaying content without images

By Mikey - November 29, 2011

Thanks Robin... works great and is exactly what I need!
Zick