Permalink structure from Parent

3 posts by 2 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: June 19, 2014   (RSS)

By Toledoh - June 17, 2014

Hi Guys,

I'm building a site where the pages are maintained via a category editor, with the parent items being the main navigation and the child items being a drop down menu item.

I would like to use the permalinks plugin, but rather than default to the page title, it create a folder structure based on the parent.

ie. Pages are;

About

- Our History

- Our Staff

Products

- Australia

- Americas

- Asia

Services

Contact

By default, the permalink for  Australia would be www.domain.com/Australia, and Our staff would be www.domain.com/Our_Staff

I would like it to be www.domain.com/Products/Australia and www.domain.com/About/Our_Staff

Is that possible?

Cheers,

Tim (toledoh.com.au)

By Dave - June 19, 2014

Hi Tim,

I don't think that's possible with the default plugin.  There's a field at the top of the plugin that lets you specify which fields should be used to generate the permalink:

// the first field in this list with content will be used to create the permalinks. To use multiple fields separate them with spaces
$GLOBALS['PERMALINKS']['autopopulate_fromFields'] = array('name', 'title');

If you are using a menu type of category you could try setting that to 'breadcrumb' but I think you'd still end up with /about_our_staff/.  You could try hacking the plugin to use / instead of space to separate words, but then you'd end up with /about/our/staff/.  The function that creates the Permalink is _permalink_generate_getInputText($recordOrRequest), so what you'd need is to add some custom code there to lookup the parent record and tweak the output.

Hope that helps!

Dave Edis - Senior Developer
interactivetools.com