We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

How to: Modify maxlength setting of url_title? Need kick in right direction! :)

Development and Programming

mhulse's avatar
mhulse
329 posts
15 years ago
mhulse's avatar mhulse

What would be the best way to change the maxlength setting of the url_title on an entry page? I assume an extension would do the trick, but I am not sure where to start.

Basically, I want longer URL titles.

I am tempted to modify the database for this, but that just seems lame.

Tips would be greatly appreciated. 😊

       
mhulse's avatar
mhulse
329 posts
15 years ago
mhulse's avatar mhulse

I am guessing that an extension would not give me the ability to modify the url_title char limit in the database?

Anyway, I found a hackish solution (use at your own risk):

Database:

Using something like phpMyAdmin, Modify url_title “type” field in exp_channel_titles table. Just to show the database who’s boss, I bumped-up the char limit to 500 (stock setting is 75). 😊

FTP:

Modify system/expressionengine/controllers/cp/content_publish.php (@ and around line 1550):

//'field_maxl'            => 75
'field_maxl'            => 500

Modify system/expressionengine/libraries/Api.php (lines 190 through 204):

$mh = FALSE;
switch($type)
{
    case 'gallery'    : $table = 'gallery_entries';    $url_title_field = 'url_title';        $type_field = 'gallery_id';    $self_field = 'entry_id';
        break;
    case 'category'    : $table = 'categories';        $url_title_field = 'cat_url_title';    $type_field = 'group_id';    $self_field = 'category_id';
        break;
    default            : $table = 'channel_titles';    $url_title_field = 'url_title';        $type_field = 'channel_id'; $self_field = 'entry_id';
        $mh = TRUE;
        break;
}

// Field is limited to 75 characters, so trim url_title before querying
//$url_title = substr($url_title, 0, 75);
$url_title = ($mh) ? substr($url_title, 0, 500) : substr($url_title, 0, 75);

Could I do any of the above with an extension? As soon as I have some free time to kill, I might explore other options.

I am open to suggestions. 😊

Cheers, Micky

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.