how do i display all my other pages in my index page content.

e.g. i have a menu and when user clicks on a section like music it doesnt go to music page but shows the music page in contents section of index page.


Recommended Answers

All 5 Replies

If you're really in a hurry and are willing to deal with a horde of angry, standards-wielding html-ers, you can look up this iframe article randomly Googled by yours truly.

But if you have more time, you can read about AJAX and PHP and 'dynamically' load certain pages or content into a portion/element of your index page.


i have alot of time...as i am learning as well. can you please provide a tutorial about the second solution in ur comment.


AJAX isn't a new language, it's just based on javascript (but it somehow 'interacts' with the server because it can 'call' pages). So with what you want to do, the benefits of AJAX isn't very obvious. However, it's very useful to learn because of that being-able-to-call-pages functionality (and some really cool animation effects).

(So you won't curse the day I was born when you get stuck trying to learn it.)

Usually when a user clicks on a link or on a "submit" button, the whole page is "submitted" and a new page is loaded (HTML/PHP/ some other page).

Assuming you couldn't do it with an iframe, you can use AJAX to get the value of the link (or to just react if a certain link is clicked) and do something based on that action (link-clicking) which can be one of the ff:
- animate something
- call some php/html/.something page and get the value it returns

If you're already familiar with javascript, you can just read the uses or view some samples of AJAX in action:
- a bit of a serious article about AJAX
- a cool/easy-to-understand article demonstrating AJAX uses for designers - the page for the jQuery demos can be found here

jQuery is an AJAX library (just a .js file you include in your pages, like an external CSS file that allows you to start using AJAX instead of having to start from scratch using this W3schools tutorial.

As a last attempt to convert you (hehe), the being-able-to-call-pages functionality of AJAX allows you to connect to a database and dynamically change a portion of your page without having to reload the whole page (since you can call PHP pages and PHP can interact with your database).

An example of that is a registration form which, on clicking the submit form, uses AJAX to call a PHP script and check the database if the username is taken and stopping the submission process if so. Instead of having to submit the whole page and wait for everything to be processed before generating all the errors.

cool explanation. thanks alot mate

You're welcome. Hope you find it useful. =)

Be a part of the DaniWeb community

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