# What is the use of Model and View folder...?

**URL:** <https://discourse.cakephp.org/t/what-is-the-use-of-model-and-view-folder/4666>\
**Category:** Need Help\
**Created:** [August 6, 2018, 4:27am UTC](https://discourse.cakephp.org/t/what-is-the-use-of-model-and-view-folder/4666 "2018-08-06T04:27:41Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![dash](https://avatars.discourse-cdn.com/v4/letter/d/7c8e57/32.png) [@dash](https://discourse.cakephp.org/u/dash)\
**Post date:** [August 6, 2018, 4:27am UTC](https://discourse.cakephp.org/t/what-is-the-use-of-model-and-view-folder/4666/1 "2018-08-06T04:27:41Z")

</div>

I am using cakephp 3.6.7 , what i know is this is MVC framework right…?

but i am using only controller and Layout… and created separate folder under template to body of the page…

anyone tell me what is the use of Model and View Folder… i am not using right now…

is there anything wrong…?

---

<div class="post-metadata">

**Author:** ![sathishcake](https://avatars.discourse-cdn.com/v4/letter/s/aca169/32.png) [@sathishcake](https://discourse.cakephp.org/u/sathishcake)\
**Post date:** [August 6, 2018, 5:35am UTC](https://discourse.cakephp.org/t/what-is-the-use-of-model-and-view-folder/4666/2 "2018-08-06T05:35:51Z")

</div>

[View](https://book.cakephp.org/3.0/en/views.html) check this link it can help you.

---

<div class="post-metadata">

**Author:** ![dash](https://avatars.discourse-cdn.com/v4/letter/d/7c8e57/32.png) [@dash](https://discourse.cakephp.org/u/dash)\
**Post date:** [August 6, 2018, 5:41am UTC](https://discourse.cakephp.org/t/what-is-the-use-of-model-and-view-folder/4666/3 "2018-08-06T05:41:16Z")

</div>

i am using latout / default.ctp file like this…

\<?php $cakeDescription = 'CakePHP: the rapid development php framework'; ?\>  
 \<?= $this-\>Html-\>charset() ?\>   
 \<?= $cakeDescription ?\>:   
 \<?= $this-\>fetch('title') ?\>   
 \<?= $this-\>Html-\>meta('icon') ?\>   
 \<?= $this-\>Html-\>css(['bootstrap.min.css','font.css','font-awesome.css','jqvmap.css','lightbox.css','minimal.css','monthly.css','morris.css','style-responsive.css','style.css']) ?\>

\<?= $this-\>Html-\>css('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css') ?\>

```
 <?= $this->Html->script(['jquery2.0.3.min.js','raphael-min.js','morris.js'	]) ?>

<?= $this->fetch('meta') ?>

```

\<?= $this-\>Html-\>script(['monthly.js','jquery.scrollTo.js','jquery.nicescroll.js','jquery.slimscroll.js','scripts.js','jquery.dcjqaccordion.2.7.js','bootstrap.js']) ?\>

 \<?= $this-\>fetch('scriptBottom') ?\>   
 \<?= $this-\>Flash-\>render() ?\>   

  
 \<?= $this-\>fetch('content') ?\> 

```
</footer>

```

---

<div class="post-metadata">

**Author:** ![rrd](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/rrd/32/113_2.png) [@rrd](https://discourse.cakephp.org/u/rrd)\
**Post date:** [August 6, 2018, 8:33am UTC](https://discourse.cakephp.org/t/what-is-the-use-of-model-and-view-folder/4666/4 "2018-08-06T08:33:15Z")

</div>

Separating your code for meet the MVC pattern has a lot of advantages, and you can read about this in a lot of articles and blog posts.

In summary when you communicate with your database, that is the `model`. Displaying the page to the user is `view`, and what connects them is `controller`.

The other term what you should read about is `fat model`.

I would reccomend to read about these, understand the concepts, than bake your models, controllers and views and inspect the code and try to understand.

---

<div class="post-metadata">

**Author:** ![dash](https://avatars.discourse-cdn.com/v4/letter/d/7c8e57/32.png) [@dash](https://discourse.cakephp.org/u/dash)\
**Post date:** [August 6, 2018, 8:44am UTC](https://discourse.cakephp.org/t/what-is-the-use-of-model-and-view-folder/4666/5 "2018-08-06T08:44:18Z")

</div>

i putted display page to the user i.e body tag right …?  
i putted in template… is that wrong…?

---

<div class="post-metadata">

**Author:** ![rrd](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/rrd/32/113_2.png) [@rrd](https://discourse.cakephp.org/u/rrd)\
**Post date:** [August 6, 2018, 8:56am UTC](https://discourse.cakephp.org/t/what-is-the-use-of-model-and-view-folder/4666/6 "2018-08-06T08:56:51Z")

</div>

That is right. In the view you should not do any database access, calculation, or business logic. View is only displaying.

---

<div class="post-metadata">

**Author:** ![dash](https://avatars.discourse-cdn.com/v4/letter/d/7c8e57/32.png) [@dash](https://discourse.cakephp.org/u/dash)\
**Post date:** [August 6, 2018, 9:01am UTC](https://discourse.cakephp.org/t/what-is-the-use-of-model-and-view-folder/4666/7 "2018-08-06T09:01:17Z")

</div>

what kind of value can i put…?

can u give any ex: please…

---

<div class="post-metadata">

**Author:** ![rrd](https://yyz1.discourse-cdn.com/flex029/user_avatar/discourse.cakephp.org/rrd/32/113_2.png) [@rrd](https://discourse.cakephp.org/u/rrd)\
**Post date:** [August 6, 2018, 9:13am UTC](https://discourse.cakephp.org/t/what-is-the-use-of-model-and-view-folder/4666/8 "2018-08-06T09:13:16Z")

</div>

As I mentioned just bake your application and inspect the code. That is the best start.  
[https://book.cakephp.org/3.0/en/bake/usage.html](https://book.cakephp.org/3.0/en/bake/usage.html)
