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

后端 未结 5 1564
我寻月下人不归
我寻月下人不归 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:17

    The short answer is 'yes', you'll assign a module a position based on your template. When it shows up you can have conditionals like that regarding that position (different templates have different naming conventions for positions, so make sure you know what they are before coding).

    For example, some use "Position12", others may use "leftcol", etc. You just have to check in the template files to see (you can check the .xml file in the template directory to see the positions listed in the template, or look in the index.php file for the jdoc includes).

    In some of my experience, the only time you'll really ever need code like that is in the core layout files of the template (for example, if you have different widths of columns depending on modules being present or not), otherwise there won't really be a time where you 'may or may not' have a module showing up - because you'll explicitly be telling them where to be and when on the back end.

提交回复
热议问题