Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Preserving the case of a title in ExpressionEngine?

Under EE 1, I was able to hack the source to allow me to retain url titles with the exact case of the title. That is, I was able to keep it from forcing all url titles to be lower case.

I need to replicate the same behaviour on EE 2, but I am not quite managing so far.

What I have done so far is this:

In <system>/expressionengine/modules/channel/mod.channel_standalone.php:

commented out this line: NewText = NewText.toLowerCase();

added “A-Z” to this line: NewText = NewText.replace(/[^a-z0-9-_]/g,’‘);

In <system>/expressionengine/helpers/EE_url_helper.php:

removed strtolower() from this section:

  if ($lowercase === TRUE)
  {
  $str = strtolower($str);
  }

added “A-Z” to this line: [^a-z0-9\-\._]

I don’t know for sure if all of these changes were actually needed, but I think so. By the look of it, the changes to mod.channel_standalone.php should take care of any submissions via a stand-alone entry form and the changes to EE_url_helper.php should take care of regular postings.

It almost does, except for the live URL. The URL generated as I type a title is generated in lower case. However, if I delete it before I save the post, it saves the post with the same case in the url title as the title. At least, it does so most of the time. Sometimes, it does get saved with the lower case url.

If anyone might be able to tell me how to get the live URL title to co-operate as well, I would be very grateful.

like image 650
Linda Antonsson Avatar asked Nov 03 '12 22:11

Linda Antonsson


1 Answers

This is happening in themes/javascript/compressed/jquery/plugins/ee_url_title.js.

It may be a bit difficult to find since the Javascript is compressed, but the expression you will want to edit is: a = (k + a).toLowerCase().replace(d, c);

like image 160
Jeremy Worboys Avatar answered Oct 22 '22 01:10

Jeremy Worboys