Both options is fine for me :)
Keeping them is convenient at times ... having something that doesn't is convenient as well and it gets rid of the inconveniences.

Hans

On 27/04/2011 21:45, Systho wrote:
I agree with the fact that we shouldn't keep query string without specifically saying so, but on the other hand get_url really sound like we want the current url and go.php or core.php is a bit thin , so it includ the current query string.

What do you think of keeping get_url($additional_parameters = array()) and adding a forge_url($application, $action, $parameters) function ?

Systho

Le 27/04/2011 20:24, Hans De Bisschop a écrit :
Hi Philippe,

In its usage (in breadcrumbs mainly) it only uses the script name but do not keep all the current parameters from the query string.
Actually, on top of breadcrumbs, get_url is also being used for form actions, regular actions and an entire array of types of links. The big problem right now is that there is no differentiation between the origin of the query parameters and therefore no way to differentiate in what should and should not be there at one point. It's a recurring problems with menus being rendered on a higher level by a call to e.g. display_header. Tricks are being applied right now to "fix" that (by adding filters). But it's not a long-term solution.

-> keep query string (very useful for all links except breadcrumb)
I don't really like that one because more often then not it leads to useless parameters being there for who knows how long. Unless we have some kind of way to determine what should and should not be in there at a certain point in time I personally prefer:

-> forget query string (and pass current query string as a parameter to get_url when it is needed)
That way you always start with a clean slate and as you stated: if you really want them all, just add them. But in cases where you want to link to something outside of the bottom level context you don't run into the same kind of problems we have right now.

Building from scratch just seems more logical to me then selectively forgetting ... even when it's a bit more work (not that much though).

Hans

On 27/04/2011 16:26, Philippe Van Eerdenbrugghe wrote:
Hi everybody,

I'm currently splitting things from the application class into different class but I'm trying to not break anything ;)

I've noticed that the behaviour of the get_url() method is quite random :

From the code and the doc it uses the current url as a base and add/overrides query string parameters with the ones from the arguments.

In its usage (in breadcrumbs mainly) it only uses the script name but do not keep all the current parameters from the query string.


Obviously, if I'm on the page : run.php?application=forum&go=viewer&display_action=forum_viewer&publication_id=1

I want the Forum link on the breadcrumb to link to : http://localhost/chamilo-dev/run.php?application=forum

and therefore, I need to forget current query string.


I think it currently works because the get_url is called before the parameters array is populated but this is very dangerous (and not the case anymore in my refactoring). So which one of the behaviour should we keep :

-> keep query string (very useful for all links except breadcrumb)
-> forget query string (and pass current query string as a parameter to get_url when it is needed)

Those 2 options will break stuff but I'd like to have your opinion

Systho



_______________________________________________
Dev mailing list
Dev@lists.chamilo.org
http://lists.chamilo.org/listinfo/dev


_______________________________________________
Dev mailing list
Dev@lists.chamilo.org
http://lists.chamilo.org/listinfo/dev
_______________________________________________
Dev mailing list
Dev@lists.chamilo.org
http://lists.chamilo.org/listinfo/dev

Reply via email to