I'm attempting to use the drupal path:wildcard theme switching rule, using either the "contains" operator ('*') or the regex operator ('~').

The URLs that I want to display using a special theme are all in the form: menu-instructor-agm-, like:
menu-instructor-agm
menu-instructor-agm-2014
menu-instructor-agm-2013

and so on ...

The UI exposes two fields aside from the operator for me to fill in, per the image below:
Only local images are allowed.

What I'm trying to figure out is what to put into the first empty box so that ThemeKey will switch themes if it finds the string 'menu-instructor-agm' .... I've tried the '~' operator as well, with a variety of regular expressions (/^menu-instructor-agm/ /*menu-instructor*/ and so on ...) to no avail.

Comments

Anonymous’s picture

Hmm. Looks like the URL for the image is blocked. it's http://i.imgur.com/WCUOuzt.jpg The entry space in question is the empty one to the right of the mouse cursor.

mkalkbrenner’s picture

Did you read the built-in help and tutorials?

drupal:path:wildcard only works in combination with drupal:path. Try this cascade:

drupal:path = %menuinstructoragm
   drupal:path:wilcard menuinstructoragm ~ /^menu-instructor-agm/ >>> YOUR_THEME
Anonymous’s picture

Hey, thanks for answering ... and your suggestion worked ....

Just to clarify (and check my assumptions about this, since it took me a while to figure out what to do, and what's written here may save someone else time):

When you're using regular expressions, you have to combine drupal path:wildcard "under" a drupal:path command with a cascade, in a similar way to the example for SELECT A THEME FOR FIREFOX 3.0.X, BUT NOT FIREFOX 3.5.X. Assuming you're looking for something in the URL with either a regular expression (~) or contains (*) operator, the drupal-path looks like:

drupal-path = %someidentifier

The next level of the cascade looks like (assume we're searching for a URL that begins with menu):

drupal-path:wildcard someidentifier ~ /^menu/

If no other URLs on the site contain the string "menu", you can use a simpler "contains string" operator, and write the wildcard portion like this:

drupal-path:wildcard someidentifier * menu

[ I did, in fact, read the built-in help and tutorials.... but the example for regex use was kind of sketchy:
In admin/help/themekey under examples, was:
TODO: ADD SOME EXAMPLES USING DRUPAL:PATH AND DRUPAL:PATH:WILDCARD

And I missed the implications of this statement in the explanation of drupal:path (which, with the benefit of hindsight), is clear, but
wasn't when I read it yesterday:
Wildcard characters are "#" for numeric parts and "%" for all characters. To match conditions against a certain part, use an identifier
with the wildcard. For example "comment/reply/#xyz" matches all paths with "comment/reply" and a numeric third argument. You
can then specify conditions for every wildcard argument using the property "drupal:path:wildcard" and the identifier you choose ("xyz"
in this example).
]

mkalkbrenner’s picture

You're basically right.

But the major problem that confuses the users is the word "path" and the technical meaning of a "drupal path".

A drupal path is something like "node/27". If you look at drupal's menu system the "path" is "node/#nid" with the "named wildcard" #nid.

ThemeKey's drupal:path property is directly tight to that menu system which does not support regular expressions.

But your understanding of a "path" is technically a "path alias" or a "request URI" or the "request parameter q".
So these available properties might be easier to use:
path:node_alias
drupal:get_q

I already thought about introducing somthing like system:request_uri. That property would perfectly fit your needs. But a normal user won't understand it, because it's too technical.
And it will not contain all the magic that happens behind the existing properties. We magically convert between
rewritten URLs, different aliases for the same page and localized aliases. Additionally we try everything twice with striped base-pathes and language prefixes.

It's simply not that easy ...

Anonymous’s picture

It seems to be a law of the computing universe that there's an inverse relationship between ease of use and power.

Thanks for the further information. I'll have to go and experiment with node_alias and get_q, which I didn't think of using for this. For the moment, though, the main thing I needed to get running works.

mkalkbrenner’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

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

aangel’s picture

derekrv, thank you for explaining this more fully. I too didn't get how pattern matching really worked but in retrospect I see now.

Further complicating things was a note on the IMCE project page instructing users to use "*imce* in the ThemeKey module." This might have worked in a prior version but it doesn't work now. The method you describe is now required.