doudie2693 2014-01-28 14:53
浏览 30

包括不同的页面

I've been trying to figure this one out for awhile, but since i can't find the solution im hoping someone could help me with this.

I made a website, in which there are at the moment 3 different menu options, home contact and an orderpage. Which are in different subfolders. I have index.php in the main folder, and from there on i have a folder named includes and layout. In includes i have the contact.php, orderpage.php. And in layout i have the .css and the menu.php for example.

Now i need to use the include 'something.php'; to include all the pages i need. So you don't get redirected to another page it will just include a different page each time you click another option in the menu.

i hope my question is clear, if not please tell me what i should include.

  • 写回答

2条回答 默认 最新

  • doukezi4576 2014-01-28 15:04
    关注

    From the question it Reads like that: You try to load all Pages at Once and then simply switch between them.

    Problem: PHP doesnt work Like that. Dynamic Content on already loaded Pages can only be handled with Javascript. PHP is only run Server side and all the Code has already run, after you enter a Page.

    What you indeed can do, is loading all Content at once in seperate Div Containers and then simply Switching them by Hiding showing them. But you realy should do a Seperate Page for each of your Pages. So onclick you Switch to the correct Page. If you load a PHP Page, you only use the Code you want for this Page. Dont worry about loading Template Files like css or Images new. On the first Access to a Webpage, the User downloads all Files, if they dont Change, he has them already.

    评论

报告相同问题?