cotonti.com : Handy Urleditor https://www.cotonti.com Neueste Themenbeiträge Cotonti en Sun, 30 Nov 2025 21:38:55 -0000 Macik Ok. Thanks. The first time I just missed «new rule» link in web UI of urleditor.

Добавлено 5 часов спустя:

«urltrans» work quite well for my case. It's hardcoded as an array in my plug, so I inject it in $cot_urltrans right in the code.

	$my_urltrans[] = array(
		'params' => cot_parse_str('mode=catalog&gfx=1'),
		'trans' => '{!$mode}{$_area}/{$c}/{$s}/{$typ}/{$vp}+{$year}+{$month}/graphics/{$mg}/{$bt}/'
	);
// and so on

$cot_urltrans['myplug'] = $my_urltrans;

But had another inconvenient thing. As I use shorthand style of call «cot_url», like cot_url('myplug', 'mode=catalog'); // other parameters added automatically from global scope as noted in urltrans

So I trapped myself to cot_url_custom. If urleditor not installed - my code will not work.

And anyway I must write a cot_url wrapper to autimatically send all long chain of parameters to cot_url().

]]>
Fr, 06 Jul 2012 16:27:57 -0000
Trustmaster Both are acceptable. I personally prefer editing urltrans.dat directly because it is faster. But be careful with tabs and spaces, it is quite sensitive to that.

]]>
Fr, 06 Jul 2012 15:56:50 -0000
Macik Yes, in case of high load the hook is not best solution. But cot_url_custom already a complicated function itself. How you suppose to use callback function? 

Any way there should be a clear solution to extend «handly url» composing. I mean «i18n» block hardcoded in cot_url_custom is not pure style.

Добавлено 1 день спустя:

I think I can solve my needs with custom urltrans. So question is: can I add custom url rules to «urltrans.dat» via web form or must editing file direct in filesystem? 

]]>
Mi, 04 Jul 2012 23:49:18 -0000
Trustmaster The problem is: cot_url() / cot_url_custom() is called 100-500 times per request. Adding a hook to it would make the whole site slower. Another solution would be using a set of callback functions. But both should be tested with a PHP profiler.

]]>
Mi, 04 Jul 2012 07:47:57 -0000
Macik  

In my case (already using Handly preset of URL editor) I can't do this as «PHP does not support function overloading, nor is it possible to undefine or redefine previously-declared functions».

Some kind of a solution may be adding a hook to cot_url_custom (from URLEditor) as we have in cot_apply_rwr() for adding costom rules to it.

]]>
Di, 03 Jul 2012 20:16:13 -0000
Trustmaster The only way currently available is defining your own cot_url_custom() function. Better solution proposals are welcome.

]]>
Di, 03 Jul 2012 18:41:45 -0000
Macik Another one question:

My plugin uses complicated url like:  lang/plugname/subcat/type/product/params/mode/

I can use Hooks=urleditor.rewrite.first to handle it and transform to actual parameters. But is there any way to compose url with my rules like cot_url does (by hook or else)?

I can write own plug_url function, but it's not convinient to pay attention where to use cot_url and where plug_url.

]]>
Di, 03 Jul 2012 09:33:59 -0000
Trustmaster There are no handy rules for AJAX links, so currently they are raw like: cot_url('plug', 'r=plugname') => index.php?r=plugname.

]]>
Mi, 27 Jun 2012 06:38:18 -0000
Macik Sorry for intervention...

How I can generate with «cot_url» propper link for call ajax part of a plugin ? (I mean «plug.php?r=plugname» or something like this).

]]>
Di, 26 Jun 2012 22:22:18 -0000
fraze perfect - cheers elf :)

]]>
Mo, 25 Jun 2012 21:33:47 -0000
elfrenazo
My .htaccess hope that helps.


### COTONTI URLTRANS ###
# Rewrite engine options
Options FollowSymLinks -Indexes
RewriteEngine On

# Server-relative path to Cotonti:
RewriteBase "/"
RewriteRule ^(datas|images|js|themes)/(.*)$ $1/$2 [QSA,NC,NE,L]

# Admin area and message are special scripts
RewriteRule ^admin/([a-z0-9]+) admin.php?m=$1 [QSA,NC,NE,L]
RewriteRule ^(admin|login|message)(/|\?|$) $1.php [QSA,NC,NE,L]

# System category has priority over /system folder
RewriteRule ^system/?$ index.php?rwr=system [QSA,NC,NE,L]

# All the rest goes through standard rewrite gateway
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]+) index.php?rwr=$1 [QSA,NC,NE,L]

### COTONTI URLTRANS ###

]]>
Mo, 25 Jun 2012 20:29:11 -0000
Trustmaster It seems that on some hosts you need

Options -Indexes

and on some hosts you don't.

]]>
Mo, 25 Jun 2012 20:10:27 -0000
fraze sorry for hijacking.  i've enabled Handy URLs and added that info to my htaccess but admin still wont work.  i get the same problem elfrenazo did...

]]>
Mo, 25 Jun 2012 17:58:22 -0000
elfrenazo It all works well. thank you very much Twiebie and Trustmaster yes

]]>
Mo, 25 Jun 2012 17:35:09 -0000
Trustmaster Maybe this version can help:

# Rewrite engine options
Options -Indexes
RewriteEngine On

# Server-relative path to Cotonti. Replace it with your path if you run Cotonti
# in a subfolder
RewriteBase "/"

# Admin area and message are special scripts
RewriteRule ^admin/([a-z0-9]+) admin.php?m=$1 [QSA,NC,NE,L]
RewriteRule ^(admin|login|message)(/|\?|$) $1.php [QSA,NC,NE,L]

# System category has priority over /system folder
RewriteRule ^system/?$  index.php?rwr=system [QSA,NC,NE,L]

# All the rest goes through standard rewrite gateway
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]+) index.php?rwr=$1 [QSA,NC,NE,L]
]]>
Mo, 25 Jun 2012 07:14:17 -0000
elfrenazo I tried with nothing, it is strange. Any way to disable the admin rewrite?

]]>
Mo, 25 Jun 2012 05:52:41 -0000
Trustmaster Are there any other rules in your .htaccess, apart from what Twiebie mentioned?

]]>
Mo, 25 Jun 2012 05:38:41 -0000
elfrenazo thank you very much, it works. Failure administration panel. example enter malditopc.es/admin/extensions redirects me to start administration. I can do to fix it?

]]>
Mo, 25 Jun 2012 01:12:56 -0000
Twiebie I think these rules will work with the Handy preset:

# Rewrite engine options
RewriteEngine On

# Server-relative path to Cotonti. Replace it with your path if you run Cotonti
# in a subfolder
RewriteBase "/"

# Language selector
#RewriteRule ^(en|ru|de|nl)/(.*) $2?l=$1 [QSA,NC,NE]

# Admin area and message are special scripts
RewriteRule ^admin/([a-z0-9]+) admin.php?m=$1 [QSA,NC,NE,L]
RewriteRule ^(admin|login|message)(/|\?|$) $1.php [QSA,NC,NE,L]

# All the rest goes through standard rewrite gateway
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^?]+) index.php?rwr=$1 [QSA,NC,NE,L]

Paste them in your .htaccess file.

]]>
So, 24 Jun 2012 23:40:56 -0000
elfrenazo Hello, like putting in so handy pluging urleditor. Do I have to create new rules?

]]>
So, 24 Jun 2012 21:54:14 -0000