JOOMLA MODULE how to insert "php code" inside the .xml manifest file



I want at the fieldset of a joomla module to echo an option with some fetched results from my db:



<config>
<fields name="params">
<fieldset name="basic">
<field>
<?php

$db =& JFactory::getDBO();
$query = $db->getQuery(true);
$query->select('*');
$query->from('#__menu_types');

$db->setQuery($query);
$options = $db->loadObjectList();
echo "<select>";
echo "<option value=''>select a category</option>";
foreach($options as $row) {

echo "<option value='" . $row->id ."'>" . $row->title . "</option>";

}
echo "</select>";
?>
</field>
</fieldset>


i know that this code is completly wrong (just posted it to show you what i want to do ), but i allready searched for modules that do something similar and i found out, they dont use php code inside xml so i guess there is another way, i couldnt understand my own as im completly new to joomla and this kind of developing. Thanks in Advance.


No comments:

Post a Comment