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.

Pages from dynamic content...

September 20, 2012 5:23pm

Subscribe [1]
  • #1 / Sep 20, 2012 5:23pm

    greg.thompson

    12 posts

    Ok guys I’m sure this can be done and it’s part logical as it is technical. I’m strictly a CI developer and recently been playing more and more in EE for client facing stuff. What I need the ability to create a channel that will link to a specific page… I need a channel, say events, that has an area for an image, excerpt/snippet, and then full details… I’d like my site to go something like….

    mysite.com/events and this page would have a list of all the events I put in with the title and excerpt then when you click into an event like… mysite.com/events/specific-event it takes you to that page. Is there an easy way of doing this, with pretty urls, that doesn’t involve creating a page and specifying a link every time I’d like the client to add a new event?

    I had to make this comparison but something similar to the way wordpress structures their blog/blog post. If it’s any help I’ve been using the structure module aswell.

  • #2 / Sep 24, 2012 2:16am

    Kevin Smith

    4784 posts

    Hi Greg,

    Welcome to EE! This is actually just what the Channel Entries tag is set up to do. In your example above, you’d want to set up a template group called “events”, and in the index template of that group, use a Channel Entries tag that opens like this:

    {exp:channel:entries channel="events" limit="10"}

    Now, that’s a simple tag, but it basically tells EE to display the 10 most recent entries from the “events” channel (which is only named the same as the template group because you’ve explicitly set them up that way), ordered by the most recent first. You can use other parameters for the Channel Entries tag to specify more or less entries, pagination, sort order, etc.

    Within that tag above, you could include this link, so that each entry listed on that main index page links to a single entry page:

    <a href="http://{url_title_path=events/index}">permalink</a>

    When rendered on the page, that HTML will look something like this:

    <a href="http://example.com/events/index/specific-event">permalink</a>

    The great thing about the Channel Entries tag example above is that when a URL title like specific-entry is in the URI, the Channel Entries tag is smart enough to know it should only display that one entry. Thus, you have a single template which functions as both an index and a single entry page.

    Does that help get you started?

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

ExpressionEngine News!

#eecms, #events, #releases