02-09-2012 05:45 PM - last edited on 02-09-2012 05:52 PM
Hello,
I have a application that will be a bout 3 or for html pages. I would like to have a common header and footer on all the pages of the application. Using MS's MVC3 framework, you get a _Layout.cshtml page, and all your other pages are placed inside of it.
The Layout page would look something like this:
<html> <head> <title> My App </title> <script type="text/javascript" src="myscripts.js"></script> </head> <body> <b><a href="#" onclick="myapp.menuClicked()">Menu</a></b> <H1>My App</H1> <!-- my sub page content gets put here server side --> <i>This is my footer.</i> </body> </html>
That way if I want to change my header or footer, I don't have to change it on every page of my application. In the MVC3 framework, this is done serverside. What's the best way to accomplish this with webworks/HTML 5/JS?
Or is it just best to set up some sed/awk scripts?
Thanks,
~S
02-09-2012 11:16 PM
I had done an application with fixed header and footer. What i have done is created 3 divs. one for header,another for data section and one for footer. I created a single html page for this and changed the content of second div (data section) according to user clicks a menu item through DOM.
02-09-2012 11:20 PM
Well currently I have ruby script statically doing it pre-deploy which is working.
How did you replace the content of the div tags? Using Javascript? (sorry new to JS).
~S
02-09-2012 11:25 PM
Exactly............ On clicking a menu item, what i'm calling is a javascript function and replace the content of the div with new one.