hello,

i tried to use the path functionality but it doesn't seem to work for me.

as i understand the documentation when i define a path like foo it will switch to the specified theme, so it does. but: it should also switch to this theme when the path ist foo-bar or foo-test or foo-anything-else, right? this doesn't work for me, even not when i try to specify a wildcard like foo%.

i also tried to install the two beta versions, but they only cause a white screen.

i have drupal 6.15, core modules contact, locale, menu, path, update status, contributed modules are administration menu, spamspan, printer-friendly pages, automated logout, fckeditor, poormanscron and captcha.

thanks for your help!

best regards
claudia behr

CommentFileSizeAuthor
#8 foo-rule.png9.77 KBmkalkbrenner
#7 676322.patch1.89 KBmkalkbrenner
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

mkalkbrenner’s picture

Category: bug » support
Status: Active » Fixed

"it should also switch to this theme when the path ist foo-bar or foo-test or foo-anything-else, right?"
Simple answer is: No.

"even not when i try to specify a wildcard like foo%"
Wildcards in ThemeKey don't work like this. They work like drupal's menu system. You only can replace parts of the path with wildcards.
Example These are the possible wildcard replacements for foo/bar/test.html:

foo/bar/%
foo/%/test.html
%/bar/test.html
foo/%
%/bar/%
%/%/test.html
%/%
%

You can use the debug mode of ThemeKey Properties to display all these variants.

Nevertheless you can achieve the feature "foo%" you requested using this rule chain:

Property: drupal:path
Operator: =
Value: %foo

  Property: drupal:path:wildcard
  Wildcard: foo
  Operator: ~
  Value: /^foo.*/
iwasnet’s picture

Thank you for your quick reply. Ok, so I misunderstood the wildcard setting, sorry for that, but:

I installed the ThemeKey Properties to have the drupal:path property, but there are no additional properties under themekey - settings?

I had to install 6.x - 1.1 due to a white screen installing the new beta versions.
When i tried to use the debug modus of ThemeKey Properties i get a white screen either.

So what can I do?

iwasnet’s picture

Status: Fixed » Active

i also deactivated all contributed modules, but there was no change in the behavior of the beta version of themekey. always the white screen ...

iwasnet’s picture

Status: Active » Fixed

it seems to be an issue due to php, on my localhost i have php 5.3, themekey beta works, my provider has php 4.4.8, this causes the issue.

thank you!

iwasnet’s picture

Version: 6.x-1.1 » 6.x-2.0-beta5
Status: Fixed » Active

hi,

now themekey 6.x-2.0-beta5 works on my local machine, but i am still not able to get it work with drupal:path:wildcard.

i tried as you suggested:

Property: drupal:path
Operator: =
Value: %foo

Property: drupal:path:wildcard
Wildcard: foo
Operator: ~
Value: /^foo.*/

it happens nothing.

when i write foo without % as value for the first property it works, but only for foo, not for foo-anything-else.

i also have an error message:
1) Possible operators are "=", "!", <", "<=", ">", ">=" and "~"
Your current configuration of Theme Switching Rules contains at least one logical error. Nevertheless this configuration is stored and active.

i cannot imagine it is too difficult to understand how to manage the rules, but i don't.

thanks for your help.

mkalkbrenner’s picture

Title: Path functionality » wildcard handling for path aliases seems to be broken
Assigned: iwasnet » mkalkbrenner
Category: support » bug

You discovered two bugs:
1. '~' should be allowed for drupal:path:wildcard (I already fixed that locally)
2. Switching like I suggested doesn't work if this url is an alias for a node (I'll have a closer look at this now)

mkalkbrenner’s picture

Title: wildcard handling for path aliases seems to be broken » wildcard handling for path aliases is broken
Status: Active » Needs review
FileSize
1.89 KB

OK, it's fixed. If you want to you can apply the attached patch. But I will release a new version of ThemeKey soon ...

mkalkbrenner’s picture

FileSize
9.77 KB

And here's a screenshot that shows how your rule chain should look like.

mkalkbrenner’s picture

Status: Needs review » Fixed
iwasnet’s picture

you made my day! themekey works fine now for me now, thank you soooo much!

thank you for the screenshot either, without i wouldn't have recognized the possibility to draw the cross to the right.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

patoshi’s picture

what is the ~ operator? tried googling and nothing came up.. im still a bit confused about the wildcard thing. any more simple examples?

thanks!

mkalkbrenner’s picture

All operators are documented in the help section of the ThemeKey module. And also in the descriptions above the rule chain.

"~" is the regex operator.

Wildcards for paths have been discussed in the issue queue multiple times, p.e. #836638: Path wildcards does not seem to work.

ShaneOnABike’s picture

Would be awesome to add some of this documentation or even just reference this ticket in the documentation of the module. This helped a LOT!

Guito339’s picture

What i did not find clear in the instructions is that in order to use the wildcard settings, you have to use both a path and a wildcard path together. This post helped alot, but it still took some time to figure it out.

I needed to use themekey to change the theme for all nodes at node/[nid]/modal.

In order to accomplish this I needed two rules together.

Rule 1:
drupal:path = node/#nid/modal

Rule 2: (a child of Rule 1)
drupal:path:wildcard nid ~ /\d/

Essentially this takes the #nid in the first rule and applies the regex in the second rule. The trick was to name the wildcard. I needed '#nid' in Rule 1 and then I had to name the wildcard in rule 2 'nid'. So whatever you have as the wildcard in the first rule must have a name and that name must be used in the child rule.

Here's an example with 2 wildcards

Rule 1:
drupal:path = foo/#nid/%bar

Rule 2: (a child of rule 1)
drupal:path:wildcard nid ~ /\d/

Rule 3: (a child of rule 1)
drupal:path:wildcard bar ~ /comments|talk/

These rules would change the theme for any pages that have the following url structures:

  • foo/[some node id]/comments
  • foo/[some node id]/talk

I had no idea of the parent child relationship and I spent an hour figuring it out. Hopefully his might save someone else an hour.