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.

Page Creation Advice

October 20, 2011 11:46pm

Subscribe [2]
  • #1 / Oct 20, 2011 11:46pm

    aircan1

    5 posts

    I’m new to EE and am slowly making my way through understanding how everything works with this framework. I’ve gone through Ryan Irelan’s Mijingo videos, which have provided got me pretty far, but now I’m stuck on the right way to proceed.

    I have a site that consists of a few parts. One of those parts is a four section lesson plan. Each lesson plan will display one entry at a time.

    Currently I’ve set up four channels, one for each lesson. I’ve made a template for each, which are nearly identical, aside from the {channel=""} attribute. In the each of the templates I have sub navigation that has a previous link, next link, and a {current} of {total} slides info display.

    I’ve tried pagination, which kind of works, but I can’t the url or the page title to reflect the text title of the slide. Currently, the url attaches P# to the last segment of the url which I’m assuming refers to the page.

    Am I going about things the correct way and if not can someone point me in the write direction? Also, how do I change the urls to display the slide title?

    Thanks in advance.

  • #2 / Oct 21, 2011 12:41pm

    Mark Bowen

    12637 posts

    Hi aircan1,

    I’m not too sure exactly what you are trying to do here but I can say that if you have four entries then you don’t need to have four different Channels set up for each one.

    You could have one single Lessons Channel and inside that Channel have your four entries.

    You could then have this code on a template :

    {exp:channel:entries
     channel="lessons"
     dynamic="no"
     disable="member_data|trackbacks|categories|category_fields|pagination"}
    
    <a href="http://{url_title_path=%27lessons/details%27}" title="{title}">{title}</a>
    
    
    {/exp:channel:entries}

    This would create links somewhat like this :

    http://www.example.com/index.php/lessons/detail/lesson_one

    where lessons is the template_group, detail is the template_name and lesson_one would be the URL title of one of your lesson entries in the Lessons Channel.

    Next on the lessons/details (template_group/template_name) template you can have this code :

    {exp:channel:entries
     channel="lessons"
     limit="1"
     dynamic="yes"
     disable="member_data|trackbacks|categories|category_fields|pagination"}
    
    <h1>{title}</h1>
    {other_fields_here}
    {/exp:channel:entries}

    This would allow you to use one Channel to save and display all your entries instead of needing a Channel for each lesson which would get very difficult as you start adding more and more lessons.

    I’m not really sure what you meant by slides above but does any of the above help at all?

    Thanks,

    Mark

     

  • #3 / Oct 24, 2011 12:46pm

    aircan1

    5 posts

    Mark,

    Thanks for the reply. Let me give some more detail about what I’m trying to do.

    Once the user logs in, they are redirected to a dashboard page that will have links to each of the lessons. For the lesson portion, there will be four lessons (four links from the dashboard). Within each lesson, there will be 30-60 entries (these are what I was calling slides, sorry for the confusion).  Each lesson will display one entry at a time with the ability to navigate to/from the previous/next entries. The template needed for the entries will more or less the same, text on the left with an image on the right.

    I had made four channels to organize entries on the backend, but I think this may be more than I need.


    As far as displaying the url, this is what I’m after:

    http://www.example.com/lesson1/title-of-entry
    http://www.example.com/lesson1/next-title-of-entry

    http://www.example.com/lesson2/title-of-entry
    http://www.example.com/lesson2/next-title-of-entry

    http://www.example.com/lesson3/title-of-entry
    http://www.example.com/lesson3/next-title-of-entry


    With pagination I was trying to display:

    {previous link}  1 of 30 {next link}


    Thanks for your help.

  • #4 / Oct 25, 2011 12:48pm

    Mark Bowen

    12637 posts

    Hi aircan1,

    Ah I can see what you’re after now.

    One way of doing this would be to use categories so you would have four set up in your case for your four different lessons.

    You would then categorise the ‘slides’ with the correct category and then do this sort of thing :

    {exp:channel:categories channel="lesson_slides"}
    
    <a href="http://{site_url}index.php/lessons/lesson-slides/{category_id}">{category_id} - {category_name}</a>
    
    
    {/exp:channel:categories}

    This would show the list of Lessons and a link to take you to the next page which would show all the slides in that lesson using the code below :

    {exp:channel:entries
     channel="lesson_slides"
     dynamic="no"
     category="{segment_3}"
     sort="asc"}
    
    <a href="http://{url_title_path=">{title}</a>
    
    
    
    {/exp:channel:entries}

    This would show all the slides for that lesson. Next up on the detail page you would have something like this :

    {exp:channel:entries
     channel="lesson_slides"
     limit="1"
     dynamic="yes"}
    
    <h1>{title}</h1>
    
    {lesson_slides_body}
    
    
    {/exp:channel:entries}
    
    <hr >
    
    <h2>Other Slides For This Lesson</h2>
    
    <p>{exp:channel:entries related_categories_mode="yes" sort="asc"}</p>
    
    <p><a href="http://{url_title_path=">{title}</a></p>
    
    <p><br />
    {/exp:channel:entries}

    This would show the information for the lesson slide and a list below of all the other slides in that lesson. Clicking on one of the other slides would take you to the detail page again and show it’s information there.

    This really is more of a how-to post at this stage though so I’m going to move this across to the Community Help forums for you to get more people looking at this for you as what I’ve shown above is really only one way to go about all of this as there are many ways of doing this sort of thing so hopefully some other users will come in with other ways of going about this too for you.

    I hope that helps a little bit though.

    Thanks,

    Mark

     

  • #5 / Oct 25, 2011 3:57pm

    aircan1

    5 posts

    Thanks again Mark. I’ll take a crack at implementing this method and let you know if I have any issues.

  • #6 / Oct 26, 2011 4:05am

    aircan1

    5 posts

    Mark,

    I’ve made some progress, but need some further assistance. I’ve created the four categories and made an entry for each one.

    In my dashboard template, I’m using the following code:

    {exp:channel:categories channel="sessions"}
    
        <a href="http://{site_url}sessions/{category_url_title}/">{category_name}</a>
    
          
    {/exp:channel:categories}

    This pulls the four categories I need and outputs:

    <a href="http://staging.trtsonline.com/sessions/session-one/">http://staging.trtsonline.com/sessions/session-one/</a>
    <a href="http://staging.trtsonline.com/sessions/session-two/">http://staging.trtsonline.com/sessions/session-two/</a>
    <a href="http://staging.trtsonline.com/sessions/session-three/">http://staging.trtsonline.com/sessions/session-three/</a>
    <a href="http://staging.trtsonline.com/sessions/session-four/">http://staging.trtsonline.com/sessions/session-four/</a>

    (session-one, session-two, etc - these are my category names)

     

    When I click any one of those links I’m taken to the session template where I’m using the following code:

    {exp:channel:entries channel="sessions" limit="1" dynamic="yes"}
    
      {slide_title} 
    
      {slide_copy}
          
    {/exp:channel:entries}

    This code is pulling one entry at a time, which is great, but there a few problems. If I click on any of the links above they all take me to the most recent entry, regardless of what category is selected. I’m assuming I need to add a parameter to the channel:entries tag pair, but wasn’t successful with the categories parameters. The other issue is with the url not reflecting the title of the entry.

    My end goal to have the categories listed (1-4) and when a category name is clicked, the user is taken to the first entry in a given correlating category, bypassing the need to list all the entries in a category.

     

     

     

     

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

ExpressionEngine News!

#eecms, #events, #releases