This is not really possible. It is just possible in very few template files. The problem is, that Magento renders the template files hierarchically. Naturally, the head
block where the title and the description are rendered, is rendered in the beginning of that process. You could update the information in general template files like 2columns-right.phtml
if you insert the following before the call to $this->getChildHtml('head')
:
<?php $this->getLayout()->getBlock('head')->setTitle('My title'); ?>
<?php $this->getLayout()->getBlock('head')->setDescription('My description'); ?>
Mind that this is very bad practice. But it may be interesting that it works. If you insert the above code in a template file which is rendered later, the title and description will not be updated (since they have already been rendered before).
Maybe you can use some layout handles and update the title/description via layout XML? Something like:
<CATEGORY_3>
<reference name="head">
<action method="setTitle">
<title>My title</title>
</action>
</reference>
</CATEGORY_3>