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

34

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...

252

Answer

Solution:

make there status unpublished(run a query to make the status of the extension 0 in jos_extension ) by your code in a particular condition so that they will not be taken into consideration in template position.If the page of your component disappears make the status 1 by running a another update query.

482

Answer

Solution:

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.

People are also looking for solutions to the problem: php - Values NOT being sent to mysql Database from Ajax

Source

Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.