I'm trying to upgrade a 4.7.6 drupal website to the 4.7-3 version of taxonomy filter. I'm having a major problem.
Since in my website the I18N module (internationalization) is active, often i must use url like these:
http://site.xxx.xx/en/taxonomy/term/1
(note the current language "en" in the url).
taxonomy filter is correctly shown when I use such urls. But the filtered urls I receive in the taxonom_filter block are something like this:
http://site.xxx.xx/en/taxonomy/term/1/en//en/taxonomy/term/1,5
and of course, cannot work.
In the previous taxonomy_filter's version I used (4.7.0 I think...) this didn't happen. Maybe I could try with a different setting in the taxonomy_filter setting menu... but I can't figure out HOW :-) Can you please help...??
Thaaaaaaanks!
PS: another difference I have with the 4.7.0 version, is that I can't get an "horizontal" menu - no matter what I choose (static list, contextual menu, tag cloud...) I always get a "vertical" menu... I suppose I should hack the template's css to modify this layout?
Comments
Comment #1
styro commentedWhat are your settings under /admin/settings/taxonomy_filter ?
How did you do it before? Was that by putting the block into a different region? That detecting the region and adjusting its display accordingly got dropped - it just became too complex to support with the new advanced menu types now.
But you can still get the same results using your theme.
I would do that in your theme CSS and use the static menu type. You can style list items to display inline rather than as a block - eg: http://alistapart.com/articles/taminglists/ . I recommend getting the Firebug extension (for Firefox) to help track down exactly which CSS to override.
Or you could try overriding this theme function in your theme:
eg add this to your themes template.php file:
See http://drupal.org/node/11811 for more details on theme overrides.
Comment #2
francoud commentedStyro,
> PS: another difference I have with the 4.7.0 version, is that I can't get an "horizontal" menu - no matter what I choose (static list,
> contextual menu, tag cloud...) I always get a "vertical" menu... I suppose I should hack the template's css to modify this layout?
>How did you do it before? Was that by putting the block into a different region?
> That detecting the region and adjusting its display accordingly got dropped -
Yes - really I didn't do anything, I put the block in the "header" or in the "content" region and menu was automatically horizontal. Yes I remember that the old version tried to understand the region.
> it just became too complex to support with the new advanced menu types now.
I understand, yes. OK - that's a minor problem and I'm sure that following your suggestions about CSS (thankx!) I will fix it.
> n the previous taxonomy_filter's version I used (4.7.0 I think...) this didn't happen. Maybe I could try with a different setting in the
> taxonomy_filter setting menu... but I can't figure out HOW :-) Can you please help...??
>What are your settings under /admin/settings/taxonomy_filter ?
Honestly I tried anything :) the default leads to that strange result; for example:
url to listen to: "taxonomy/term/%tids/%depth"
url format to output...: "taxonomy/term/%tids/%depth"
For "url format" I also tried: "/taxonomy/term/%tids/%depth" (leading slash): and I received:
http://xx.yy.zz/en/taxonomy/term/1/en//en/taxonomy/term/1,5
I tried using a complete url: http://xxx.yy.zz/taxonomy/term/%tids/%depth
and I received: http://xx.yy.zz/en/taxonomy/term/1/en/http:/xx.yy.zz/taxonomy/term/1,5
You can see by yourself if you want, with a test site: -->http://drupal01.uniud.it/ (I will keep the 4.7-3 version for this weekend, using the default settings).
Note that:
- if I remove the "/en" string the problem is still there
- I tried setting vocabularies to "no language" and to "english" language... didn't help
- I then tried using the previous (4.7.x-2.1) version - and it works fine!
Tnx again!
FB
Comment #3
styro commentedI have no experience with the i18n module and how its urls work sorry.
For the listen on setting - what happens if you change it to "*/taxonomy/term/%tids/%depth" ?
As for the output format, you could hardcode the language eg: "en/taxonomy/term/%tids/%depth". Current there isn't any token for language though, so it will only work with one hardcoded language at the moment.
Comment #4
francoud commented>For the listen on setting - what happens if you change it to "*/taxonomy/term/%tids/%depth" ?
Happens that.. it doesn't work at all! :) Anyway the default setting on listen was ok.
>As for the output format, you could hardcode the language eg: "en/taxonomy/term/%tids/%depth".
>there isn't any token for language though, so it will only work with one hardcoded language at the moment.
I tried, didn't work--> http://xx.yy.zz/en/taxonomy/term/1/en//en/taxonomy/term/1,5
OK - for now I will run with the 4.7-2 version. Maybe I'll have the time during the week to do further investigation!
Thanks again
fb
Comment #5
styro commentedI don't really have any idea how to fix this. If I get time I might try setting up an instance with the i18n module to try this out, but I can't make any guarantees about that sorry. If you do solve it, I'd be keen to look at any patches you come up with.
Also - being that (at least some form of) i18n looks like it will be in core for Drupal 6 it probably won't be an issue for the Drupal 6 version of the module. That is a while away though.
Comment #6
francoud commentedStyro,
seems that I was able to solve [my] problem just modifying one line of code in the _taxonomy_filter_format_url_path function - I removed using of the "drupal_get_path_alias" in the url construction, and it seems to work (for me at least) - note the "Fb patch" in the lines above.
I will try to test it extensively - I'm not so expert about drupal developing, so I dont know exactly what will happenswith these modifications... Note that I modified the "// $Id: taxonomy_filter.module,v 1.7 2007/03/12 02:03:52 styro Exp $" version using Drupal 4.7.6. I (still) didnt tested your module with drupal 5 (on of my next steps :-)
Let me know if you find my patch reasonable (and really working) :-)
--------------------------------
/**
* Formats the generated taxonomy links based on the specified template.
*/
function _taxonomy_filter_format_url_path($template, $tids, $depth, $op = NULL) {
if (count($tids) == 0) return;
$tid_str = implode(',', $tids);
$depth_str = ($depth) ? $depth : '';
$op_str = ($op) ? $op : '';
$raw_url = str_replace('%tids', $tid_str, $template);
$raw_url = str_replace('%depth', $depth_str, $raw_url);
$raw_url = str_replace('%op', $op, $raw_url);
$raw_url = str_replace('//', '/', $raw_url);
$raw_url = trim($raw_url, '/');
// $url = drupal_get_path_alias(str_replace('%2C', ',', url($raw_url)));
$url = url(str_replace('%2C', ',', $raw_url)); /* FB patch */
return $url;
}
---------------------------
Comment #7
styro commentedThanks a lot for your efforts to diagnose this - well spotted.
I suspect the problem could be with the way the i18n module handles path aliases. I presume i18n lets you have language specific path aliases?
A quick browse around drupal.org seems to show other people having trouble with that too, but my i18n ignorance means that I don't really understand what the issues are.
Comment #8
francoud commentedHonestly I never tried path aliases, so I dont really know how I18n deals with that. For now, just ignoring the path_alias could be an "honest" workaround maybe ;-) I'll investigate about i18n and drupal_get_path_alias and I'll let you know.
Comment #9
styro commentedJust closing off some old issues. Please reopen if still a problem in latest supported versions.