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.

Simple template route throwing PHP error in 2.8.1

April 24, 2014 3:57am

Subscribe [3]
  • #1 / Apr 24, 2014 3:57am

    I’m trying to get the template routing feature to work in EE - I can get it to work, but cannot understand why I have to do this - or even the logic behind it.

    I have a template group called “lyrics” and in that 3 templates - artist, album and song.  These will be linked to 3 channels, which have relationships between them.

    I want the following URL structure:

    /lyrics/<artist> to go to template lyrics/artist
    /lyrics/<artist>/<album> to go to template lyrics/album
    /lyrics/<artist>/<album>/<song> to go to template lyrics/song.

    According to the documentation, I can set up a rule as such:

    /lyrics/{artist:alpha_dash}/{page:pagination} for the template lyrics/artist

    correct?

    However this gives me a PHP error:

    A PHP Error was encountered
    Severity: Warning
    Message: preg_match_all(): Compilation failed: group name must start with a non-digit at offset 14
    Filename: libraries/Template_router.php
    Line Number: 56

    Maybe it’s something to do with the rules - change to: /lyrics/{artist}/{page}—- same error.
    Maybe it’s the pagination, let’s try just the artist - change to: /lyrics/{artist}—- same error!

    Now I’m getting frustrated - how about something completely different - change to: /lyrics/{varArtist}—- this works!!

    So let’s add the rules back in: /lyrics/{varArtist:alpha_dash}—- this also works.
    And pagination: /lyrics/{varArtist:alpha_dash}/{page:pagination}—- same error!
    Do the same to the page variable: /lyrics/{varArtist:alpha_dash}/{varPage:pagination}—- this works!!

    So it seems I have to put var<variable> to get it to work.  The following all fail as variable names:

    {varartist}
    {vaArtist}
    {Artist}
    {artist}

    But this works: {varArtist}

    Even this example, straight from the documentation, throws the same error:

    /name/{first_name:alpha}/{last_name:alpha}/{suffix:regex[(i|v|x)+]}

    Please tell me what I’m missing!

  • #2 / Oct 26, 2014 1:39pm

    johnpaulmedina

    1 posts

    Have you got this fixed? I am on 2.9.2

    Using this in the template route I get a similar error
    {page:pagination}

  • #3 / Dec 17, 2014 6:30am

    Sorry for the late reply, no I didn’t get this resolved, however I shelved the project due to time constraints.

    I am currently re-visiting it again over the next few weeks with the latest version of EE (2.9.2) so I’ll see if I get any further!

  • #4 / Dec 17, 2014 8:59am

    Boyink!'s avatar

    Boyink!

    5011 posts

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

ExpressionEngine News!

#eecms, #events, #releases