简体   繁体   中英

how can i add and remove modules from a custom component in joomla 1.5?

For instance, within a plugin run with the component, say I want to remove all the sidebar-a modules, resulting in it being collapsed. Or maybe I want to remove the first 3 modules and then add some other module or modules....

Basically, I want to control module inclusion/exclusion in the template from code...

使代码在特定条件下处于未发布状态(运行查询以使jos_extension中的扩展名为0的状态),以便在模板位置中不考虑它们。如果组件页面消失,则将状态设为1通过运行另一个更新查询。

Why not just use the menu assignment to control the modules? Make menu items for the various pages in your component then assign the modules as required.

The problem you are going to run in to with trying to do it how you are describing is that you are going to have to parse HTML due to the order in which the framework builds a page. By the nature of Joomla you cannot control module positions from within the component. It can be done, but it's going to be very messy, especially considering that you can probably accomplish the same thing through menu assignments.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM