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.

index.php/channel/category/entry-url-title

February 14, 2011 4:39am

Subscribe [3]
  • #31 / Feb 16, 2011 8:29am

    maxi

    220 posts

    Hmmm nop not working, I’m using this…

    {exp:channel:entries channel="orologi" {if segment_3 != ""} url_title="{segment_3}"{/if} limit="3" disable="pagination|member_data|custom_fields" }
    {if segment_3 != ""}
    {embed="orologi/.head" page_title="{title} MySite"}
       {if:else}
         {categories}
           {if segment_2 != ""}
        {embed="orologi/.head" page_title="{category_name} MySite"}
           {if:else}
        {embed="orologi/.head" page_title="MySite"}
      {/if}
      {/categories}
    {/if}
    {/exp:channel:entries}
  • #32 / Feb 16, 2011 12:19pm

    Barry Cogan

    291 posts

    Just for clarity I’ll put the whole thing.

    Template group: site (set as the default)

    Template One: Site/index

    {embed="site/header"}
    {exp:channel:entries channel="{segment_1}" {if segment_3 != ""} url_title="{segment_3}"{/if} {if segment_2 == ""} limit="3"{/if} }
    {if segment_3 != ""}
      <h1>{title}</h1>
    {if:else}
      {categories}
      {if segment_2 != ""}
        {if category_url_title == "{segment_2}"}
        <a href="http://{site_url}/{channel_short_name}/{category_url_title}/{url_title}">{entry_id}: {title}</a>
    
        {/if}
      {if:else}
        <a href="http://{site_url}/{channel_short_name}/{category_url_title}/{url_title}">{entry_id}: {title}</a>
    
      {/if}
      {/categories}
    {/if}
    {/exp:channel:entries}
    {embed="site/footer"}

    Template 2: Site/header

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html >
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      {exp:channel:entries channel="{segment_1}" {if segment_3 != ""} url_title="{segment_3}"{/if} limit="3" disable="pagination|member_data" }
        {if segment_3 != ""}
        <title>MySite - {title}</title>
        {if:else}
          {categories}
          {if segment_2 != ""}
        <title>MySite - {category_name}</title>
          {if:else}
        <title>MySite - {channel}</title>
          {/if}
          {/categories}
        {/if}
      {/exp:channel:entries}
    </head>
    <body>

    Template 3: Site/footer

    </body>
    </html>
  • #33 / Feb 16, 2011 12:58pm

    maxi

    220 posts

    Hmmm nop I get the full URI in the page title :-s

  • #34 / Feb 16, 2011 1:30pm

    Barry Cogan

    291 posts

    You get the full URI using the three templates I posted above?

    This started happening after we started embedding the header template right?
    What are the contents of your .head template file?

  • #35 / Feb 16, 2011 1:55pm

    maxi

    220 posts

    Yep indeed, I’m using this

  • #36 / Feb 16, 2011 8:08pm

    maxi

    220 posts

    Any luck? What am I doing wrong? 😊

  • #37 / Feb 17, 2011 3:59pm

    Barry Cogan

    291 posts

    Got it to work, needed some tweaking on my end 😊

    Do you remember what you tweaked to make it behave?

    Hmmm. Did you copy and paste my exact three test templates into a group and see if they worked for you?
    Or did you just insert the code into your existing template?

    Please try it using my unmodified example to make sure that there is not something else at work.

    Also may I see how you are embedding the header into your template?

    Thanks 😊

    Barry

  • #38 / Feb 17, 2011 7:33pm

    maxi

    220 posts

    Do those 3 ones pieces of code work for you?

    I get this rendered

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html >
    <head>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      
    </head>
    <body> 
    
    </body>
    </html>


    I embed the header with this in the index

    {embed="orologi/.head"}

  • #39 / Feb 17, 2011 7:55pm

    Barry Cogan

    291 posts

    Yes Full view from that those three.

    I looks like it is not picking up the URI segments. What is the web address you are using to access this template?

  • #40 / Feb 18, 2011 4:51am

    maxi

    220 posts

    I’m still using the “pre-production” MediaTemple URL: http://sitename.snnnnnn.gridserver.com/, I’m not sure if that’s the reason.

    In the code of the rendered page the line of the <title> is missing so I guess the EE tags used around it are not working?

  • #41 / Feb 18, 2011 5:33am

    maxi

    220 posts

    I’ve tried removing lines of code and it seems like the line that is not working is the first one. If I remove the below, the logic works, it just shows {title} instead of the actual title, or {category_name} instead of the actual value, of course.

    {exp:channel:entries channel="orologi" {if segment_3 != ""} url_title="{segment_3}" {/if} limit="3" disable="pagination|member_data" }
    ...
    {/exp:channel:entries}
  • #42 / Feb 18, 2011 5:36am

    maxi

    220 posts

    Got it working! 😊

    I tried using the same channel entries tag used initially for the entries themselves and it’s not pulling in the right data

    {exp:channel:entries channel="{segment_1}" orderby="date" status="Disponibile|Open" {if segment_2 == ""} limit="6" {/if} {if segment_3 != ""} url_title="{segment_3}"{/if}}    {if segment_3 != ""}
  • #43 / Feb 18, 2011 11:52am

    Barry Cogan

    291 posts

    Excellent!

    So you needed to add in the status? or was that the exp:channel:entries you removed?

    In any event I am very happy for you 😊

  • #44 / Feb 18, 2011 11:56am

    maxi

    220 posts

    It was the status (duh!) as all the entries have a custom status of “Available” instead of the default “Open”, so of course it was not finding any entry 😛

  • #45 / Feb 18, 2011 7:25pm

    Barry Cogan

    291 posts

    Yeah statuses will do it alright!  So all is working out for you now?

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

ExpressionEngine News!

#eecms, #events, #releases