Custom slug

edited April 2017 in Modules
Hi,

I would like my URL structure to be mysite.com/{artist}-{album}

I have an artist slug and an album slug but the issue appears if I have duplicate albums with the same name. How can I prepend the artist slug to the album slug?

e.g. in the module something like...

Album
-----
Slug: artistslug-[ ]

Thanks

Comments

  • edited 11:02AM
    I'm not quite sure I understand the problem. One way though may be to add something like the following in your module model's _common_query method that concats the 2 fields together and then reference that value:
    public function _common_query($display_unpublished_if_logged_in = NULL) { $this->db->select('CONCAT(artist, "-", slug) AS artistslug' FALSE); }
Sign In or Register to comment.