Welcome Guest, Not a member yet? Register   Sign In
Clarification how to use view_cell, layouts or views
#2

(This post was last modified: 04-15-2020, 04:27 AM by Leo.)

Hi, I'm not sure of the "correct" way either - I do it like this:

In the controller: echo view('front', $this->data);

In view file 'front.php':
<!DOCTYPE html>
<html>
<head><!-- head stuff --></head>
<body>
<?= $this->include('home') ?> <!-- this points to view file home.php in the app/Views directory
<footer><!-- footer stuff --></footer>
</body>
</html>

view file home.php contains:
<main>
<header><h1>Very neat, and semantically correct HTML stuff</h1></header>
<section>....</section>
<!-- I also may have a little, hidden form embeded in this file, that is located in app/Views/modules/popform.php, like so: -->
<?= $this->include('modules/popform') ?>
</main>

If someone more senior sees this and cringes please tell me before I write a lot of stuff this way. Or is it good?
You can see things I made with codeigniter here: itart.pro its not overly impressive as I have very little time to learn.
Reply


Messages In This Thread
RE: Clarification how to use view_cell, layouts or views - by Leo - 04-15-2020, 04:23 AM



Theme © iAndrew 2016 - Forum software by © MyBB