943,693 Members | Top Members by Rank

Ad:
  • ASP Discussion Thread
  • Marked Solved
  • Views: 2717
  • ASP RSS
Oct 19th, 2008
0

View multiple pages using single file

Expand Post »
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??
Similar Threads
Reputation Points: 37
Solved Threads: 7
Junior Poster
raul15791 is offline Offline
102 posts
since Jun 2008
Oct 22nd, 2008
1

Re: View multiple pages using single file

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
ASP Syntax (Toggle Plain Text)
  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:
ASP Syntax (Toggle Plain Text)
  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!
Reputation Points: 11
Solved Threads: 7
Junior Poster in Training
Baradaran is offline Offline
88 posts
since Feb 2007
Nov 1st, 2008
0

Re: View multiple pages using single file

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.
Reputation Points: 37
Solved Threads: 7
Junior Poster
raul15791 is offline Offline
102 posts
since Jun 2008
Nov 1st, 2008
0

Re: View multiple pages using single file

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.
Reputation Points: 10
Solved Threads: 1
Newbie Poster
Pg-online is offline Offline
2 posts
since Aug 2008
Nov 2nd, 2008
0

Re: View multiple pages using single file

I already got a hosting server and database. The dynamic content part is also done now. Thanks for all the help given!!

Cheers....
Reputation Points: 37
Solved Threads: 7
Junior Poster
raul15791 is offline Offline
102 posts
since Jun 2008

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in ASP Forum Timeline: sql help
Next Thread in ASP Forum Timeline: Funky enter key behavior





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC