473,396 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How do i view 37 pages in one page?

Hi, i've been looking for a way to have all my site pages into one

http://mysite/mypage/index?view=home or view=downloads..etc

how would i go about doing this? I'm really novice at this. To see an example of what i want, here are two links that are on one page, but are diffrent

http://nwvault.ign.com/static.php?page=contact
http://nwvault.ign.com/static.php?page=addcontent
Jul 31 '07 #1
1 1119
nathj
938 Expert 512MB
Hi, i've been looking for a way to have all my site pages into one

http://mysite/mypage/index?view=home or view=downloads..etc

how would i go about doing this? I'm really novice at this. To see an example of what i want, here are two links that are on one page, but are diffrent

http://nwvault.ign.com/static.php?page=contact
http://nwvault.ign.com/static.php?page=addcontent
Hi phpnoob07,

Welcome to TSDN!

If I understand you correctly what you are after is one url index.php to load many different pages within your site based on the query string, is that correct?

If I am correct then you need to use the query string as you have done above for each link to the page. Then on the page, static.php have code such as this:
Expand|Select|Wrap|Line Numbers
  1. <?php
  2. // this is psuedo code really - but the structure is fine
  3.  
  4. / default page header stuff
  5.  
  6. if (empty($_GET['page']))
  7. {
  8.   $lcPage = 'default';
  9. }
  10. else
  11. {
  12.   $lcPage = $_GET['page'];
  13. }
  14.  
  15. switch($lcPage)
  16. {
  17.   case 'contact':
  18.   // include the contact page from a separate file
  19.   break ;
  20.   case 'downloads':
  21.   // include the downloads page from a separate file
  22.   break ;
  23.   case 'addcontent':
  24.   // include the addcontent page from a separate file
  25.   break;
  26.   default: // the catch all else - ensures that what ever is in the QS the visitor will be directed here if it's not valid
  27.   // include the main default page from a separate file
  28.   break;
  29. }
  30. // defult page footer stuff
  31. ?>
  32.  
Each page you wish to have can be built into a separate file and then loaded via the include() function.

Remember php is a case sensitive language so if the url says 'addContent' the switch statement must also say addContent.

As a point of personal preference I prefer to use numbers on the end of the query string, there's no real advantage that I know of it's just the way my brain works.

Hopefully this will have set you of on the right track. If you have any more questions just drop back here anytime.

Cheers
nathj
Jul 31 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Droolboy | last post by:
I'm trying to build a fairly small (max. 10 different pages) site using php, and it's becoming obvious that I need some kind of model view separation. Having done a few searches, I've come...
4
by: Jerry | last post by:
I recently upgraded my PC from Windows XP Home to XP Professional, so that I can use XP Pro's build in IIS functionality to build ASP pages off of my home PC. I have installed IIS 5.1, configured...
4
by: pmud | last post by:
Hi I have a website (ASP.NET project using C# ) which is already put up on the server. I need to make some modification to some web pages.So the project files were copied to the a different server...
2
by: Brad | last post by:
I have an intranet app that has just started sporadically getting the following error "The viewstate is invalid for this page and might be corrupted." By sproadic I mean 3-4 times during the past...
1
by: Nogusta123 | last post by:
Hi, I have had a lot of problems getting web pages, master pages and content pages to render in VS2005 design view the same as they would in Internet Explorer. I did a lot of looking on the...
0
by: rinishrk | last post by:
Hi, I have a web application that contains subfolders Admin and User with related webpages inside them. Within the Admin folder I have a page containing a Tree View Control.I want this tree view...
3
ammoos
by: ammoos | last post by:
Hi friends… I got a VBA application(MS Access 2003) that almost already completed and I’ve some maintenance work in that application.. but unfortunately some of the pages are not responding while I...
4
by: Weatherman | last post by:
I've searched for an answer to this and can't find one. I can't view pages with the PHP suffix. The basic (top) part comes up in my browser, but the part with the PHP element does not. I've...
2
by: skijor | last post by:
For a page that display's a catalogue of items in table format. If the number of rows extends below the view, in some browsers (safari, firefox) the page shifts to the left a little bit. It's...
1
by: =?Utf-8?B?YWJjZA==?= | last post by:
My application is using ASP.NET 3.0 and My ASPX pages contain Master page, and content page. The content page (.aspx) has various User controls (ascx). My page view state is significantly large and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.