I have the following situation: i display points and point informations in popups. the points are added to a layer. The popups are added to the map, with map.addPopup function. It works great. The problem is that i want to control the visibility of the popups. For example, if i should be able to add the popups to a layer, then i should be able to hide/show that layer with LayerSwitcher (OpenLayers.Control.LayerSwitcher). But i haven't found any example when somebody adds a popup to a layer. Every example uses the map.addPopup function. Any idea?
Popups in OpenLayers does not belong to a layer at all. The only method is map.addPopup. For more complex uses I'm afraid you'll have to write some code of your own to handle the issue at hand.