News box

Post

Posted
Rating:
#1219 (In Topic #303)
After trying many forums and CMSs I am incredibly happy with composr. So many features.

One issue I did notice is when you post an article in news with an external image, where the image is larger than the text area, the image stays full size where the overflow of the image is hidden. As a temp fix i needed to include the following in the global.css.

.box img {
    border: 0;
    object-fit: contain;
    max-width: 725px;
}

Being new to composr though I am struggling to achieve the attached image for the main news block on the front page. And having it strip all html from the text.

Image

Untitled15.jpg

Untitled15.jpg

(Click to enlarge)

Post

Posted
Rating:
#1221
Hi Paul,

We'll consider a universal max-width rule for v11, I think people are expecting it now rather than setting image sizes.

You can strip out HTML in Tempcode using the STRIP_HTML symbol. Try this change in NEWS_BOX.tpl

Code

      {+START,IF,{TRUNCATE}}{$TRUNCATE_LEFT,{NEWS},400,0,1,0,0.4}{+END}
      {+START,IF,{$NOT,{TRUNCATE}}}{NEWS}{+END}

Code

      {+START,IF,{TRUNCATE}}{$STRIP_HTML*,{$TRUNCATE_LEFT,{NEWS},400,0,1,0,0.4}}{+END}
      {+START,IF,{$NOT,{TRUNCATE}}}{$STRIP_HTML*,{NEWS}}{+END}

The '*' is because it needs to be re-escaped after being converted into text.

Or, you could just set the news summary field manually to be plain for each article.

Post

Posted
Rating:
#1223
Thankyou very much.

www.g4manic.com is my website, still a lot of work to go yet.
Thankyou for the fantastic software.

Last edit: by Paul Flavel

1 guest and 0 members have recently viewed this.