Main
Index
Search
Posts
Who's
Online
Log
In

Home: Products: CMS Builder:
displaying content without images

 

 


jtedescojam
User

Jan 12, 2011, 10:30 AM

Post #1 of 7 (452 views)
Shortcut
displaying content without images Can't Post

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


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

John Tedesco
Creative Director

JAM Graphics


Jason
Staff / Moderator


Jan 12, 2011, 11:43 AM

Post #2 of 7 (451 views)
Shortcut
Re: [jtedescojam] displaying content without images [In reply to] Can't Post

Hi,

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


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


Hope this helps.
---------------------------------------------------
Jason Sauchuk - Programmer 
interactivetools.com

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


jtedescojam
User

Jan 12, 2011, 11:52 AM

Post #3 of 7 (450 views)
Shortcut
Re: [Jason] displaying content without images [In reply to] Can't Post

yes that's it!
John Tedesco
Creative Director

JAM Graphics


zick
User

Nov 28, 2011, 3:26 PM

Post #4 of 7 (338 views)
Shortcut
Re: [Jason] displaying content without images [In reply to] Can't Post


In Reply To
Hi,

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


Code
<?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


robin
User / Moderator


Nov 29, 2011, 9:38 AM

Post #5 of 7 (336 views)
Shortcut
Re: [zick] displaying content without images [In reply to] Can't Post

Hey Zick,

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


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


Hope it helps you out
Robin


zick
User

Nov 29, 2011, 10:11 AM

Post #6 of 7 (333 views)
Shortcut
Re: [robin] displaying content without images [In reply to] Can't Post

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


InHouse
User

Nov 29, 2011, 12:35 PM

Post #7 of 7 (322 views)
Shortcut
Re: [zick] displaying content without images [In reply to] Can't Post

Another approach would be just to suppress the display of the images using CSS.


Code
 
.myArticle img {display: none; visibility: hidden;}


It's belt and braces, but it will work.

J.