1. Kayako Download customers: we will continue to develop and support Kayako Download beyond July 2017, alongside the new Kayako for existing customers.

    Find out more.

  2. The forum you are viewing relates to Kayako Classic. If you signed up or upgraded to the new Kayako (after the 4th July 2016), the information in this thread may not apply to you. You can visit the forums for the new Kayako here.

News items and read more button

Discussion in 'Style and design' started by infidel, Nov 8, 2011.

  1. infidel

    infidel Member

    I know it might sound silly, but i create large news items and i do not want all of the contents to appear right away. I want the user to view the first 10 lines and read the rest when he clicks on read more. How do i break the news content like that?
     
  2. Gary McGrath

    Gary McGrath Staff Member

    Hi there,

    In the template ( newslist ), find the line: <{$_newsItem[contents]}> and simply change it to <{truncate($_newsItem[contents] 200)}>

    And change 200 for how many characters you wish it to show by default, then on the bottom there is an read more link which will open up the entire news content

    Gary
     
  3. infidel

    infidel Member

    Thanx! It worked for the news widget, and i did the same for homeindex.
     
  4. Gary McGrath

    Gary McGrath Staff Member

    Your welcome :)

    Gary
     
  5. masterctrl1

    masterctrl1 Kayako Guru

    We used Gary's suggestion as well, but Kayako really needs to support this function natively with setup options.
    Example:
    _ Show full article (supress Read More), or _ Show titles only, or _ Show first xxx characters
    Plus an option to group News by category: Yes/No If Yes displays category titles and count on main page.
    Then visitors can click on News, pick a category of interest, scroll thru titles, and read more if they want to.
    The current default (full article, no grouping) is useless once you've added more than a couple news articles or one long one.
     
  6. Errol LeBoydre

    Errol LeBoydre New Member

    Where would I need to change this to also reflect in the staff portal? Where it displays the news items on the opening dashboard I would like the contents truncated.

    Cheers

    Errol
     
  7. Gary McGrath

    Gary McGrath Staff Member

    Version: Self Hosted only.
    file: class.SWIFT_NewsRenderManager.php
    location: __modules\news\library\Render

    find near line 206:

    Code:
    
    $_newsItem['contents']
    
    
    and repalce with this

    Code:
    
    StripName($_newsItem['contents'],200)
    
    
    Gary
     
  8. Neil-UKWSD

    Neil-UKWSD Kayako Guru

    Hi,

    It would be good if this was an added as a configurable option, sure the old v3 used to have this for news kind of defeats the purpose of the Read More link if the full atricle is shown on the index page or on the article listing page.
     
  9. Ali Dursun

    Ali Dursun Member

    That doesn't worked for me in Kayako Version 4.53.2633

    here my code:

    $_renderHTML .= '<tr><td colspan="2" class="newscontents">' . StripName($_newsItem['contents'],200) . '<br /><a class="newsreadmorelink" href="' . SWIFT::Get('basename') . '/News/NewsItem/ViewItem/' . $_newsItemID . '" viewport="1" title="' . htmlspecialchars($_newsItem['subject']) . '">' . $this->Language->Get('nwreadmore') . '</a></td></tr>';

    any other suggestions?
     
  10. Gary McGrath

    Gary McGrath Staff Member

    Hi Ali,

    That should work, can you goto admin CP, diagnostics and rebuild your cache. Then on your browser, please clear your temp internet files, as I think it might just be a caching issue

    N.b. Also note that there are two changes posted here, one to reflect changes for staff, and the other for end users, which are you trying to edit? the end users one is just a template edit.

    Gary
     
  11. Ali Dursun

    Ali Dursun Member

    i've made it for staff portal, here

    Version: Self Hosted only.
    file: class.SWIFT_NewsRenderManager.php
    location: __modules\news\library\Render

    ** how/where to affect it to users / clients??
     
  12. Gary McGrath

    Gary McGrath Staff Member

    Hi Ali,

    Check the posts further up, I posted a change for the news template for end users.

    Gary
     
  13. cmonteiro

    cmonteiro Member

    Hi Gary,

    I'm trying to do this on 4.69 version and it does not seems to be working. Any idea?
    I have rebuilt the cache, opened a new browser and nothing changed.
     
  14. Gary McGrath

    Gary McGrath Staff Member

    What one are you trying to do? ( staff CP or client support centre )

    Gary
     
  15. cmonteiro

    cmonteiro Member

    The client front end, modifying the templates.
     
  16. Gary McGrath

    Gary McGrath Staff Member

    I just tried it myself and it worked fine, can you copy and paste your current newsitem template code?

    Gary
     
  17. cmonteiro

    cmonteiro Member

    I was afraid it was something I was doing wrong. Thanks for the help Gary. Here it is:


    Code:
    <div class="boxcontainer">
                <div class="boxcontainerlabel"><{if $_settings[nw_enablerss] == '1'}><div style="float: right;"><a href="<{$_swiftPath}>rss/index.php?/News/Feed" title="<{$_language[rssfeed]}>" target="_blank"><img src="<{$_themePath}>images/icon_rss.png" align="absmiddle" alt="<{$_language[rssfeed]}>" border="0" /></a></div><{/if}><{$_language[news]}></div>
    
    <div class="orangeBox"></div><div class="grayBox"></div>
    
                <div class="boxcontainercontent">
                    <table cellpadding="0" cellspacing="0" border="0" class = "containercontenttable">
                        <tr>
                            <td class="newstitlecontainer" width="60" align="left" valign="top">
                                <div class="datecontainerparent">
                                <div class="monthholder"><div class="monthsub"><{$_newsItem[parsedmonth]}></div></div>
                                <div class="dateholder"><div class="datecontainer"><{$_newsItem[parseddate]}></div></div>
                                </div>
                            </td>
    
                            <td width="100%" valign="top">
                                <div class="newsavatar"><img src="<{$_baseName}><{$_templateGroupPrefix}>/Base/StaffProfile/DisplayAvatar/<{$_newsItem[staffid]}>/<{$_newsItem[emailhash]}>/60" align="absmiddle" border="0" /></div>
                                <div class="newstitle"><a class="newstitlelink" href="<{$_baseName}><{$_templateGroupPrefix}>/News/NewsItem/View/<{$_newsItem[newsitemid]}>/<{$_newsItem[urlextension]}>" title="<{$_newsItem[subject]}>"><{$_newsItem[subject]}></a></div>
                                <div class="newsinfo"><{$_language[postedby]}> <{$_newsItem[author]}> <{$_language[on]}> <{$_newsItem[date]}></div>
                            </td>
                        </tr>
                        <tr><td colspan="2" class="newscontents">
                            <{truncate($_newsItem[contents] 200)}>
                        </td></tr>
                        <tr>
                        <td colspan="2"><hr class="newshr" /></td>
                        </tr>
                    </table>
    
                    <{if $_newsItem[allowcomments] == '1'}>
                    <{RenderTemplate name="comments"}>
                    <{/if}>
                </div>
                </div>
     
  18. Gary McGrath

    Gary McGrath Staff Member

    Is your news displaying at all? your template seems heavily customised and is missing key parts from what I can see.

    What is actually happening?

    Gary
     
  19. cmonteiro

    cmonteiro Member

    It is showing normally. The only thing is that is does not truncate at all.
    I don't recall any reason why it should be customized as you put it. Should I only restore it and insert the truncate part? That would do it?
     
  20. Gary McGrath

    Gary McGrath Staff Member

    In terms of it not truncating, can you change the value to say 10 rather than 200, and see if it is working?

    sometimes 200 is too many, so you see the entire article anyway

    Gary
     

Share This Page