Mobile app version of vmapp.org
Login or Join
Shanna517

: Bootstrap dynamic content I am building a website powered by twitter's bootstrap. I have created a landing page with menus and text. The next thing I want to do is create a About page, but

@Shanna517

Posted in: #Ajax #Bootstrap #Dynamic #Javascript #Php

I am building a website powered by twitter's bootstrap. I have created a landing page with menus and text. The next thing I want to do is create a About page, but what is the easiest way to create a new page with the same layout. I don't think copy and pasting the layout would be a great idea.

I have used PHP includes and $_GET variables for this in the past but I wondered if there is a more elegant solution.

I hope this is the place for the question and I hope somebody can help me.

10.03% popularity Vote Up Vote Down


Login to follow query

More posts by @Shanna517

3 Comments

Sorted by latest first Latest Oldest Best

 

@Rambettina238

There are several ways to do what you want, here is one method that I used to use.

You have your landing page complete, so I assume you have a header with the navigation menus and other information on that page, you have some content in the middle of the page, and you have a footer at the bottom.

What you want to do is re-use the header and footer on all pages, and just change the content, so to do this, you could take all the code for your header and put that in a file and call it header.php. Next, do the same with your footer, again naming it footer.php. Finally, do the same thing with your content, calling it landing_page.php.

Now, in your landing_page.php is where you join all the files together:

<?
include('header.php');
...
output your content here
...
include('footer.php');
?>


Now you can reuse your header and footer in other templates (about.php, etc) without copying all the header and footer code in each template.

This is a very basic example, and there are lots of other techniques but this should get you pointed in the right direction.

For a much more in-depth approach take a look at The No Framework Framework.

10% popularity Vote Up Vote Down


 

@Nimeshi995

Easiest method would to be use a CMS (Content Management System) there are many Bootstrap frameworks that are compiled and ready to use for many different content management systems. This makes adding content and various pages a breeze. It shouldn't be to hard to take what you have done already and input that into a pre-built framework for a CMS.


Bootstrap for WordPress
Joomla (Default template uses a Bootstrap)
Bootstrap for Drupal


If you still rather use STATIC design then you can use Dreamweaver and save your design blank as a template which makes making new pages faster but its still not as easy as using a CMS. Take a look at saving time in Dreamweaver.

10% popularity Vote Up Vote Down


 

@Shakeerah822

From a code maintenance point of view, PHP includes are the cleanest way I've come across; another option that I've tried in the past are Dreamweaver template files (think include files that are internal inside of Dreamweaver) but when you publish the file its pure HTML/CSS/JS.

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme