Portal Engine Questions on portal engine and web parts.
Version 5.x > Portal Engine > LimitLength transformation problem View modes: 
User avatar
Member
Member
jonm-latinlink - 4/5/2012 10:43:59 AM
   
LimitLength transformation problem
Hi there,

I'm getting strange behaviour when the following transformation is used with a setting >0

<%# LimitLength(Eval("NewsSummary"), 50 , "...") %>

If it's >0 then the text isn't shortened at all and it messes up all the layout on the rest of the page.

Is this a problem specific to our website implementation or is this occurring as a Kentico bug?

One possible solution might be to reduce the font size of the text drawn in so that even if the limit is set to 0 and all the summary news text is displayed, it is small and so doesn't take up much room. How could I do this?

I tried this but it didn't change the font size.
<div class="NewsPreviewSummary"><span style="font-size:x-small"<%# LimitLength(Eval("NewsSummary"), 0 , "...") %></span></div>

Any advice much appreciated

Jon

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 4/6/2012 3:24:20 AM
   
RE:LimitLength transformation problem
Hello,

I've tried to use the given transformation on my end and it is working just fine. I've used exactly the one you've posted:

<%# LimitLength(Eval("NewsSummary"), 50 , "...") %>


Could you please post a screenshot of the issue?

Best regards,
Boris Pocatko

User avatar
Member
Member
jonm-latinlink - 4/10/2012 5:52:43 AM
   
RE:LimitLength transformation problem
OK, so this is when the LimitLength is set to 0 for the LatestNews webpart transformation:

User image

And this is what happens when it's set to 50. Notice how the formatting is incorrect and that it doesn't even bring in the text for the LatestNews web part now:

User image

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 4/11/2012 6:13:51 AM
   
RE:LimitLength transformation problem
Hello,

Regrettably, I can't see the images. Could you please try to re-upload them somewhere else?

Best regards,
Boris Pocatko

User avatar
Member
Member
jonm-latinlink - 4/11/2012 6:15:10 AM
   
RE:LimitLength transformation problem
Sorry, image working now.

Before:
User image

After::
User image

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 4/11/2012 6:23:02 AM
   
RE:LimitLength transformation problem
Hello,

Could you please post the html code snippet generated in both cases by this method?

Best regards,
Boris Pocatko

User avatar
Member
Member
jonm-latinlink - 4/11/2012 6:29:20 AM
   
RE:LimitLength transformation problem
Is this what you mean?

Before:
<div class="navPanel news">
<img id="plc_lt_zoneMain_pageplaceholder_pageplaceholder_lt_zoneNews_imageNews_imgImage" src="/getmedia/0ca91938-954c-41a7-b80b-c3d1fc6a02bf/easter-parade-small-200x100.gif.aspx?width=200&height=100" alt="" style="border-width:0px;" /><h2><a href="/National-Sites/UK/News">NEWS</a></h2>


<div class="NewsPreviewTitle"><a href="/National-Sites/UK/News/NewsHolder/Reverse-Missionaries">'Reverse Missionaries'</a></div>

<div class="NewsPreviewDate">04/04/2012</div>

<div class="NewsPreviewSummary"><div style="margin: 0cm 0cm 10pt"><span style="line-height: 115%; font-size: 12pt">The recent BBC series, 'Reverse Missionaries', was quite a hit! Latin Link calls this 'multi-directional mission', and it's something we are passionate about.</span></div></div>

<p><a href="/National-Sites/UK/News" class="linkHighlightHome"><span>Read More</span></a><img src="/images/newsArrow.gif" width="51" height="26" /></p>
</div>
</div>


After:
<div class="navPanel news">
<img id="plc_lt_zoneMain_pageplaceholder_pageplaceholder_lt_zoneNews_imageNews_imgImage" src="/getmedia/0ca91938-954c-41a7-b80b-c3d1fc6a02bf/easter-parade-small-200x100.gif.aspx?width=200&height=100" alt="" style="border-width:0px;" /><h2><a href="/National-Sites/UK/News">NEWS</a></h2>


<div class="NewsPreviewTitle"><a href="/National-Sites/UK/News/NewsHolder/Reverse-Missionaries">'Reverse Missionaries'</a></div>

<div class="NewsPreviewDate">04/04/2012</div>

<div class="NewsPreviewSummary"><div style="margin: 0cm 0cm 10pt"><span style="...</div>

<p><a href="/National-Sites/UK/News" class="linkHighlightHome"><span>Read More</span></a><img src="/images/newsArrow.gif" width="51" height="26" /></p>
</div>
</div>

User avatar
Kentico Consulting
Kentico Consulting
kentico_borisp - 4/11/2012 6:47:14 AM
   
RE:LimitLength transformation problem
Hello,

Yes, that's exactly what I meant. The problem in your case is, that you are using html code for your description. That means, that tags are used in the text and the given method takes the first N characters, it doesn't differentiate between tags or text. The problem in your case is the line below:

<div style="margin: 0cm 0cm 10pt"><span style="...</div>



Best regards,
Boris Pocatko

User avatar
Member
Member
jonm-latinlink - 4/11/2012 10:41:53 AM
   
RE:LimitLength transformation problem
Ah, that's exactly it. It's working now. Thanks so much!