Can a Joomla module “know” what position it's in?

后端 未结 5 1563
我寻月下人不归
我寻月下人不归 2021-01-06 19:00

I\'m fairly new to Joomla (I\'ve been more of a Wordpress guy) and I have a question about module positions.

Can a module know what position it\'s in. For instance

5条回答
  •  清歌不尽
    2021-01-06 19:27

    I tried to comment under john's solution but I don't have a enough rep points-- I wanted to add it doesn't matter what you name the module position in your template case-wise the position name you get back from $module->position is always all lowercase regardless of how you named the position in the template... ie. in your template xml somewhere you might have topBar position will be named 'topbar' not 'topBar' when you try to check it with

    if($module->position == 'topBar') //always false... use instead
    if($module->position == 'topbar') //what you need to use
    

提交回复
热议问题