View multiple pages using single file

Thread Solved

Join Date: Jun 2008
Posts: 89
Reputation: raul15791 is an unknown quantity at this point 
Solved Threads: 7
raul15791 raul15791 is offline Offline
Junior Poster in Training

View multiple pages using single file

 
0
  #1
Oct 19th, 2008
Hi,

I'm newbie in ASP. I am trying to view multiple pages by using a single file.
For example,

I have a few pages of product.asp (products.asp, products1.asp and so on). Now I want to create a single single (products.asp) but can view multiple pages.

Try to search through google but not even sure what to search for.


Help??
Reply With Quote Quick reply to this message  
Join Date: Feb 2007
Posts: 66
Reputation: Baradaran is an unknown quantity at this point 
Solved Threads: 4
Baradaran Baradaran is offline Offline
Junior Poster in Training

Re: View multiple pages using single file

 
1
  #2
Oct 22nd, 2008
Hi,
There are different methods for using one file (product.asp) to display dynamic content.

One simple method is to select case based on the product ID sent to the page through the address: imagine you visit the page product.asp?product_id=1
  1.  
  2. Select Case Request.QueryString("product_id")
  3. Case 1
  4. 'CONTENT RELATED TO PRODUCT ONE
  5. Response.Write "Product 1"
  6.  
  7. Case Else 'no product is selected
  8. Response.Write "<h3>Please select a product</h3>"
  9. Response.Write "<a href=""product.asp?product_id=1"">Product 1 </a>"
  10. End Select

Another method is to use SSI (Server Side Includes). You can include files based on the product ID retrieved from the querystring:
  1. Select Case Request.QueryString("product_ID")
  2.  
  3. Case 1 %>
  4. <!-- #Include File = "product1.asp" -->
  5. <% Case 2 %>
  6. <!-- #Include File = "product2.asp" -->
  7. ...
  8. ...
  9.  
  10. <% Case Else %>
  11. <!-- #Include File = "product_overview.asp" -->
  12.  
  13. <% End Select %>

Based on this you can build a whole website, which is displayed in one page only!

Good luck, happy coding!
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 89
Reputation: raul15791 is an unknown quantity at this point 
Solved Threads: 7
raul15791 raul15791 is offline Offline
Junior Poster in Training

Re: View multiple pages using single file

 
0
  #3
Nov 1st, 2008
Sorry Baradaran... Can you elaborate more on the first solution? Where should I put that? Is it in the <body> part? Where should i assign the value to product_id?

If I use the second solution means i still have to create multiple products.asp file? I see in the coding I still to include a few products.asp file right?

Thanks...
Last edited by raul15791; Nov 1st, 2008 at 12:24 pm.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 2
Reputation: Pg-online is an unknown quantity at this point 
Solved Threads: 1
Pg-online Pg-online is offline Offline
Newbie Poster

Re: View multiple pages using single file

 
0
  #4
Nov 1st, 2008
hi!, what you need to do is use a database this will make things much easier to manage and will save page space. need with setting up a database driven page website ask me.
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 89
Reputation: raul15791 is an unknown quantity at this point 
Solved Threads: 7
raul15791 raul15791 is offline Offline
Junior Poster in Training

Re: View multiple pages using single file

 
0
  #5
Nov 2nd, 2008
I already got a hosting server and database. The dynamic content part is also done now. Thanks for all the help given!!

Cheers....
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC