eZ Community » Forums » Developer » Is it possible to fetch only the...
expandshrink

Is it possible to fetch only the first two line of the article in ezPublish?

Is it possible to fetch only the first two line of the article in ezPublish?

Thursday 17 May 2012 5:13:22 pm - 5 replies

Hello everyone;

I would like to know if it is possible in Line view in Ezpublish , to have the first two line of my articles?

What I have used up until now is to use the summary or intro. but is it possible not to have summary? only first two lines of the text?

Thursday 17 May 2012 5:51:56 pm

Hi,

There are couple of ways to "kind of" do it:

- either with CSS just hide the rest of text (but you still have the text in HTML)

- or use ez template shorten operator in line view (but then it is hard to guess exactly how many characters you have in 2 lines), but this does not work with ezxml datatype (rich editor) as you have markup, so you need to striptags before the shorten.

Hope this helps

Thursday 17 May 2012 6:31:13 pm

Thank you very much for your answer Ivo,

I meant something like when you search something in the forum of share.ez.no.

It should not be with css and even it find the text which has been written with block xml.

Is it some thing else?

Thursday 17 May 2012 6:40:39 pm

Quote from Yara So :

Thank you very much for your answer Ivo,

I meant something like when you search something in the forum of share.ez.no.

It should not be with css and even it find the text which has been written with block xml.

Is it some thing else?

What you see when you search in the result is highlighted text returned from the search engine, something completely different happy.gif Emoticon

Thursday 17 May 2012 6:48:21 pm

Ok then! big-smile.gif Emoticon

So.. thank you very much i try to continue to use my intro , but it could be interesting if it existed indeed!

Friday 18 May 2012 10:26:19 am

The smart short extension was written to address shortening text in an xmlblock.  http://projects.ez.no/smartshort

But this won't help cutting something down to two sentences since the length of a sentence is variable.  But, I don't think it would be that hard to write something that would split the output based on sentence endings [.?!]  It does get dicey when you have sentences ending in parenthetical statements though and maybe with multilingual output.  Hmm.

Usually what is done is the standard intro/body thing with the intro essentially being what is displayed in the line view (your two sentences) and the the intro + body being the text.  Of course this creates more work for editors.

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from