Hi,
I am new to this concept. I have website in local and it has home,aboutus, testimonial and contact pages.
In an index page(home page), I want to display whole page view in single div. Wherever I am clicking something, it has to display there also. How to do?

Recommended Answers

All 3 Replies

Member Avatar for diafol

This is probably the 'big page' scroller you're referring to. I recently set up my own business site: http://www.ardpont.co.uk using a ready made template. It certainly saved me a couple of days. There are many "free" template sites out there. The one I used was http://www.templategarden.com/ I'm not in any way affiliated with this site nor do I endorse it - it's just there as an example. Is that the sort of thing you were after?

From my understanding i think what you need is an iframe. Using an iframe you can link to other parts of the site. So you would have the iframe in the div.

Member Avatar for diafol

AH, ok I think toby may have got the idea. Instead of an iframe which has no idea of the dimensions of the data it's holding - so can't resize dynamically, you're proobably looking for include files.

Most hosts will allow SSI (server-side includes) even if they don't offer a server-side language such as PHP or a flavour of ASP.

If you have a local server e.g. Apache with PHP as server-side language, this is relatively easy. There are many, many different ways to do this. This is just a simple one:

PUBLIC_HTML/
    index.php
    pages/
        home.php
        about.php
        contact.php
    includes/
        menu.php

Your index.php page could be a simple one like this:

<?php
    $page = 'home';
    $title = 'My homepage';
    $othertitles = ['contact'=>'My contact page','about'=>'My about page'];
    if(isset($_GET['page']) && in_array($_GET['page'], ['contact','about']))
    {
        $page = $_GET['page'];
        $title = $othertitles[$page];
    }
?>
<...DTD...>
<html>
<head>
<title><?=$title?></title>
//css, maybe js, meta data etc
</head>
<body>
    <div id="banner">...</div>
    <?=$menu?>
    <div id="page">
    <? include "pages/$page . ".php" ?>
    </div>
</body>
</html>

This would mean your urls from the menu:

'contact' = 'index.php?page=contact'
'about' = 'index.php?page=about'
'home' = 'index.php'

These can be "re-written" very nicely with Apache mod rewrite to:

'contact' = '/contact'
'about' = '/about'
'home' = '/'
commented: Alot better. This should work for him. +3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.