ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

I want to display only one entry from Multi-Text

December 16, 2011 10:16am

Subscribe [2]
  • #1 / Dec 16, 2011 10:16am

    JayJ

    10 posts

    Hi there,

    I have a website that, amongst other things, promotes some training courses. One of the key fields for this particular weblog is the one for dates. It is a Multi-text field with two columns (location and date).

    So periodically I have to go in an edit the training course pages to add new dates and locations as they are scheduled.

    Currently, the live training page lists all the courses in a table, with the course code in column 1, title in column 2, and then all the dates in column 3.

    <table id="mytable" cellspacing="0" summary="Training Course Schedule">
    
       <caption>Course Summaries - click course title for more information</caption>
    
       <tr>
          <th scope="col" abbr="Code" class="code">ID</th>
          <th scope="col" abbr="Title" class="tctitle">Course Title</th>
          <th scope="col" abbr="Date" class="tcdate">Dates</th>
       </tr>
     
       {exp:weblog:entries weblog="{my_weblog}" disable="categories|member_data|pagination|trackbacks" orderby="course_code" sort="asc"}
    
          <tr>
             <td class="right">{course_code}</td>
             <td class="title"><a href="http://{path=" title="View {title} course details">{title}</a></td>
    
             {if course_dates!=""}
                <td>{course_dates}{col_2}
    {/course_dates}</td>
                {if:else}
                    <td>No Dates</td>
                {/if}
          </tr>
    
       {/exp:weblog:entries}
    
    </table>

    All this works fine, although - as we’ve started offering more dates for the more popular courses, it’s starting to look a bit long and untidy for these entries.

    I was wondering, is it possible to display only one entry of this course_date {col_2} value?

    I should add that this website was not built by me, and so none of this code is mine, and so although I follow most of it (kind of) - my attempts to display only the first date for a course has not been very successful this far - hence my call for help.

    Cheers, Jay

     

     

     

     

     

     

     

     

     

  • #2 / Dec 16, 2011 5:59pm

    e-man

    1816 posts

    Are you referring to Mark Huot’s multi text?
    Your best bet is to do some kind of post processing on course_date {col_2}, search devot-ee for EE1 plugins that truncate html or have string functions.
    Another option, but I’m not sure if that’s possible, would be to convert the multi text field to a matrix http://pixelandtonic.com/matrix field, then you limit the amount of columns you show.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases