<ul>
    <li class="module_add"><a href="javascript:">Add widget</a></li>
</ul>
<?php
$template = '
    <div class="module_type">
        <ul>
';

foreach ($module_type as $mt) {
    $template .= '
        <li>
            <a href="module/add/' . htmlspecialchars($mt['id']) . '">' . htmlspecialchars($mt['name']) . '</a><br />
            <span>' . htmlspecialchars($mt['description']) . '</span>
        </li>
    ';
}

$template .= '
        </ul>
    </div>
';
?>
<script type="text/javascript">
    $(document).ready(function() {
        $('#menu .module_add a').click(function() {
            $.facebox('<?php echo str_replace(array("\rn", "\r", "\n"), ' ', addslashes($template)); ?>');
            return false;
        });
    });
</script>
