|
I`m using ASP and Access 2000 database to try and create a web portfolio of work. I need to keep a listing of the site tiles as well as showing the details of each site on the same page.
I know I can separate them easily enough... so I could have one script listing clickable links and another script (client_detail.asp) display the relevant details, with a `back` button to the listing.
But I would like to combine them on a single page.. so far it`s behaving erratically sometimes working othertimes I get errors!
Anyone done anything like this? Would appreciate any help or pointers on this one!
|
|
|
I have created projects where a single ASP file may generate multiple unique but related pages. For example, A product admin tool for an e-commerce application where the interface provides a way to search the list of products, edit an existing product, or add a product. When editing or adding a product, the interface provides multiple "tabs" to enter all the product details. Each "tab" logically groups related properties. Without this, the product properties page would be really long and confusing. My point is, I`ve written applications like this where all of the above is a single ASP file.
Unfortunately, most of the ASP examples you run into out there show a seperate file for each tiny step in the application. For example, they`ll show one ASP file that creates an HTML FORM. Then they`ll have a seperate ASP file that processes the form. I almost never do this. Instead, I create a single ASP file that either draws the form or processes the form depending on whether the page is initially called or has a form submitted to it. This way you can do server-side validation, and spit the form back to the user with their data intact for them to fix and re-submit.
Man -- I say too much just trying to explain a simple thing.
Depending on your current understanding of programming and ASP, there may be a lot to explain, I`ll try to give you enough tidbits.
Create functions to create the specific sections of your HTML page or your server-side processing, then call them appropriately.
-----------------------------
<%
`Get the selected id if exists.
Dim id = Request("id")
call ShowPage()
function ShowPage()
%>
<html>
<head>
<title>Test Code from Troy</title>
</head>
<body>
<form method=post action="/forum/myPage.html">
<input type=hidden name=id value="<% = id %>">
</form>
<!-- enter any HTML code you want -->
<% call ShowTitles() %>
<hr>
<%
if id <> "" then
call ShowDetail()
end if
%>
</body>
</html>
<%
end function `ShowPage
function ShowTitles()
`Put code here to show your titles as links to the detail.
end function `ShowTitles
function ShowDetail()
`Put code here to show the appropriate detail depending on the selected id.
end function `ShowDetail
%>
-----------------------------
When your visitors click a title, you need to resubmit the page and come back showing the list and the selected title`s detail. So you need to change the value of the "id" element in the form. Use Javascript to do this. Below I show a possible javascript function and a sample HTML link to fire the script and submit the form.
-----------------------------
<script language=javascript>
function SelectTitle(id) {
document.forms[0].id.value = id;
document.forms[0].submit();
}
</script>
<a href="JavaScript:SelectTitle(14)">Client XYZ site</a>
-----------------------------
If you made it this far, you must enjoy reading. Just follow up here with additional questions and feedback.
|
|
|
|
|
Hi Troy,
Excellent reply! Very comprehensive and I can see the logic but it made me realise how little I really know about ASP and programming!
I took the liberty of visiting your home site (also excellent!) :c) and I spotted a script you`re using for a collection of photo albums - http://family.realm7.com/r7/ephoto/ePhoto.asp.
That`s exactly the sort of page I was looking for... guess there`s no chance of a sneaky glance at that code?? :c)
Many thanks for pointing me in the right direction
Paul
|
|
|
Thanks for the kind words, Paul. Regarding my personal homepage, I think "excellent" is a bit of an exageration! It`s just a big picture of my head and some links!
realm7.com is one of the domains I own. I`m really not doing anything with it except some email accounts and my ePhoto system. ePhoto started as an idea for a product I could market, but then I never polished it! (Man, I am LAZY!) I am glad to give you the code, but it`s messy right now. It`s an ASP application that uses SQL Server for the data. When you are logged in as an authenticated user, you can add albums, add photos to albums, and add comments to photos. One powerful feature of the system is that when people upload photo files, the system automatically resamples the image to 72dpi. If the uploaded image is too large, the system automatically resizes the image to 700 pixels wide. Also, the thumbnails are auto-generated. It`s been a big hit with my family since I launched it a few months ago.
Here are the gotchas: I`m using a commercial ASP component called AspImage from www.serverobjects.com. I`m also using the commercial ASP component AspUpload from www.persits.com. It could be easily modified to use an Access file for the data instead of SQL Server.
I`m in the process of moving all my domains to a new server so the ePhoto system will be going down for a few days. But after that, I hope to polish it, then offer 2 ways of using it. 1) I`ll host your personalized photo site--all you have to do is link to your ePhoto subdomain (paul.realm7.com). There would be a monthly subscription charge. 2) License the code for a one-time fee, and host the system on your own server. I want to rewrite the system using C# to create an ASP.NET application.
But, remember I`m lazy, so this will never happen.
|
|
|
|
|
|
|
|
|
|