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.

Segment question...

December 18, 2010 10:24am

Subscribe [4]
  • #1 / Dec 18, 2010 10:24am

    Hi all,

    How can I create a URL structure like the following below?

    http://www.mysite.com/art/john/prints
    http://www.mysite.com/art/john/canvas

    This is the code I have in my “art” template group and the “prints” and “canvas” segments work but when I remove them and only call “john” I get “front page” and another weblog entry and but not john’s entry?!

    {exp:weblog:entries limit="1"}
    {if segment_2 == ""}Front page{/if}
    {if segment_3 == ""}{title} - Bio{/if}
    {if segment_3 == "prints"}{title} - Prints information here{/if}
    {if segment_3 == "canvas"}{title} - Canvas information here{/if}
    {/exp:weblog:entries}

    Does that make any sense? I know the code is not finished but I just can’t see what I am missing…

    Thanks in advance to anyone able to help me!

    Tony

  • #2 / Dec 18, 2010 11:40am

    Boyink!

    5011 posts

    You are working against how EE wants to work with URLs, so the behavior you are seeing is EE’s 404 action (which you can also affect).

    Have you read the docs on URL’s?

    You can work around it, but will need to build your own links (vs. using linking variables) set dynamic=“off” in your entry tags and then set url_title=”{segment_3}”, etc.

  • #3 / Dec 18, 2010 1:21pm

    Hi boyink!

    Thank you for the quick reply! I am not sure if this is what you meant but this seems to work for me now:

    {if segment_3 == ""}{exp:weblog:entries limit="1" dynamic=“off” url_title=”{segment_3}”}{title} bio{/exp:weblog:entries}{/if}
    {if segment_3 == "prints"}{exp:weblog:entries limit="1" dynamic=“off” url_title=”prints”}{title} - prints{/exp:weblog:entries}{/if}
    {if segment_3 == "canvas"}{exp:weblog:entries limit="1" dynamic=“off” url_title=”canvas”}{title} - canvas{/exp:weblog:entries}{/if}

    Is that the “right” way to work around it?

    Thanks again!
    Tony

  • #4 / Dec 19, 2010 3:54pm

    Greg Salt

    3988 posts

    Hi Tony,

    I don’t know that there is a ‘right’ way to do things like this. EE is very flexible (as you’ve discovered) so you can pretty much bend it to your will. As Mike says though EE is setup to make certain configurations very easy. There is nothing inherently wrong with using a template as a kind of router (as you’re doing) but you may find this difficult to maintain in the long run and some other functions like search or commenting may be more difficult to work with.

    Cheers

    Greg

    @Mike, thanks for the help.

  • #5 / Dec 20, 2010 6:52am

    Hi Greg,

    I am still learning EE and there is still loads more to learn 😊 But I guess if it works it’s correct in away.

    The reason I wanted to do the links in this way was for more of an SEO benefit than anything else.

    Thank you both your help and feedback, much appreciated!
    Tony

  • #6 / Dec 20, 2010 6:33pm

    Brandon Jones

    5500 posts

    Yes, thanks Mike.

    Tony, sounds like you have a working solution. I’ll close this out but don’t hesitate with further questions!

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

ExpressionEngine News!

#eecms, #events, #releases