If it is an URL parameterURL parameter you can use
$pageId = Mage::app()->getRequest()->getParam('pageid', 0)
ForFor category pagespages:
$pageId = Mage::registry('current_category')->getId()
For CMS pagesYou can also modify your single category from your_layout.xml
Layout handles for categoris look like:
<CATEGORY_{yourId}>
<reference ...
For CMS pages:
$pageId = Mage::getSingleton('cms/page')->getId() // use getIdentifier()