Форуми / Cotonti / General / Hacking UrlEditor

need to hack one line

Eugene
#1 28.01.2013 11:37

Hello!

Just need to rewrite urls like this... /users/Eugene/blabla ( GETting that as m=details&u=*&det=*)

In urleditor.functions.php I found a line (#85)

if ($path[0] == 'users' && $count == 2 && !isset($_GET['m']))

so, this $count == 2 is limiting me in my task.

What is the best COT-way to hack it?

  • creating function cot_apply_rwr_custom() and place it on the INPUT hook ...      OR
  • use hook urleditor.rewrite.first  to recode major part of  function cot_apply_rwr()

Is there better way?

Trustmaster
#2 28.01.2013 12:35

Using urleditor.rewrite.first seems to be a better way if you want to reuse other stuff from that function. There's no need to overwrite most of it, you just need to put there your if and then call return when you're done.

May the Source be with you!
Eugene
#3 28.01.2013 14:05

Thank you for advice!

I made this piece of code


if ($path[0] == 'users' && $count == 3 && !isset($_GET['m'])) {

    $_GET['e'] = 'users';
    $_GET['m'] = 'details';
    $_GET['u'] = $path[1];
    $_GET['det'] = $path[2];

    return;
}

and in urltrans.dat

users	m=details&u=*&det=*		users/{cot_url_username()}/{$det}

Thank you ))