# PHP Include alternative in Ember

**URL:** <https://discuss.emberjs.com/t/php-include-alternative-in-ember/11351>\
**Category:** Uncategorized\
**Created:** [August 9, 2016, 9:37pm UTC](https://discuss.emberjs.com/t/php-include-alternative-in-ember/11351 "2016-08-09T21:37:22Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ob7](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/ob7/32/12515_2.png) [@ob7](https://discuss.emberjs.com/u/ob7)\
**Post date:** [August 9, 2016, 9:37pm UTC](https://discuss.emberjs.com/t/php-include-alternative-in-ember/11351/1 "2016-08-09T21:37:22Z")

</div>

Hi I am new to javascript sites, I’ve been using php. I’ve chosen Ember, and would like to know how do I include a template file within another?

For example, within my application.hbs I have `<header> <nav></nav> </header>`

And within application.hbs there is also `<footer> <nav> </nav> </footer>`

Both `<nav>` elements contain exactly the same markup. How can I make this its own file and include it into here?

---

<div class="post-metadata">

**Author:** ![ob7](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/ob7/32/12515_2.png) [@ob7](https://discuss.emberjs.com/u/ob7)\
**Post date:** [August 9, 2016, 10:01pm UTC](https://discuss.emberjs.com/t/php-include-alternative-in-ember/11351/2 "2016-08-09T22:01:25Z")

</div>

Use a ‘partial’: ember g template navbar

edit templates/navbar.hbs with your navigation.

Insert into application.hbs the partial: {{partial ‘navbar’}}

---

<div class="post-metadata">

**Author:** ![ob7](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/ob7/32/12515_2.png) [@ob7](https://discuss.emberjs.com/u/ob7)\
**Post date:** [August 10, 2016, 5:23pm UTC](https://discuss.emberjs.com/t/php-include-alternative-in-ember/11351/3 "2016-08-10T17:23:30Z")

</div>

Ok the CORRECT way to do this is actually make it a component, then output the component anywhere in other templates:

ember g component nav-bar

put navigation template code in newly generated templates/components/nav-bar.hbs

then include this template in other places simply like so: {{nav-bar}}

---

<div class="post-metadata">

**Author:** ![ob7](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.emberjs.com/ob7/32/12515_2.png) [@ob7](https://discuss.emberjs.com/u/ob7)\
**Post date:** [August 11, 2016, 5:51pm UTC](https://discuss.emberjs.com/t/php-include-alternative-in-ember/11351/4 "2016-08-11T17:51:21Z")

</div>

Ok either way will actually work, there is a difference between the two however…

Using a ‘partial’ will grab its data from the same model the template you put it in does…

Whereas a component will access the data passed to it.

… I think anways, but I’m still new to this.
