- Posts: 5
COMMUNITY FORUM
Text running together
- Weatherly
- Topic Author
- Offline
- New Member
Less
More
8 years 11 months ago #150014
by Weatherly
Text running together was created by Weatherly
Example: withtheir shows up in the feed, but if you go straight to the rss feed page or main article it doesn't appear like that. Is there any way to correct this? I tested other readers and it didn't do that either (though none had the styling options of this one.)
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
8 years 11 months ago #150028
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Text running together
Hi,
Is there a link to the page with the issue?
Is there a link to the page with the issue?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Weatherly
- Topic Author
- Offline
- New Member
Less
More
- Posts: 5
8 years 11 months ago #150100
by Weatherly
Replied by Weatherly on topic Text running together
Here it is. It isn't doing on every single one, but is on more than one.
www.cbmmortgage.com/mortgage-news
www.cbmmortgage.com/mortgage-news
Please Log in or Create an account to join the conversation.
- Lefteris
- Offline
- Moderator
Less
More
- Posts: 8743
8 years 11 months ago #150107
by Lefteris
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Lefteris on topic Text running together
What's the URL of the feed?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Basil Clarke
- Offline
- New Member
Less
More
- Posts: 12
8 years 4 months ago #156247
by Basil Clarke
Replied by Basil Clarke on topic Text running together
I have the same problem. I think the regular expression that is used to remove html formatting is probably causing this. For instance, a <br /> tag is replaced by nothing, which causes words to run together. It would be better to replace <br /> by a space. Also, spaces are removed after colons - I think your regular expressions must be replacing a double space with nothing. For examples, have a look at the home page of www.palmersgreencommunity.org.uk. The Latest News and Comments module is a Simple RSS module which I use to create a combined feed of articles and forum comments.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 4 months ago #156258
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Text running together
Hello Basil,
Thank you for reporting this.
From a quick read through your posts, I noticed that you are using multiple instances of which if not stripped, it might break your layout. (Example here: www.palmersgreencommunity.org.uk/pgc/forum/council-services/532-changes-at-bowes-road-and-southgate-circus-libraries#2179)
Is it possible to have the feed's URL as well?
Thank you for reporting this.
From a quick read through your posts, I noticed that you are using multiple instances of which if not stripped, it might break your layout. (Example here: www.palmersgreencommunity.org.uk/pgc/forum/council-services/532-changes-at-bowes-road-and-southgate-circus-libraries#2179)
Is it possible to have the feed's URL as well?
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Basil Clarke
- Offline
- New Member
Less
More
- Posts: 12
8 years 4 months ago - 8 years 4 months ago #156262
by Basil Clarke
Replied by Basil Clarke on topic Text running together
Hi Krikor,
Thanks for looking into this.
There are two feeds:
www.palmersgreencommunity.org.uk/pgc/index.php/forum/recent/posts/sel-720?format=feed&type=rss
www.palmersgreencommunity.org.uk/pgc/index.php/local-news?format=feed&type=rss
I didn't explain that I'm using a custom Simple RSS template which it turns out was adding the non-breaking space instances. However, they were actually in a bit of code that I'd discontinued and commented out instead of deleting. Depending on which RSS feed was the source, I was adding "News: " or "Comment by: " before the subject line, but a while back I changed this. I've now deleted the commented out parts and you will see far fewer non-breaking spaces in the html source.
I've identified two cases where words are run together, but there may be more:
1. Article titles with a colon followed by two spaces. I went into the Hate Crime article and edited the title, removing one of the spaces after the title (which in any case would have been ignored by the browser, so there was no point in having a second space). Simple RSS new shows the space after the colon.
2. Between items in a list. If you again look at how the Hate Crime item is displayed in Simple RSS Feed Reader you'll see words running together. These are items in a list:
<p>CRIME motivated by PREJUDICE is HATE CRIME Don’t suffer in silence – we want you to REPORT IT to us.</p>
<ul>
<li>Verbal Abuse</li>
<li>Bullying</li>
<li>Physical Abuse</li>
<li>Vandalism</li>
<li>Intimidation</li>
<li>Threats</li>
<li>Harassment</li>
</ul>
Normally, lists come further down an article, so aren't included in the bit of text output by Simple RSS Reader.
Ideally, the function that you use to strip tags should insert a space in such cases, for instance by replacing </li> by ' ' rather than by ''.
Thanks for looking into this.
There are two feeds:
www.palmersgreencommunity.org.uk/pgc/index.php/forum/recent/posts/sel-720?format=feed&type=rss
www.palmersgreencommunity.org.uk/pgc/index.php/local-news?format=feed&type=rss
I didn't explain that I'm using a custom Simple RSS template which it turns out was adding the non-breaking space instances. However, they were actually in a bit of code that I'd discontinued and commented out instead of deleting. Depending on which RSS feed was the source, I was adding "News: " or "Comment by: " before the subject line, but a while back I changed this. I've now deleted the commented out parts and you will see far fewer non-breaking spaces in the html source.
I've identified two cases where words are run together, but there may be more:
1. Article titles with a colon followed by two spaces. I went into the Hate Crime article and edited the title, removing one of the spaces after the title (which in any case would have been ignored by the browser, so there was no point in having a second space). Simple RSS new shows the space after the colon.
2. Between items in a list. If you again look at how the Hate Crime item is displayed in Simple RSS Feed Reader you'll see words running together. These are items in a list:
<p>CRIME motivated by PREJUDICE is HATE CRIME Don’t suffer in silence – we want you to REPORT IT to us.</p>
<ul>
<li>Verbal Abuse</li>
<li>Bullying</li>
<li>Physical Abuse</li>
<li>Vandalism</li>
<li>Intimidation</li>
<li>Threats</li>
<li>Harassment</li>
</ul>
Normally, lists come further down an article, so aren't included in the bit of text output by Simple RSS Reader.
Ideally, the function that you use to strip tags should insert a space in such cases, for instance by replacing </li> by ' ' rather than by ''.
Last edit: 8 years 4 months ago by Basil Clarke.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 4 months ago #156316
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Text running together
The default strip_tags() function of PHP - php.net/manual/en/function.strip-tags.php - is being used.
Strip_tags() does not leave any spaces when it removes the tags so there is a possibility of text running together.
I can look into a preg_replace() solution but it can cause some issues if there are stray < and > characters in your text.
Strip_tags() does not leave any spaces when it removes the tags so there is a possibility of text running together.
I can look into a preg_replace() solution but it can cause some issues if there are stray < and > characters in your text.
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.
- Basil Clarke
- Offline
- New Member
Less
More
- Posts: 12
8 years 4 months ago #156362
by Basil Clarke
Replied by Basil Clarke on topic Text running together
i've added two lines to the helper.php file to fix (a) the issue of no space after a colon and (b) words running together when there is a list near the beginning of the feed item. Of course, there may be unwanted consequences...
This adds a space after a colon in the title
Adds a space between the end of a tag and the start of another tag.
// Clean up the feed title
$feedItem->itemTitle = trim(htmlentities($feedItem->itemTitle, ENT_QUOTES, 'utf-8'));
$feedItem->itemTitle = str_replace(":",": ",$feedItem->itemTitle); //ADDED BY BASIL
This adds a space after a colon in the title
// Word Limiter
function wordLimiter($str,$limit=100,$end_char='[…]'){
if (trim($str) == '') return $str;
$str = str_replace("><","> <",$str); //ADDED BY BASIL
$str = strip_tags($str);
preg_match('/\s*(?:\S*\s*){'. (int) $limit .'}/', $str, $matches);
if (strlen($matches[0]) == strlen($str)) $end_char = '';
return rtrim($matches[0]).$end_char;
Adds a space between the end of a tag and the start of another tag.
Please Log in or Create an account to join the conversation.
- Krikor Boghossian
- Offline
- Platinum Member
Less
More
- Posts: 15920
8 years 4 months ago #156370
by Krikor Boghossian
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Replied by Krikor Boghossian on topic Text running together
This is an interesting solution, using reg ex.
stackoverflow.com/questions/12824899/strip-tags-replace-tags-by-space-rather-than-deleting-them
preg_replace('#<[^>]+>#', ' ', $str);
stackoverflow.com/questions/12824899/strip-tags-replace-tags-by-space-rather-than-deleting-them
JoomlaWorks Support Team
---
Please search the forum before posting a new topic :)
Please Log in or Create an account to join the conversation.