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.

Change the prefix for pagination

April 16, 2009 9:57pm

Subscribe [1]
  • #1 / Apr 16, 2009 9:57pm

    divspace

    29 posts

    Looking at the core.paginate.php file, I see there’s a config var for setting up prefixes and suffixes for URLs. I’ve looked at this code and a few of the related files for pagintation, and while I can get the URL structure correct, the pagination does not work anymore.

    My URL structures are setup like this:

    domain.com/blog/ (lists all the articles)
    domain.com/blog/hello-world/ (an individual article)
    domain.com/blog/category/test/ (a category page)

    And then pages of course are setup like this:

    domain.com/blog/P10/

    The problem is, I have to use conditionals to check the URL segment so I can display the appropriate information, and since the conditionals don’t allow for regular expressions (booo), I need the pagination URL structure to be like this instead:

    domain.com/blog/page/10/

    Any clues on what files I’m maybe not editing or if there’s an easier way to do this?

  • #2 / Apr 16, 2009 10:00pm

    Lisa Wess

    20502 posts

    That would be a fairly major hack as you’d also have to turn off the dynamic nature of URLs.  The URL you posted, ExpressionEngine will think “10” is an entry_id.  I would have to recommend against this; you could use PHP conditionals or code your own plugin which would be more upgrade-friendly.

  • #3 / Apr 16, 2009 10:03pm

    divspace

    29 posts

    Yeah, guess I’ll have to revert to using PHP in templates, though I would prefer not to. Thanks for the fast response though.

  • #4 / Apr 16, 2009 10:09pm

    Lisa Wess

    20502 posts

    I’ve re-read this and I’m not sure why you have to use a single conditional for your URL structure.  EE will handle that structure out of the box.

  • #5 / Apr 16, 2009 10:16pm

    divspace

    29 posts

    Yes, EE would handle this if I set the “comment” page up with an actual URL prefix. I don’t like the URL structure of having to prefix a blog entry with yet another variable, e.g. by default EE wants you to set a blog up like this:

    domain.com/blog/ (list all articles)
    domain.com/blog/comment/article-title-here/ (individual article)

    I have the “comment” page set up as the same path the as main blog page, which has the following conditionals:

    {if segment_2 == "" OR segment_2 == "page"}
       <!-- List all blog articles -->
    {if:elseif segment_2 AND segment_2 != "category" AND segment_2 != "page"}
       <!-- List the individual blog entry -->
    {/if}
  • #6 / Apr 16, 2009 10:26pm

    Lisa Wess

    20502 posts

    If you use the index template, you can leave off the template name from the URL and it will work without conditionals.

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

ExpressionEngine News!

#eecms, #events, #releases