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.

URI Structure Question

May 27, 2009 5:50pm

Subscribe [6]
  • #1 / May 27, 2009 5:50pm

    Michael Espinosa

    64 posts

    I am building a site for a church and wondering if it is possible to have something like this:

    http://www.mydomain.com/ministries/women/blog/article/article_title

    My understanding is EE works like this:

    http://www.mydomain.com/template_group/template_view/entry_title

    Thanks

  • #2 / May 27, 2009 5:57pm

    Ingmar

    29245 posts

    The latter is the default structure, yes. That said, you can certainly build something akin to the former. Take a look at url segments.

    Moving to Howto.

  • #3 / May 28, 2009 12:33am

    hermanobrother

    44 posts

    I am building a site for a church and wondering if it is possible to have something like this:

    <a href="http://www.mydomain.com/ministries/women/blog/article/article_title">http://www.mydomain.com/ministries/women/blog/article/article_title</a>

     

    Michael, maybe you don’t need as many /segments/ in your URL once you’ve done this. But sure, I think it would be like this maybe:

    <a href="http://www.mychurchsite.com/ministries/women/article_title">http://www.mychurchsite.com/ministries/women/article_title</a>

    You just have to create a Template Group called “Ministries”. Inside you’d have a template called “Women”. There you could post articles.

    Or maybe a structure like this, which is basically the same, just depends on how you structure your information:

    <a href="http://www.mychurchsite.com/blogs/women/article_title">http://www.mychurchsite.com/blogs/women/article_title</a>

    Where there is a Template Group “Blogs” and you have all the different templates of the different “Blogs”.

  • #4 / May 28, 2009 7:39pm

    Michael Espinosa

    64 posts

    @Ingmar I need a little more clarification on url segments. I do I tell EE witch segment is the template_group, template_view and entry_title? I can see grabbing a segment and checking if that segment is “blue” then make I can make the footer blue or something like that. Are there specific tags for template_group, template_view and entry_title?

    Thanks

  • #5 / May 28, 2009 7:51pm

    hermanobrother

    44 posts

    It’s kind of like in the file i’ve attached.

    Where ministris is segment_1, women is segment_2, etc.

  • #6 / May 28, 2009 8:04pm

    Michael Espinosa

    64 posts

    @hermanobrother So are the template_group, template_view and entry_title explicitly segments 1-3? Or can I move them to 3-5 or something like that? And if so how?

  • #7 / May 28, 2009 10:39pm

    grrramps

    2219 posts

    This brings up a question I’ve seen asked but not seen answered. If there can be up to nine url_segments in EE, and EE’s default structure is template_group/template/entry (three url_segments) how do you structure a site to have from four to nine segments?

  • #8 / May 28, 2009 10:47pm

    smidoid

    36 posts

    The latter is the default structure, yes. That said, you can certainly build something akin to the former. Take a look at url segments.

    Woah! You just read my mind! Coming from CodeIgniter I was wondering if this was possible - and thankfully it is.

  • #9 / May 29, 2009 2:43am

    Michael Espinosa

    64 posts

    The latter is the default structure, yes. That said, you can certainly build something akin to the former. Take a look at url segments.

    So are the template_group, template_view and entry_title explicitly segments 1-3? Or can I move them to 3-5 or something like that? And if so how?

  • #10 / May 29, 2009 3:06am

    Ingmar

    29245 posts

    I’ve seen your question the first time around 😊 To recap, and unless you tell EE otherwise, it will assume a template group, template and and url_title in segment_1, 2 and 3 respectively. (Leaving out special cases with dates, pagination, categories and the like.)

    But of course nothing prevents your from having a URL like, say,

    <a href="http://www.example.com/ministries/women/blog/article/article_title">http://www.example.com/ministries/women/blog/article/article_title</a>

    In that case, you’d probably have a template group “ministries”, a template “women”, and then use:

    {if segment_3 == "blog" && segment_4 == "article"}
    {exp:weblog:entries weblog="{segment_3}" url_title="{segment_5}" dynamic="off" limit="1" }
    {if:else}
    ...
    {/if}

    ... or something along these lines. There are other ways, including physical directories on the server, or using url_rewriting etc. In all cases it takes some effort, and you have to be careful so as not to work against EE, if you will, but if you know what you are doing the sky’s the limit 😊

    Hope that helps a bit. Also, if you haven’t done it yet, do yourself a favor and check out Lisa’s excellent series on the Importance of Semantics for a better understanding of how EE’s url structure works in general.

  • #11 / May 29, 2009 3:49pm

    Michael Espinosa

    64 posts

    I’ve seen your question the first time around 😊

    Thanks Ingmar, and the forums (http://ellislab.com/forums/viewthread/34101/), for helping me understand this better. I am looking for confirmation that segments 1 and 2 (template_category and template_view) explicitly belong to segments 1 and 2.

    What I want to do: Have multiple blogs for multiple ministries. All with there own templates (they look different). I would like my url structure to look like this:

    http://www.mydomain.com/blog/women/ -> index landing page
    http://www.mydomain.com/blog/women/archive/ -> archive view
    http://www.mydomain.com/blog/women/article/article_title -> single entry view

    http://www.mydomain.com/blog/youth/ -> index landing page
    http://www.mydomain.com/blog/youth/archive/ -> archive view
    http://www.mydomain.com/blog/youth/article/article_title -> single entry view

    http://www.mydomain.com/blog(template_category)/youth(category)/article(template)/article_title

    I want to move the (template) segment to position 3. Now I can use different templates for different categories.

  • #12 / May 29, 2009 3:57pm

    grrramps

    2219 posts

    Does anyone have an example of how to set up an EE site with a URL string that gets 5, 6, 7 or more url_segments? With categories I can get up to 4. Does going beyond require nested categories?

  • #13 / May 29, 2009 4:02pm

    kirkaracha

    273 posts

    URL segments go up to segment_9.

  • #14 / May 29, 2009 4:11pm

    grrramps

    2219 posts

    Yes, and how does a url string get to segment nine? Is it categories and sub-categories?

    I can do up to four easily enough:

    http://mysite.com/index.php/template_group/template/category/my-entry-is-here/

  • #15 / May 29, 2009 4:52pm

    Michael Espinosa

    64 posts

    Yes, and how does a url string get to segment nine? Is it categories and sub-categories?

    I can do up to four easily enough:

    http://mysite.com/index.php/template_group/template/category/my-entry-is-here/

    Check out this example - http://ellislab.com/forums/viewthread/34400/#156997

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

ExpressionEngine News!

#eecms, #events, #releases