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

Moving forward with Composr

ocPortal has been relaunched as Composr CMS, which is now in beta. ocPortal 9 will be superseded by Composr 10.

Head over to compo.sr for our new site, and to our migration roadmap. Existing ocPortal member accounts have been mirrored.


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

:thumbs:


Become a fan of ocPortal on Facebook or add me as a friend. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
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?


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

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. Add me on on Twitter.
Was I helpful?
  • If not, please let us know how we can do better (please try and propose any bigger ideas in such a way that they are fundable and scalable).
  • If so, please let others know about ocPortal whenever you see the opportunity.
  • If my reply is too Vulcan or expressed too much in business-strategy terms, and not particularly personal, I apologise. As a company & project maintainer, time is very limited to me, so usually when I write a reply I try and make it generic advice to all readers. I'm also naturally a joined-up thinker, so I always express my thoughts in combined business and technical terms. I recognise not everyone likes that, don't let my Vulcan-thinking stop you enjoying ocPortal on fun personal projects.
  • If my response can inspire a community tutorial, that's a great way of giving back to the project as a user.
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

Community saint

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
Back to the top
 
1 guests and 0 members have just viewed this: None
Control functions:

Quick reply   Contract

Your name:
Your message: