News box
Posted
#1176
(In Topic #255)

Standard member

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.
Untitled15.jpg
Posted

Site director

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.
Become a fan of Composr on Facebook or add me as a friend. Add me on on Mastodon. Follow me on Minds (where I am most active). Support me on Patreon
- If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
- If so, please let others know about Composr whenever you see the opportunity or support me on Patreon.
- If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying Composr on fun personal projects.
- If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
Posted

Standard member

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 just viewed this.