- Messaggi: 49
- Ringraziamenti ricevuti 0
Results formatting introducing extra spacing
- sa
- Autore della discussione
- Offline
- Anziano Utente
Less
Di più
12 Anni 10 Mesi fa #385
da sa
Results formatting introducing extra spacing è stato creato da sa
Hi,
In some of our articles, we have 3 images surrounded by a p tag before the text content.
In the CP search results, it correctly displays the first image only, but seems to leave spacing between the image and the text. "<p align="center"> </p>"
Sometimes it leaves extra spacing even when there is only one image at the start of the article.
There is no extra spacing seen in the article content itself between the image and text, so I think it's being created by CP.
Any ideas on how to fix this?
In some of our articles, we have 3 images surrounded by a p tag before the text content.
In the CP search results, it correctly displays the first image only, but seems to leave spacing between the image and the text. "<p align="center"> </p>"
Sometimes it leaves extra spacing even when there is only one image at the start of the article.
There is no extra spacing seen in the article content itself between the image and text, so I think it's being created by CP.
Any ideas on how to fix this?
Si prega Accesso o Crea un account a partecipare alla conversazione.
- andrea_4g
- Offline
- Amministratore
Less
Di più
- Messaggi: 1122
- Ringraziamenti ricevuti 163
12 Anni 10 Mesi fa #392
da andrea_4g
Risposta da andrea_4g al topic Re: Results formatting introducing extra spacing
That '<p align="center">...' doesn't look like Custom Properties HTML output.
Here's CP rendering of the thumbnail image (no <p> tags inside)
My guess is that images - in those articles - are indeed surrounded by <p align="center">. When preparing the results, Custom Properties strips all them images from the article, leaving untouched all other tags. So, only those empty <p>, formerly sourrounding the images, remain.
Here's CP rendering of the thumbnail image (no <p> tags inside)
Code:
<div style="width: 100px; height: 100px;" class="cp_image"><a href="/wine/14-pink-wines/23-salice-salentino-rose.html"><img width="65" height="100" class="cp_image" title="Salice salentino rosè" alt="Salice salentino rosè" src="/components/com_customproperties/images/wine/salice_thumb.jpg"/></a></div>
My guess is that images - in those articles - are indeed surrounded by <p align="center">. When preparing the results, Custom Properties strips all them images from the article, leaving untouched all other tags. So, only those empty <p>, formerly sourrounding the images, remain.
Si prega Accesso o Crea un account a partecipare alla conversazione.
- sa
- Autore della discussione
- Offline
- Anziano Utente
Less
Di più
- Messaggi: 49
- Ringraziamenti ricevuti 0
12 Anni 10 Mesi fa #394
da sa
Risposta da sa al topic Re: Results formatting introducing extra spacing
Yes, I think you're right. There seems to be a correspondence between the number of and the number of imgs beyond 1. The question is what is the best solution to fix this?
I see here a solution for wordpress that strips the p tags off of images: css-tricks.com/snippets/wordpress/remove...-from-around-images/
Is it possible to add run this function on the content before the CP processsing?
or would it be better to write a php function to remove any p tags containing only 's
Thanks
I see here a solution for wordpress that strips the p tags off of images: css-tricks.com/snippets/wordpress/remove...-from-around-images/
Is it possible to add run this function on the content before the CP processsing?
or would it be better to write a php function to remove any p tags containing only 's
Thanks
Si prega Accesso o Crea un account a partecipare alla conversazione.
- andrea_4g
- Offline
- Amministratore
Less
Di più
- Messaggi: 1122
- Ringraziamenti ricevuti 163
12 Anni 10 Mesi fa - 12 Anni 10 Mesi fa #396
da andrea_4g
Risposta da andrea_4g al topic Re: Results formatting introducing extra spacing
The solution you posted does a different thing: removes <p> around the image; you'll then have have all images inside you articles without the surrounding <p>, whether you like it or not (<p> are usually there with a purpose, such as controlling the correct positioning).
Manipulating an HTML text is quite a tricky subject, usually resource intensive, that easily leads to undesired results. If we managed to include a function to strip <p> around images we could very possibly strip legit text.
For example, a code like:
Would be *very* problematic to handle.
So, to solve the problem I'd try using the Title + Plain Text + Image view, instead of the Title + HTML Intro. If you don't need HTML elements in search results, that will work.
Manipulating an HTML text is quite a tricky subject, usually resource intensive, that easily leads to undesired results. If we managed to include a function to strip <p> around images we could very possibly strip legit text.
For example, a code like:
Code:
<p> some text <img src="something"/> other text <p> a nested paragraph</p> more text </p>
So, to solve the problem I'd try using the Title + Plain Text + Image view, instead of the Title + HTML Intro. If you don't need HTML elements in search results, that will work.
Ultima Modifica 12 Anni 10 Mesi fa da andrea_4g.
Si prega Accesso o Crea un account a partecipare alla conversazione.
- sa
- Autore della discussione
- Offline
- Anziano Utente
Less
Di più
- Messaggi: 49
- Ringraziamenti ricevuti 0
12 Anni 10 Mesi fa #397
da sa
Risposta da sa al topic Re: Results formatting introducing extra spacing
This suggestion works perfectly. Thanks!
Si prega Accesso o Crea un account a partecipare alla conversazione.
Tempo creazione pagina: 0.136 secondi