Common Dropdown lists in all the pages

Hi, i have a dropdown list department which onchange (ajax) will list subjects belonging to the same. These 2 dropdown lists are common for many controllers. so instead of putting same actions in each controller how would reuse the code. Is there any guide on how to achieve this.

Thanks,

Praveen

[color=#1C2837][size=2]Praveen,[/size][/color]

[color=#1C2837][size=2]

[/size][/color]

[color=#1C2837][size=2]Try to Put Dropdownlist in layout/maim.php and use controller with inheritance for share function[/size][/color]

[size="2"][color="#1c2837"]

[/color][/size]

Hi shailesh,

main.php is the single layout used for the whole project, and out of around 10 controllers nearly 5 controllers use tht select dropdwon list, so is that a appropriate way to implement tht way or do i need to create a component, extension or a widget. ?

Thanks,

Praveen

I looks like you need a widget which you can reuse in different views or place in the layout.

Other possible options to reuse code in controllers are actions in separate classes or even widget which acts as action provider for controllers.

Hi Seb,

Thanks for the reply. I have put the common dropdown functions in components/controller.php and this worked with little tweak in the actions. Hope this is one the way to accomplish that.

Thanks,

Praveen