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.

The Importance of Semantics: Pagination

January 10, 2008 1:00pm

Subscribe [2]
  • #1 / Jan 10, 2008 1:00pm

    Lisa Wess

    20502 posts

    One thing that I did not cover when going through The Importance of Semantics was how Pagination works.  The various types of pagination all rely on the URL to know which entries are displayed.  We’ve had a bit of a break from the Semantics series, but why don’t we dig into how the Pagination works now?

    Onwards!

  • #2 / Jan 11, 2008 1:06am

    rmeder

    97 posts

    Is there a way to have a link for “ALL”  So that the limite could be removed by clicking ALL instead of just page 1, 2, 3, etc…

  • #3 / Jan 11, 2008 1:23am

    Lisa Wess

    20502 posts

    You can certainly do this, but you would need to add the link manually, and link to a template that had a higher limit.  The default limit is 100 so if you want to show more than that you’ll need to explicitly set it.

  • #4 / Jan 11, 2008 1:26am

    rmeder

    97 posts

    Thanks.  I’ll give it a try!

  • #5 / Mar 31, 2008 7:35pm

    Michael C.

    29 posts

    I’ve got a problem with detecting single- / multiple-entry pages vs. pagination (or categories, for that matter).

    The short of the matter is that I need to be able to tell if a given page is a single-entry page or a multiple-entry page. Using [if segment_3] conditions doesn’t work, since that 3rd segment could be occupied by pagination or category data. Is there some sort of [if single_entry] or [if multiple_entry] conditional?

    If you really want to know why I need this, read on…

    I have a number of blogs for news-y stuff; specifically: News, Press Releases, & In the News.

    I want to display them all intermingled on one page - the “news” template group’s index page: /news(/index) - using a [exp:weblog:entries weblog=“news|press-releases|in-the-news” ...] tag. This works fine.

    I also want to link each entry with a different weblog to a different template in that “news” template group. Items in the “news” weblog are displayed using /news/article/[title], items in the “press-releases” weblog are displayed using /news/press-release/[title], etc. This also works fine.

    Now, I want to link to a page displaying only press-releases, for example. Normally I’d link to the /news/press-release/ template and put a [if segment_3 == “”] conditional in there in order to display a list (with the excerpts) if there’s no entry specified, or to display a single entry (in its entirety) if an entry is specified. Again, fine.

    But now, let’s say I’ve got a large number of press releases - more than I’d like to have showing on a single page. So I limit the number to display, and add in some pagination code-whoops! Pagination beyond the first page adds another segment to the URL, thus rendering my single- / multiple-entry detection useless!

    Is there another way to detect single- vs. multiple-entry pages, one that doesn’t rely on URL segments?

  • #6 / Apr 01, 2008 12:13pm

    Lisa Wess

    20502 posts

    I see, the pagination still shows up on the single-entry page.  The way I normally handle sites is that single-entry pages get their own templates, and multi-entry pages get their own template. The reason for this is that in nearly all of my sites, the templates delivered are actually fairly different in look and feel.

    Is there some reason you’re so keen on the single-template-for-all concept?

  • #7 / Apr 01, 2008 4:56pm

    Michael C.

    29 posts

    Well, I like to plan for eventualities that might happen. In this case, I could have news/articles (plural) list all the articles, with pagination and such, and have news/article (singluar) show a single article. The only problem that remains (in my obsessive brain, at least) is what happens when Curious Joe User is reading an article and then decides to go up a level in the site to see what’s there (moving from http://www.example.com/news/article/i_am_an_article to www.example.com/news/article/). All of a sudden he sees a list of all the articles in their entirety, not just summaries. This isn’t absolutely horrid, of course, but I’d rather be able to intercept calls to the single article page that don’t specify an article and redirect them to the multiple-article page.

    All this could be resolved, of course, by a redirect, but as far as I can find, EE has no built-in redirect tag, does it? Yeah, I could do one in PHP, but then I’d have to enable PHP for that template, and I don’t know enough about the security ramifications to feel okay doing that just for a redirect.

  • #8 / Apr 01, 2008 5:01pm

    Lisa Wess

    20502 posts

    You can always use the require_entry parameter, with the if no_results tag to resolve the curious reader syndrome. =)

  • #9 / Apr 01, 2008 8:16pm

    Michael C.

    29 posts

    Ah-HAH! There ya go, that does it, I believe. 😊 Thank’ee kindly!

  • #10 / Apr 01, 2008 8:35pm

    Lisa Wess

    20502 posts

    My pleasure, Michael.  You might want to read the SEO series as well, as that is covered in the 404 section. 😉

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

ExpressionEngine News!

#eecms, #events, #releases