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.

If statement for a link title

June 29, 2011 4:28pm

Subscribe [3]
  • #1 / Jun 29, 2011 4:28pm

    dodgson

    120 posts

    Hi There, I have a channel entries tag pair that lists the title and permalinks to each of the articles in that channel. One of the titles is quite long and my client has asked for it to be shortened to a specific name. I was thinking that I could create an “IF” statement for the {title}. Below is the code, but it doesn’t work. Any suggestions?

    {exp:channel:entries channel="products" orderby="screen_name" sort="asc"}
         <ul>
              <li><a href="http://{title_permalink=">{if title_permalink=site/products/boiler_openings_inspection_ports_access_doors_burner_openings}Boiler Openings{if:else}{title}{/if}</a></li>
        </ul>
    {/exp:channel:entries}

    Thanks in advance.
    Mark

  • #2 / Jun 29, 2011 7:52pm

    lebisol

    2234 posts

    simplify

    {If title = 'a'}
    link a
    {/if}
    {if title = 'b'}
    link b
    {/if}

    If it is aesthetic of a link then consider trim http://devot-ee.com/add-ons/trim-title/ or http://devot-ee.com/add-ons/trunchtml/

  • #3 / Jun 30, 2011 8:21am

    Mark Bowen

    12637 posts

    Hi Mark,

    Further to what lebisol has said you might want to consider a custom field in that Channel where a shorter title can be placed and output that instead?

    Best wishes,

    Mark

  • #4 / Jun 30, 2011 11:04am

    dodgson

    120 posts

    Great suggestions guys. Thanks for your assistance.

    Take Care
    mark

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

ExpressionEngine News!

#eecms, #events, #releases