HTML Logo by World Wide Web Consortium (www.w3.org). Click to learn more about our commitment to accessibility and standards.

Url moniker legth

Login / Search

 [ Join | More ]
 Add topic 
Posted
Rating:
#78912 (In Topic #16110)
Avatar

Well-settled

On my site Femina Portal there is a forum "Education & Personal Growth". Its url moniker is "education-personal" but I would like it to contain all words, i.e. to be "education-personal-growth".

Due to the reason that there is not any option in forum configuration related to url moniker length, I found the logic in source/urls2.php.

Function "_choose_moniker" contains the following code:

Code

...
if (strlen($moniker)>24)
{
$pos=strrpos(substr($moniker,0,24),'-');
if (($pos===false) || ($pos<12)) $pos=24;
$moniker=substr($moniker,0,$pos);
}
...

I'm thinking about changing it to something like this:

Code

...
$max_moniker_length = 100;
if (strlen($moniker)>$max_moniker_length)
{
$pos=strrpos(substr($moniker,0,$max_moniker_length),'-');
if (($pos===false) || ($pos<$max_moniker_length-12)) $pos=$max_moniker_length;
$moniker=substr($moniker,0,$pos);
}
...

In this case maybe field "m_moniker" in table "ocp_url_id_monikers" should be changed to varchar > 255 (varchar's length was 255 before MySQL 5.0.3, and 0 to 65,535 in 5.0.3 and later versions).

Am I allowed to perform the changes without impact to any other logic on the system? Also, will future upgrades override the field's length changing?

The parameter MAX_MONIKER_LENGTH is also a candidate for a configuration parameter.

FeminaPortal - Female Internet Portal (powered by ocPortal)
INFORBIRO - Information Technology Agency
BlicKlik - Internet Marketing and Advertising
Back to the top
 
Posted
Rating:
#78913
Avatar

ocStaff (admin)

:thumbs:



Become a fan of ocPortal on Facebook or add me as a friend.

Expand: Was I helpful? Was I helpful?

Expand: Follow me on Twitter Follow me on Twitter







If I answered something that you think should be in the documentation, please take the initiative and add it to the community documentation. We really need people to help out here and build a well-organised large support resource.
Back to the top
 
Posted
Rating:
#78917
Avatar

Well-settled

Great, it works ;)

Maybe other guys would like to have similar ocPortal behavior so I created tutorial How to change URL moniker length in ocPortal CMS with step-by-step instructions for both ocPortal code changes and table's field modification.

FeminaPortal - Female Internet Portal (powered by ocPortal)
INFORBIRO - Information Technology Agency
BlicKlik - Internet Marketing and Advertising
Back to the top
 
Posted
Rating:
#78920
Avatar

Community saint

MitraX, Chris has previously warned about increasing moniker length ( View topic: v7.0.1 - Unwanted comcode tags in ULRs - ocPortal ).

Chris, has your position on moniker length changed?


Visit Last Gamer because its made with ocPortal.

Stay for the content - Video game retrospectives, reviews, galleries and discussions.

Do you have a Samsung Galaxy S / Galaxy S II ? If so, why not check out my ScreenFree FM Radio .
Back to the top
 
Posted
Rating:
#78925
Avatar

ocStaff (admin)

Well not really but it's not an ocPortal issue, just that I see it might cause problems external to ocPortal (well, possibly if the total length got passed 255). A few extra characters isn't going to hurt anything though.



Become a fan of ocPortal on Facebook or add me as a friend.

Expand: Was I helpful? Was I helpful?

Expand: Follow me on Twitter Follow me on Twitter







If I answered something that you think should be in the documentation, please take the initiative and add it to the community documentation. We really need people to help out here and build a well-organised large support resource.
Back to the top
 
Posted
Rating:
#78930
Avatar

Community saint

Chris Graham said

Well not really but it's not an ocPortal issue, just that I see it might cause problems external to ocPortal (well, possibly if the total length got passed 255). A few extra characters isn't going to hurt anything though.
As I mentioned above, I'd certainly like to see ocPortal officially raise the moniker length. I think something like 128 would suffice for most people and would allow more keywords in the URL.

Bob
Back to the top
 
Posted
Rating:
#78975
Avatar

Honoured member

Interesting, I have not paid attention to what the url's where on my site, but I will take a look when I get the chance, this might be a useful mod if mine are cut short as well.   Thanks.


Paul
Webmaster: Air-RC An RC Aircraft Community.
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: