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.

Beginner Templating Question

November 06, 2011 10:24am

Subscribe [3]
  • #1 / Nov 06, 2011 10:24am

    neoginb

    5 posts

    Hello guys,

    I’m a beginner with EE so my question may seems a little trivial but I wasn’t able to find help in the user guide or a tutorial for it.

    It’s a general question about the templating system :

    let’s say I create a “team” page, meaning a page which contains the list of the team member, and for each of the member I want a personal page. This page is not the index page.

    So I have the CSS and HTLM for both the “team” page and the “team member profile” page. I also created a channel called “team members” which contains informations about each team member as entries.

    So here my questions :

    - How do I define different templates for specific entries (“team member profile” page) the and for the “container” of the entries ( the “team” page)
    - How do I sort them using a specific field of the entries, for example sort them by “field” ( i.e. creative, management etc…) ?


    Once again it may seems trivial, or maybe it is already explained somewhere else but I wasn’t able to find it. So may I ask you to help me or to point me in the right direction ?

    Thank you all,
    Gautier

    P.S. I double posted this topic in Tech Support, I know it’s bad but I think this could be useful for other beginners.

  • #2 / Nov 06, 2011 10:47am

    Hoosteeno

    109 posts

    Here’s a good reference:

    http://ellislab.com/expressionengine/user-guide/general/urls.html#entries-and-other-things

    A very common pattern would be:

    yoursite.com/template_group/template/url_title

    Applying this directly to your question:

    1) yoursite.com/team_members would would render the index template from the team_members template group.

    2) yoursite.com/team_members/member/neoginb would would render the member template from the team_members template group; and it would replace any entry tags in that template with data about you.

    In both cases—1 and 2 above—you will only actually see data about team members if you use an exp:channel:entries block in the template. In the first case, exp:channel:entries returns one or more team members. In the second case it returns only one team member.

    Sorting, along with countless other things you might do to a group of channel entries, is a parameter of the exp:channel:entries block. See here:

    http://ellislab.com/expressionengine/user-guide/modules/channel/channel_entries.html#parameters

    In your case I think you actually want a combination of the sort and orderby parameters.

    Make sense?

  • #3 / Nov 06, 2011 11:02am

    neoginb

    5 posts

    Hi,
    yes it makes sense.

    So is this the “policy” on how to use the templating system ? Using for each group of entries a template group containing an index template and another template to display individual entries ?

    I’m asking that as I plan to use EE for future projects and that would be important to streamline the process of devellopement.

    Best regards,
    Gautier

  • #4 / Nov 06, 2011 11:33am

    Hoosteeno

    109 posts

    The method I suggest is only one way to do it. Once you become more familiar with EE’s routing, you may find other creative ways to build templates and template groups that suit your purposes.

    There are also some commercial add-ons that completely change how you’d build a site. For example:

    http://devot-ee.com/add-ons/structure

    http://devot-ee.com/add-ons/navee

    http://devot-ee.com/add-ons/taxonomy

    Have fun!

  • #5 / Nov 06, 2011 11:38am

    Enviromed

    375 posts

    As you planning on streamlining development of more ee sites, you’ll want to consider now the effective use of if/else conditionals in your templates to simplify things.  Chris

  • #6 / Nov 06, 2011 11:46am

    neoginb

    5 posts

    Thanks, I will look into it.

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

ExpressionEngine News!

#eecms, #events, #releases