A plugin to display css class based on location
tensh |
|
||
---|---|---|---|
Hi; I made this plugin to determine in which location the user is, and if location matches the url in navigation menu, it returns the class name "active" (or any other, can be set in settings), so that the menu item can switch colors. By now it can be achieved only by "IF" statements. Currently it works only with URLs set to "Handy" urls (custom urls probably as well). For nested categories, provide the Parent category in class parameters (the very first parent category in structure hierarchy) - it doesn't recognize the category depth (YET). Usage: just as you would use it with cot_url(): {PHP|classactive('module','parameters')} - e.g. {PHP|classactive('page','c=news')}. Example menu link with this plugin:
Attention: For some reason both plugins cooperate as exected in my localhost, but fail to work on my production external server. Any help? Is it because it has memcache or something? Link to plugin: |
|||
Dieser Beitrag wurde von tensh (am 22. September 2013, 10:51, vor 11 Jahre) bearbeitet |
Aristei |
|
---|---|
Very good, thanks! Sorry for my English
|
Macik |
|
---|---|
Can you write on what exact links it does not work? https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F |
tensh |
|
||||||
---|---|---|---|---|---|---|---|
It just doesn't do anything with these tags. cot_url() gets parsed but my global class classactive() doesn't. The code as I see in page source:
Here's what is in cfg.menu1 in config:
Seems like classactive doesn't get parsed or gets parsed wrong. But in my localhost it is parsed just fine! Source from localhost:
If I use classactive() in header.tpl in my theme, it's parsed fine, it just doesn't work with slots and tags on my production server. Something with php settings? but what? Maybe I should change plugin's priority? Or anything? |
Macik |
|
---|---|
It can happened because order to run plugins not specified (in that case install order can be important). Try new version from GitHub: https://github.com/macik/cot-slots_n_tags (I'm fixed hook order) First uninstall both of plugins than install ones more. Do the same on production server. https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F |
tensh |
|
---|---|
Now my plugin doesn't work at all even without slots and tags (at production server), maybe the order should be the other way round? Hmmm. Haven't tested on localhost but on localhost it previously worked as expected. o_O |
Macik |
|
---|---|
Hmm… What does it mean «does not work at all»: What we get for `{PHP|classactive('','')}` string in tag? Is other tpl tags parsed in menu slot? https://github.com/macik
правильный хостинг — https://goo.gl/fjCa1F |
tensh |
|
---|---|
It just displays {PHP|classactive('','')} and also other tags, lang tags, etc. in text - it doesn't get parsed. I'm using the latest 9.0.14 Cotonti. :) |