Jump to content

Page Designssssssss


RoyalShrubber

Recommended Posts

ummm, in designing of my home web page I've came to one obstacle. I am hoby programmer, and I started my home web page project. I knew VB6 from past, so with help of w3schools I managed to learn alot of classic ASP.So I was able to build pretty sophisticated framework, which let me add pages to site without applying style to every page, just a single line in each page and I could even change styles (without help of any css :) ). The problem is I have to use address bar information (Request.QueryString) to properly display page. Example would be http://mypage.com/default.asp?ID=page:somepage. I could call from somepage.asp to default.asp and it would call that file back but I consider that 'clumsy'.Notice that I have designed site in a way that every page consists of 3 parts: title, main body, and menu. The concept of my page is the following: 1. default.asp finds trough cookie selected user’s style and transfers execution to appropriate style asp file along with arguments. 2. The style asp has design which looks like empty page and where the content would be are asp function calls. The style asp also includes 'core' asp where the bodies of functions mentioned before are. So trough these function the somepage.asp, somepageTitle.asp, and somepageMenu.asp are executed. And in the same manner every page builds up.The problem is I would like to use .../somepage.url without that additional 'default.asp?ID=page:nonsense'. I tought CSS would give me that power, so I learned how it works and I nearly started redesigning, but I found one problem. With CSS I can change position, change fonts, backgrounds, but I can't add any text or code to the style. One example would be that I got in mind one secret style which would be parody to that xxx pages (codename red light district). And for that reason I would like to have each time other hostess, other neon displays…, other example would be to have some text completely out of 'title', 'menu', 'body' …So does anybody know how to redesign my page so I could use 'normal' url and keep having features that gives me my current design?thx for help :)

Link to comment
Share on other sites

… probably you’ll understand nothing, unless you know slovene, but it is example...expl.jpghehe, this is rather borring example, but I have implemented a lot of stuff with asp (directory listening, message posting...)The reason I didn't gave my page url is that it is running on my computer which isn’t running all the time as opposed to ISP computers that are of course running nonstop (but they have 10 mb limit so I don't have page there)

Link to comment
Share on other sites

ummm, in designing of my home web page I've came to one obstacle. I am hoby programmer, and I started my home web page project. I knew VB6 from past, so with help of w3schools I managed to learn alot of classic ASP.So I was able to build pretty sophisticated framework, which let me add pages to site without applying style to every page, just a single line in each page and I could even change styles (without help of any css  :) ). The problem is I have to use address bar information (Request.QueryString) to properly display page. Example would be http://mypage.com/default.asp?ID=page:somepage. I could call from somepage.asp to default.asp and it would call that file back but I consider that 'clumsy'.Notice that I have designed site in a way that every page consists of 3 parts: title, main body, and menu. The concept of my page is the following: 1. default.asp finds trough cookie selected user’s style and transfers execution to appropriate style asp file along with arguments. 2. The style asp has design which looks like empty page and where the content would be are asp function calls. The style asp also includes 'core' asp where the bodies of functions mentioned before are. So trough these function the somepage.asp, somepageTitle.asp, and somepageMenu.asp are executed. And in the same manner every page builds up.The problem is I would like to use .../somepage.url without that additional 'default.asp?ID=page:nonsense'. I tought CSS would give me that power, so I learned how it works and I nearly started redesigning, but I found one problem. With CSS I can change position, change fonts, backgrounds, but I can't add any text or code to the style. One example would be that I got in mind one secret style which would be parody to that xxx pages (codename red light district). And for that reason I would like to have each time other hostess, other neon displays…, other example would be to have some text completely  out of 'title', 'menu', 'body' …So does anybody know how to redesign my page so I could use 'normal' url and keep having features that gives me my current design?thx for help  :)

This problem is exactly what ASP Includes are for. Basically, every ASP website ever is constructed in pieces, usually with a header.asp, footer.asp, and maybe a menu.asp in between.Example Header.asp:
<html><head><title>My Site</title><style>/* some style sheet goes here */</style></head><body>

Example Footer.asp:

<p>Some copyright notice here</p></body></html>

Then, for any single page on your site, you can display it like this, example Cat.asp:

<%@ Language="VBScript" enablesessionstate=false %><!--#include file="header.asp"-->I like cats, they rock![i]Miscellaneous cat appreciation goes here[/i].<!--#include file="footer.asp"-->

The page above will execute, putting the code from the other files in the place where the includes are located. (Yes, there can be includes inside other includes.)Now, as for your page, I recommend doing this:1) Seperate your main functions from the rest of your code, put it in a file called global.asp. You can use <!--#include file="global.asp"--> to include those functions in any page.2) Next, if you have several different styles for your site, you can create several different files called style1.asp, style2.asp, style3.asp and so on. Then you this code to call any style:

<%Dim myStylemyStyle = request.Cookies("MyCookies")("someStyle")         'The cookie should contain the value "style1.asp" or "style2.asp" or whatever the names of your style files are called.Server.execute myStyle%>

You could probably call the code above inc_style.asp and include it in your header.asp.3) If you are looking to change more than just the CSS, such as chaging where elements on your page are laid out, then this technique works really well:3.1) You'll have to store your page elements in a database, where each element is its own field. So you'll have to create a database and a few tables.In the first table, add the following fields: ID, Author, DateCreated, DateEdited, Article, Title, any other desired fields.In the second table, add the following fields: ID, Template.I recommend using ID in your tables because its easier to reference rows by ID rather than by article or template title.3.2) Your template will be written in a kind of pseudomarkup language, put it will position elements on your page like this:

<table><tr><td>$AUTHOR</td><td>$DATE</td></tr><tr><td colspan="2"><b>$TITLE</b><p>$Article</td></tr></table>

(I usually like to use the [element] format, because its a little more human readable.)3.3) For each page, you'll have to use an SQL query to extract the ID, Author, Title, and other information into variables like this:

<%Author = rs("Author")Title = rs("Title")Article = rs("Article")' You might have to execute another SQL query to retrieve the template from the other tableTemplate = rs("Template")'...etc. ...%>

3.4) Now that you have all your data, you can start making replacements:

<%Template = replace(Template, "$AUTHOR", Author, 1, -1, vbTextCompare)Template = replace(Template, "$TITLE", Title, 1, -1, vbTextCompare)Template = replace(Template, "$Article", Article, 1, -1, vbTextCompare)Template = replace(Template, "$DATE", Date, 1, -1, vbTextCompare)'...etc. ...'After all of the replacements are done, just print your Template variableReponse.write Template%>

The first 2 options are consistent with having normal looking URLs. The third option requires you to use a URL like article.asp?id=10 or something similar, although it technically is possible to have normal looking URLs if you're willing to recycle the same code over and over for each page.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...