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!