Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Design

Kate Petry
PLUS
Kate Petry
Courses Plus Student 9,432 Points

How to include common content like navbars on multiple pages

If you're building several pages how do you include the common content like the headers, navbars, navigation, and footers without writing the code in each file? Do you create separate files for each of these elements and include them? I'm currently building pages in dreamweaver and am using asp.net (not my choice- it's what my company uses and I'm learning it as I go).

I have purchased a theme from wrapbootstrap which seems to have everything I want but I don't understand how to create multiple pages without writing the code each time. I have tried creating multiple files - one for navbar, one for footer etc and have included them in my pages using a server side include but not everything is looking and working like the original theme. So I'm wondering if there is a better solution.

Please don't suggest php or rails as these aren't options.

Thanks so much! KP

5 Answers

You say you are using asp.net do you know what framework you are using? Are you using ASP MVC or ASP Web Forms ? Usually you do not use dream weaver for asp projects you would have to use visual studio to be able to run them along side with IIS.

Here is Web Forms http://msdn.microsoft.com/en-us/library/fft2ye18(v=vs.100).aspx

Here is MVC http://stackoverflow.com/questions/13322108/mvc-layout-vs-mvc-master-page

Here is a better page about Web forms I think http://msdn.microsoft.com/en-us/library/wtxbf3hh(v=vs.100).aspx

Stone Preston
Stone Preston
42,016 Points

are you saying its not looking right in dreamweaver? You wont be able to see any dynamic content in dreamweaver unless you set up a testing server first. It will only look right in dreamweaver once you put it on a server that dreamweaver knows about.

You have the right idea about building seperate files then including them as you need them

If you say your company uses asp.net is there anyone that you could talk to about showing how their systems run? Might need to shadow or peer code with someone.

Kate Petry
PLUS
Kate Petry
Courses Plus Student 9,432 Points

Well long story super short - I started as a liason between an education department and a programmer assigned to develop certain applications. My job was to convey to the programmer the intent of the education department staff and work with him directly. He's not a designer by any means so I started learning on my own. My programmer has a mac and I have a PC. I had purchased dreamwever to start with to learn php on my own but then I got pulled into the job more and he education department does all things with microsoft products - asp.net etc. so they said everything needed to be in asp.net. So - I have dreamweaver to design and develop - and I don't know anything else...so I'm at a loss for what I should be learning.

Should I take the files I have in dreamweaver and move them over to studio? Will that allow me to design and develop?

No it doesn't work right when I open it in the browser - I created a testing site so I could view my pages. One example of it not working correctly is the sidebar - there is a collapse icon and it does collapse but in the real purchased theme when you collapse the sidebar the main content shifts over along with the sidebar once collapsed. But with my approach the main content stays static and doesn't move.

Thanks for pointing me int he write direction!