Welcome Guest, Not a member yet? Register   Sign In
in the view, php embedded into html or php echo the whole html?
#1

[eluser]searain[/eluser]
In non MVC programming, instead of using echo to create the whole table like the code below. I used to use html to create the table, and embed
Code:
<?php echo ; ?>
into the html code which is easier to use WYSIWYG editor like dreamweaver etc. and it is easier for non programmer designer if I have to work with one of them.


Code:
if (count($article_categories)){
    echo "<table border='1' cellspacing='0' cellpadding='3' width='400'>\n";
    echo "<tr valign='top'>\n";
    echo "<th>ID</th>\n<th>Name</th><th>Status</th><th>Actions</th>\n";
    echo "</tr>\n";
    foreach ($article_categories as $key => $list){
        echo "<tr valign='top'>\n";
        echo "<td>".$list['id']."</td>\n";
        echo "<td>".$list['name']."</td>\n";
        echo "<td align='center'>".$list['status']."</td>\n";
        echo "<td align='center'>";
        echo anchor('admin/article_categories/edit/'.$list['id'],'edit');
        echo " | ";
        echo anchor('admin/article_categories/delete/'.$list['id'],'delete');
        echo "</td>\n";
        echo "</tr>\n";
    }
    echo "</table>";
}

What approach do you use? html and embed php into it, or use php to echo whole html? I still think if I can use "html and embed php into it", I would prefer to use it, even in CI coding.


Messages In This Thread
in the view, php embedded into html or php echo the whole html? - by El Forum - 06-29-2009, 03:12 PM



Theme © iAndrew 2016 - Forum software by © MyBB