[Solved] Hyphen in file alias

Help with getting the CMS CORE package up and running. This does not include 3rd party modules, PHP scripts, anything downloaded via module manager or from any external source.
Locked
Andrew Prior
Forum Members
Forum Members
Posts: 247
Joined: Sun Oct 28, 2007 4:14 am

[Solved] Hyphen in file alias

Post by Andrew Prior »

[Solved - see Calguy's post] I have just upgraded to 1.11.6
During testing I noticed some urls suddenly were broken.
What I have discovered is that previously (1.10.3) if you choose a menu name like Fred - Children the page alias was auto set to
Fred---Children. But now, if you choose that menu title the alias it is set to Fred-Children, which is much tidier.

The problem is that if you edit a prexisting page which has the alias Fred---children, say to correct a typo, then it is re-saved as Fred-children. I cannot manually force it to save the original alias.

I am dealing with a site where there are hundreds of pages which have this menu style, so the issue has huge potential. I thought that if I had to change a page I would then run a link checker to see where other links to the page were then broken; the site is heavily cross linked. But I realise that as soon as I correct a page, that page's alias is also changed, causing a spiralling increase in the number of errors.

Is there any remote chance of stopping this feature on this site?
Last edited by Andrew Prior on Tue May 07, 2013 12:26 am, edited 1 time in total.
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Hyphen in file alias

Post by calguy1000 »

Though CMSMS shouldn't be re-changing an alias after one exists, you can remove this cleanup code.

in lib/misc.functions.php in the function munge_string_to_url look for this code:

for( $i = 0; $i < 5; $i++ ) {
$tmp = str_replace('--','-',$alias);
if( $tmp == $alias ) break;
$alias = $tmp;
}
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Wishbone
Power Poster
Power Poster
Posts: 1368
Joined: Tue Dec 23, 2008 8:39 pm

Re: Hyphen in file alias

Post by Wishbone »

Hope the moderators don't delete your post because of suggesting core modifications. :)
calguy1000
Support Guru
Support Guru
Posts: 8169
Joined: Tue Oct 19, 2004 6:44 pm

Re: Hyphen in file alias

Post by calguy1000 »

Call it 'executive privilege' :)
Follow me on twitter
Please post system information from "Extensions >> System Information" (there is a bbcode option) on all posts asking for assistance.
--------------------
If you can't bother explaining your problem well, you shouldn't expect much in the way of assistance.
Andrew Prior
Forum Members
Forum Members
Posts: 247
Joined: Sun Oct 28, 2007 4:14 am

Re: Hyphen in file alias

Post by Andrew Prior »

Calguy, thanks so much.
I rather suspect you might have already done this, but should I put in a bug report.? Andrew

ps. Just tested. It works.
Locked

Return to “[locked] Installation, Setup and Upgrade”