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.

Displaying detailed content exclusive to a permalink title? {if title_permalink} ??

July 13, 2009 10:22am

Subscribe [3]
  • #1 / Jul 13, 2009 10:22am

    vorari

    40 posts

    Hi Folks,

    Have been using Expression Engine for a while but ran into the following problem:

    How do I conditionally display content exclusive to a permalink title?

    Consider the following scenario:

    1 > http://www.domain.com/blog <—displays all blog articles subject to pagination rules.

    2 > http://www.domain.com/blog/article_name (The permalink article)

    3 > http://www.domain.com/blog/C/category  <—- displays all articles corresponding to a given category

    I’m able to conditionally display only {summary} content for 1 and 3 using the if_category_request and if not_category_request fields.

    I’m using a simple {if:else} to redirect to the permalink article with {summary}{body}{extended}
    It is here I want to embed a third party commenting system - Disqus

    How do I ensure the URL’s like http://www.domain.com/Px/ or www.domain.com/year/month/xx don’t trip this? (Eg: When you visit the parent blog it shows only a summary of articles with a link to read more.  It does the same for categories, by only showing a summary).  But when you click on a date range it shows all the articles with all the detail - how do I ensure that even date range URL request only show a summary?

    The only rules within expression engine I can find explicitly allow me to single out a category request but not a date or pagination request.

    
    
    

    Sorry in advance if this is a naive question, but it’s really throwing me for a loop.  Another way to ask this question is how do I ensure that any summary list (be it category / date / etc) shows only a article summary and only when a fully qualified URL is passed to a single article shows it in full detail?

    I was hoping there was a command like {if title_permalink} ...

  • #2 / Jul 13, 2009 7:31pm

    Greg Aker

    6022 posts

    vorari:

    Not a bad question at all.  You are running into a problem that can crop up when you don’t use a /template_group/template/url_title setup for your links.

    You’re going to need to use some php to evaluate the URL to make sure it doesn’t contain a “P” for pagination in it.  Honestly, I’d go with the /template_group/template/url_title setup, as there are less conditionals to mess with & your templates will be leaner & quicker.

    -greg

  • #3 / Jul 13, 2009 7:39pm

    vorari

    40 posts

    Hi Greg,

    Actually we are.  The blog has the template group: latest_news.  Within this is the index template.  So I’m trying to understand what I’m missing.  Do I need another generic entry template on top of this?

    (The blog is largely based of the default expression engine default blog when it’s installed)

    Eg: Compare this behaviour on the direct expression engine site:

    http://expressionengine.com/blog/

    (You get a summary of blog entries with a permalink / read more option)

    vs.

    http://expressionengine.com/blog/2009/06

    (You get a summary of blog entries with a permalink / read more option)

    You get the same behaviour here.

    That’s all I’m trying to do.  If I have missed something extremely basic do let me know.

    Thanks,

    Nagib

  • #4 / Jul 13, 2009 8:46pm

    Greg Aker

    6022 posts

    Sorry, I’m confused.  So this is the “index” template group of the site in a template group called “latest_news”, right?

  • #5 / Jul 14, 2009 5:18am

    vorari

    40 posts

    template group = latest_news
    template = index

    so http://www.domain.com/latest_news

    When called without a url title - it’s http://www.domain.com/latest_news/index

    All I am trying to do is ensure that in all cases where any listing page is called - eg: http://www.domain.com/latest_news or www.domain.com/yyyy/mm/ or categories that a summary is shown.

    My latest_news template has 3 fields: {summary} {body} {extended}

    So I’m looking for something like this:

    index template:

    emded: header
    weblog entries tag

    if not a permalink title page (eg: a fully qualified URL)
    {
      {summary}
    }
    
    {if:else}
      {summary}
      {body}
      {extended}
    {/if}

    This is the same logic on the expression engine blog.

  • #6 / Jul 14, 2009 11:23am

    Sue Crocker

    26054 posts

    Is C your custom category word?

  • #7 / Jul 14, 2009 11:31am

    vorari

    40 posts

    Hi Sue,

    Yes.

    If there is a simpler way to do it I’m genuinely stumped.  But the expression engine blog does exactly the same thing I’m trying to do:

    Have every view defaults to displaying a brief {summary} with the option to “read more”, while the permalink article displays the full body.  But this logic should apply to all URLs that are not explicitly a permalink.

  • #8 / Jul 14, 2009 11:51am

    Sue Crocker

    26054 posts

    Something like

    if segment_3 is a url_title, show the body, otherwise display the summary?

  • #9 / Jul 14, 2009 4:34pm

    vorari

    40 posts

    exactly..  but how do I specify that logic?

    I know it must exist because I see that behaviour on the EE site.

    Hence the title - Can you have

    {if segment_3 == url_title}

    ??

  • #10 / Jul 14, 2009 7:51pm

    vorari

    40 posts

    Actually in this case it’s segment_2 == url_title, trying it out

  • #11 / Jul 14, 2009 7:56pm

    vorari

    40 posts

    works perfectly… so simple, can’t believe I missed that one.  Many thanks.

    N.

  • #12 / Jul 14, 2009 8:58pm

    Greg Aker

    6022 posts

    vorari:

    Everything seems to be working for you now?

    -greg

  • #13 / Jul 15, 2009 6:32am

    vorari

    40 posts

    Hi Greg,

    Yes - many thanks.  I didn’t realise I could do a simple test like if segment_2 == {url_title} and tried to do that complex logic above.  Cheers.

  • #14 / Jul 15, 2009 6:50am

    Ingmar

    29245 posts

    Glad to see you’re all set. Please don’t hesitate to post again as needed.

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

ExpressionEngine News!

#eecms, #events, #releases