Author Topic: RAWK Web Development Circle  (Read 118962 times)

Offline sattapaartridge

  • The new 'pete price' of RAWK.
  • Legacy Fan
  • ******
  • Posts: 5,535
  • @sattapaal
Re: RAWK Web Development Circle
« Reply #280 on: March 23, 2011, 07:34:10 pm »
If any of the web designers on here are interested, I have IE6 - IE8 all in their own .exe file, no installation required.

meaning you can run them side by side?
did you know that 10 x 2 and 11 x 2 have the same answer?

Offline AnfieldIron

  • Water Like a Stone. Local laundry service ...
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 2,515
Re: RAWK Web Development Circle
« Reply #281 on: May 11, 2011, 10:13:54 pm »
Got an assignment for Uni, the task is ...

Your task is to create a website to market yourself to potential employers. You should include a cv and a photo of yourself. You may also wish to include examples of your work. You will create a secure area where you can log in and manage your site. The secure area must allow you to upload, edit and delete both images and text.

Just wondering what's the best way to go about creating something to edit the text on a page, and uploading an image. It shouldn't be that hard but I cannot for the life of me think.

Offline Degs

  • sy's midnight runners.
  • Legacy Fan
  • ******
  • Posts: 13,444
Re: RAWK Web Development Circle
« Reply #282 on: May 11, 2011, 10:33:08 pm »
Got an assignment for Uni, the task is ...

Your task is to create a website to market yourself to potential employers. You should include a cv and a photo of yourself. You may also wish to include examples of your work. You will create a secure area where you can log in and manage your site. The secure area must allow you to upload, edit and delete both images and text.

Just wondering what's the best way to go about creating something to edit the text on a page, and uploading an image. It shouldn't be that hard but I cannot for the life of me think.

What language are they teaching you?

You could use any server side language I use VB.Net in my day to day work, C# is near enough the same and if you use C/Java the syntax is familiar and link these up to a SQL Server database.

If you want the open source route (which I did in Uni) you could use the likes of php and mySQL.

Depends on what you know/are comfortable with but remember to learn as you go and not just copy paste.

Offline SP

  • Thor ain't got shit on this dude! Alpheus. SPoogle. The Equusfluminis Of RAWK. Straight in at the deep end with a tube of Vagisil. Needs to get a half-life. Needs a damned good de-frag.
  • RAWK Staff.
  • Legacy Fan
  • ******
  • Posts: 36,042
  • .
  • Super Title: Southern Pansy
Re: RAWK Web Development Circle
« Reply #283 on: May 11, 2011, 10:41:13 pm »
Got an assignment for Uni, the task is ...

Your task is to create a website to market yourself to potential employers. You should include a cv and a photo of yourself. You may also wish to include examples of your work. You will create a secure area where you can log in and manage your site. The secure area must allow you to upload, edit and delete both images and text.

Just wondering what's the best way to go about creating something to edit the text on a page, and uploading an image. It shouldn't be that hard but I cannot for the life of me think.

Install WordPress. Go to the pub. Result.

Offline markay_stinkay

  • Legacy Fan
  • ******
  • Posts: 10,864
  • ☆☆☆☆☆☆
    • Bet £50, get £50 free
Re: RAWK Web Development Circle
« Reply #284 on: May 11, 2011, 10:51:15 pm »
Doing a bit of log4j at the moment, need to log errors from a Java file to a postgres DB.

Is there a way of inserting a variable contained in the Java file? At the moment I'm just inserting the timestamp and message using %d %m but I'd ideally like to insert a reference to a variable, too.

Offline AnfieldIron

  • Water Like a Stone. Local laundry service ...
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 2,515
Re: RAWK Web Development Circle
« Reply #285 on: May 11, 2011, 11:02:26 pm »
What language are they teaching you?

You could use any server side language I use VB.Net in my day to day work, C# is near enough the same and if you use C/Java the syntax is familiar and link these up to a SQL Server database.

If you want the open source route (which I did in Uni) you could use the likes of php and mySQL.

Depends on what you know/are comfortable with but remember to learn as you go and not just copy paste.

I'm using PHP and MySQL mate. Not done that much so far, only simple things like registration/log in forms, etc.

I did something for my project which used a JQuery to retrieve things from my database, and then made a form to change what was in the database, was thinking I may be able to use something like that.

Install WordPress. Go to the pub. Result.

 ;D I've heard that being talked about, but I decided I wanted to have a go at that when I felt confident enough, so I'm not sure where to start with that. I imagine I'd only need something simple.

EDIT:

Apologies if any of that didn't make much sense. Been up far too long and my head is scattered!  :odd
« Last Edit: May 11, 2011, 11:05:20 pm by AnfieldIron »

Offline wacko

  • Keepsh a shecret gottle of Shcotch in hish top drawer. Cunning linguist and ical genius
  • Legacy Fan
  • ******
  • Posts: 5,205
Re: RAWK Web Development Circle
« Reply #286 on: May 12, 2011, 01:33:53 pm »
I'm using PHP and MySQL mate. Not done that much so far, only simple things like registration/log in forms, etc.

I did something for my project which used a JQuery to retrieve things from my database, and then made a form to change what was in the database, was thinking I may be able to use something like that.

 ;D I've heard that being talked about, but I decided I wanted to have a go at that when I felt confident enough, so I'm not sure where to start with that. I imagine I'd only need something simple.

EDIT:

Apologies if any of that didn't make much sense. Been up far too long and my head is scattered!  :odd

For that little bit, you might as well use text files rather than bother with MySQL.
Quidquid latine dictum sit, altum sonatur.

Offline markay_stinkay

  • Legacy Fan
  • ******
  • Posts: 10,864
  • ☆☆☆☆☆☆
    • Bet £50, get £50 free
Re: RAWK Web Development Circle
« Reply #287 on: May 16, 2011, 04:57:44 pm »
I have two postgres DB's I need to pull information from. Two tables in exactly the same format (two columns, 'logdate' and 'message'). After I've performed a pg_query and stored the result, what's the best way to 'stick' the results together? Is there such a method? As once 'together', I need to sort them by date order. Currently I'm just outputting the data once obtained, but obviously it's not in order of date. I'm using PHP btw.

EDIT: Just incase it's unclear.

$result1 = pg_query($connection1, $sql);
$result2 = pg_query($connection2, $sql);

I want the data to be as 'one', so I can then sort the data as whole by date.
« Last Edit: May 16, 2011, 05:01:50 pm by markay_stinkay »

Offline ♠Dirty Harry♠

  • Michael Pain the tittie-fixated inflatable doll salesman
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 19,031
Re: RAWK Web Development Circle
« Reply #288 on: May 16, 2011, 05:40:34 pm »
meaning you can run them side by side?

Shit never seen this post, yeah you can run them all concurrently. Anyone can Drop me a pm and I can send you a sugarsync link to download from
« Last Edit: May 16, 2011, 05:42:37 pm by ♠Dirty Harry♠ »

Offline SP

  • Thor ain't got shit on this dude! Alpheus. SPoogle. The Equusfluminis Of RAWK. Straight in at the deep end with a tube of Vagisil. Needs to get a half-life. Needs a damned good de-frag.
  • RAWK Staff.
  • Legacy Fan
  • ******
  • Posts: 36,042
  • .
  • Super Title: Southern Pansy
Re: RAWK Web Development Circle
« Reply #289 on: May 16, 2011, 08:45:38 pm »
I have two postgres DB's I need to pull information from. Two tables in exactly the same format (two columns, 'logdate' and 'message'). After I've performed a pg_query and stored the result, what's the best way to 'stick' the results together? Is there such a method? As once 'together', I need to sort them by date order. Currently I'm just outputting the data once obtained, but obviously it's not in order of date. I'm using PHP btw.

EDIT: Just incase it's unclear.

$result1 = pg_query($connection1, $sql);
$result2 = pg_query($connection2, $sql);

I want the data to be as 'one', so I can then sort the data as whole by date.

Considered using dblink?

http://www.postgresql.org/docs/9.0/interactive/dblink.html

Offline markay_stinkay

  • Legacy Fan
  • ******
  • Posts: 10,864
  • ☆☆☆☆☆☆
    • Bet £50, get £50 free
Re: RAWK Web Development Circle
« Reply #290 on: May 23, 2011, 05:17:22 pm »
Thanks, i'll have a look at that, but am in a bit of a rush atm so just used basic arrays.

I have another amateur question, if you don't mind taking 5 minutes to answer it.

Using Javascript, how do I dynamically populate a 2nd combo-box based on a user selection from a 1st one? So far I have an onchange event in the 1st combo-box calling a function in Javascript, then based on the id of the first selection, I need to make a call to the database and populate the 2nd combo-box with the available options. Bit unsure how to do this, as obviously Javascript is client-side and PHP is server. I'm trying to avoid using Ajax btw.

Offline wacko

  • Keepsh a shecret gottle of Shcotch in hish top drawer. Cunning linguist and ical genius
  • Legacy Fan
  • ******
  • Posts: 5,205
Re: RAWK Web Development Circle
« Reply #291 on: May 24, 2011, 02:09:07 pm »
Thanks, i'll have a look at that, but am in a bit of a rush atm so just used basic arrays.

I have another amateur question, if you don't mind taking 5 minutes to answer it.

Using Javascript, how do I dynamically populate a 2nd combo-box based on a user selection from a 1st one? So far I have an onchange event in the 1st combo-box calling a function in Javascript, then based on the id of the first selection, I need to make a call to the database and populate the 2nd combo-box with the available options. Bit unsure how to do this, as obviously Javascript is client-side and PHP is server. I'm trying to avoid using Ajax btw.

If you don't want to use AJAX, you'll have to preload all the possible options into JS arrays in the page. Basically, you'll have to generate JS with PHP. Dunno if PHP now has built-in JSON support, but if it has, use that.
Quidquid latine dictum sit, altum sonatur.

Offline SP

  • Thor ain't got shit on this dude! Alpheus. SPoogle. The Equusfluminis Of RAWK. Straight in at the deep end with a tube of Vagisil. Needs to get a half-life. Needs a damned good de-frag.
  • RAWK Staff.
  • Legacy Fan
  • ******
  • Posts: 36,042
  • .
  • Super Title: Southern Pansy
Re: RAWK Web Development Circle
« Reply #292 on: May 24, 2011, 02:15:58 pm »
If you don't want to use AJAX, you'll have to preload all the possible options into JS arrays in the page. Basically, you'll have to generate JS with PHP. Dunno if PHP now has built-in JSON support, but if it has, use that.

It does.

http://www.php.net/manual/en/book.json.php

Offline markay_stinkay

  • Legacy Fan
  • ******
  • Posts: 10,864
  • ☆☆☆☆☆☆
    • Bet £50, get £50 free
Re: RAWK Web Development Circle
« Reply #293 on: June 2, 2011, 06:07:55 pm »
Thanks lads, I was told not to use Ajax, but that seemed the best solution so I went ahead and used it. ;D

Now just to get it to work in IE...

Offline wacko

  • Keepsh a shecret gottle of Shcotch in hish top drawer. Cunning linguist and ical genius
  • Legacy Fan
  • ******
  • Posts: 5,205
Re: RAWK Web Development Circle
« Reply #294 on: June 2, 2011, 10:48:20 pm »
If you were told not to use AJAX, perhaps it'd be best not to use it...
Quidquid latine dictum sit, altum sonatur.

Offline markay_stinkay

  • Legacy Fan
  • ******
  • Posts: 10,864
  • ☆☆☆☆☆☆
    • Bet £50, get £50 free
Re: RAWK Web Development Circle
« Reply #295 on: June 3, 2011, 11:11:38 am »
Nah, I think it was more of a guideline rather than set in stone. He probably won't notice tbf.

Anyway, and idea why this works in Firefox but not IE 8?

Code: [Select]
var httpxml;
try {
  // Firefox, Opera 8.0+, Safari
  httpxml = new XMLHttpRequest();
alert("Firefox, Opera 8.0+, Safari");
  }
catch (e) {
  // Internet Explorer
try {
    httpxml = new ActiveXObject("Msxml2.XMLHTTP");
alert("Internet Explorer");
    } catch (e) {
    try {
      httpxml = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
}

Offline PaulV

  • RAWK Pope
  • RAWK Supporter
  • Kopite
  • ******
  • Posts: 642
Re: RAWK Web Development Circle
« Reply #296 on: June 3, 2011, 11:27:43 am »
Anyway, and idea why this works in Firefox but not IE 8?
Code: [Select]
catch (e)
What does the exception say? Display e.name, e.message, e.description.
To many people have discovered "Football Manager" and now they all think they are Kenny but alas so many end up as Roy

Offline Andy @ Allerton!

  • Missing an asterisk - no, wait sorry, that's his rusty starfish..... RAWK Apple fanboy. Hedley Lamarr's bestest mate. Has done nothing incredible ever.
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 73,204
  • Asterisks baby!
Re: RAWK Web Development Circle
« Reply #297 on: June 3, 2011, 11:29:27 am »
Nah, I think it was more of a guideline rather than set in stone. He probably won't notice tbf.

Anyway, and idea why this works in Firefox but not IE 8?

Code: [Select]
var httpxml;
try {
  // Firefox, Opera 8.0+, Safari
  httpxml = new XMLHttpRequest();
alert("Firefox, Opera 8.0+, Safari");
  }
catch (e) {
  // Internet Explorer
try {
    httpxml = new ActiveXObject("Msxml2.XMLHTTP");
alert("Internet Explorer");
    } catch (e) {
    try {
      httpxml = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (e) {
      alert("Your browser does not support AJAX!");
      return false;
      }
    }
}

Is this the same thing?

http://w3schools.invisionzone.com/index.php?showtopic=27028
I love you all. Even Mancs x

Offline markay_stinkay

  • Legacy Fan
  • ******
  • Posts: 10,864
  • ☆☆☆☆☆☆
    • Bet £50, get £50 free
Re: RAWK Web Development Circle
« Reply #298 on: June 3, 2011, 11:33:39 am »
It doesn't get as far as the catch, it always sets httpxml as a new XMLHttpRequest() in both Firefox (as expected) and IE.

Although, I've tried setting httpxml as always a new ActiveXObject("Msxml2.XMLHTTP") just to get it working in IE, but even then it still doesn't.

Offline PaulV

  • RAWK Pope
  • RAWK Supporter
  • Kopite
  • ******
  • Posts: 642
Re: RAWK Web Development Circle
« Reply #299 on: June 3, 2011, 11:37:39 am »
It doesn't get as far as the catch, it always sets httpxml as a new XMLHttpRequest() in both Firefox (as expected) and IE.
What happens when you try using httpxml in IE (set as new XMLHttpRequest)

Can you use one of the Javascript frameworks (JQuery, Prototype, Dojo)? I believe they sort out a lot of the browser specific issues.
To many people have discovered "Football Manager" and now they all think they are Kenny but alas so many end up as Roy

Offline markay_stinkay

  • Legacy Fan
  • ******
  • Posts: 10,864
  • ☆☆☆☆☆☆
    • Bet £50, get £50 free
Re: RAWK Web Development Circle
« Reply #300 on: June 3, 2011, 12:08:05 pm »
Having done some research, it would appear it's not the Ajax that's the issue, as IE7+ now uses XMLHttpRequest.

Looks like it is the way I'm populating my combo-box.

Code: [Select]
document.searchLog.widgetid.innerHTML = httpxml.responseText;

Will try getElementById instead.

EDIT: Still didn't work.
« Last Edit: June 3, 2011, 12:12:07 pm by markay_stinkay »

Offline wacko

  • Keepsh a shecret gottle of Shcotch in hish top drawer. Cunning linguist and ical genius
  • Legacy Fan
  • ******
  • Posts: 5,205
Re: RAWK Web Development Circle
« Reply #301 on: June 4, 2011, 12:02:02 am »
Having done some research, it would appear it's not the Ajax that's the issue, as IE7+ now uses XMLHttpRequest.

Looks like it is the way I'm populating my combo-box.

Code: [Select]
document.searchLog.widgetid.innerHTML = httpxml.responseText;

Will try getElementById

EDIT: Still didn't work.

Well that's pretty obvious given that the XMLHttpRequest() is always called  :wave

Have you tried getElementById, document.createElement and elem.appendChild?
Quidquid latine dictum sit, altum sonatur.

Offline markay_stinkay

  • Legacy Fan
  • ******
  • Posts: 10,864
  • ☆☆☆☆☆☆
    • Bet £50, get £50 free
Re: RAWK Web Development Circle
« Reply #302 on: June 5, 2011, 02:56:06 pm »
No, will have a go at them in the morning!

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #303 on: June 22, 2011, 10:08:34 pm »
Divs and CSS make me want to cry.

Having said that, I imagine (well, I know) if I openly broadcasted that, until now, I'd used tables for layout I'd get lynched. It's a fucking nightmare though - things that were so easy to do with tables are impossible with divs. Stupid cunting things.

I'm just trying to create a basic layout, but I think the idea is flawed from the start. Most of the problems (in my head, anyway) are coming from the fact that I want a footer. There isn't a great deal of content, the page never needs to scroll, so I want each page rounded off with a nice footer at the bottom. However, it's fucking impossible! In an ideal world, this is how it goes:

Header (10%)
Navigation (5%)
Content (80%)
Footer(5%)

The content is vertically aligned so, irrespective of amount, it's always in the middle.

Why is that so much to ask?

Offline ♠Dirty Harry♠

  • Michael Pain the tittie-fixated inflatable doll salesman
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 19,031
Re: RAWK Web Development Circle
« Reply #304 on: June 22, 2011, 10:31:17 pm »
Divs and CSS make me want to cry.

Having said that, I imagine (well, I know) if I openly broadcasted that, until now, I'd used tables for layout I'd get lynched. It's a fucking nightmare though - things that were so easy to do with tables are impossible with divs. Stupid cunting things.

I'm just trying to create a basic layout, but I think the idea is flawed from the start. Most of the problems (in my head, anyway) are coming from the fact that I want a footer. There isn't a great deal of content, the page never needs to scroll, so I want each page rounded off with a nice footer at the bottom. However, it's fucking impossible! In an ideal world, this is how it goes:

Header (10%)
Navigation (5%)
Content (80%)
Footer(5%)

The content is vertically aligned so, irrespective of amount, it's always in the middle.

Why is that so much to ask?

In the middle - Left to Right? Or In the Middle - Top to Bottom?

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #305 on: June 22, 2011, 10:34:34 pm »
Top to bottom. Why is it so much to ask? WHY?!

Offline ♠Dirty Harry♠

  • Michael Pain the tittie-fixated inflatable doll salesman
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 19,031
Re: RAWK Web Development Circle
« Reply #306 on: June 22, 2011, 10:55:47 pm »
Top to bottom. Why is it so much to ask? WHY?!

So is it a set height?


For example 600px? And if I have a 800px high monitor it'll have 100px gap top and bottom? Or if I have a 1200px high monitor it'll have 300px gap top and bottom?

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #307 on: June 22, 2011, 11:03:51 pm »
This is part of the thought process I'm going through now. The idea is that the header is at the top and the footer is at the bottom, with the variant amount coming between those elements and the content. No idea how this will come out, but I'll try...

HEADER (this is at the top)
     V (this is blank - should be bigger on higher resolution monitors)
CONTENT
     V (this is blank - should be bigger on higher resolution monitors)
FOOTER (this is at the bottom)

I'm sorry I can't be more helpful than that :-\ - the V is supposed to represent a downwards pointing arrow...

So, back to the height question - I'm not sure. I'm told everything should be done in percentages (or ems) to retain scale when minimizing/using a smaller monitor - but it seems even more impossible that way!

The problem with having a fixed content area is that some pages may only say a few words, others will have a table of data and instructions on how to read that data. Those that have more data should be surrounded by less white and not affet the position of the footer, which should always be at the bottom.

I know I'm explaining this terribly...

Offline ♠Dirty Harry♠

  • Michael Pain the tittie-fixated inflatable doll salesman
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 19,031
Re: RAWK Web Development Circle
« Reply #308 on: June 22, 2011, 11:22:45 pm »
How about something like this?



<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>

<style>

*{
    margin: 0px;
    padding: 0px;
    }
   
html, body{
    height: 100%;
    margin: 0;
    padding: 0;
    }
</style>

</head>

<body style="width: 100%;">

<div id="header" style="background: #c00; height:20%;  min-height:50px; width: 100%;">This is a header</div>

<div class="spacer" style="height:10%; min-height:10%; width: 100%;"></div>

<div id="main-content" style="background: #c00; height:40%; min-height:200px; width: 100%;">This is the main content</div>

<div class="spacer" style="height:10%; min-height:10%; width: 100%;"></div>

<div id="footer" style="background: #c00; height:20%; min-height:50px; width: 100%;">This is a footer</div>

</body>
</html>
« Last Edit: June 22, 2011, 11:26:06 pm by ♠Dirty Harry♠ »

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #309 on: June 22, 2011, 11:49:59 pm »
Ahh, that's something I tried to get the hang of earlier - the idea of a spacer. I couldn't get it to work though. I think it's the idea of a variable sized content area that's been causing me most trouble. The original idea was that, if there was only 1 line of text in the content area, that's how big it would be, with it aligned in the middle of the header and footer with the rest white. It seems to be far too much of a pain, though, so I think I'll just have a fixed-height content area (as in your example).

One problem I think I may encounter is with min-height. Sadly, the solution I'm producing is to be used from within the organisation's intranet, and their standard browser is IE6, which doesn't support the attribute.

I've got it working as such:

Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>CSS Test</title>
<style>
html, body {
   height:100%;
   margin:0;
   padding:0;
}

body {
   text-align:center;
}

#outlinefindmid {
   height:50%;
   width:1px;
   margin-bottom:-300px; /* half the wrappers height */
   float:left;
}

#header{
   margin:0 auto; /* use if centering horizontally  */
   text-align:left; /* set text back to default if centering horizontally  */
   position:relative;
   height:50px;
   width:850px;
   clear:left;
   border: 0px solid red;
   background-color: blue;
}

#content{
   margin:0 auto; /* use if centering horizontally  */
   text-align:left; /* set text back to default if centering horizontally  */
   position:relative;
   height:500px;
   width:850px;
   clear:left;
   border: 0px solid red;
   background-color:yellow;
}

#contentfindmid {
   height:50%;
   width:1px;
   margin-bottom:-200px; /* half the wrappers height */
   float:left;
}

#innercontent{
   margin:0 auto; /* use if centering horizontally  */
   text-align:left; /* set text back to default if centering horizontally  */
   position:relative;
   height:400px;
   width:850px;
   clear:left;
   border: 2px solid red;
   background-color:white;
}

#inndercontentfindmid {
   height:50%;
   width:1px;
   margin-bottom:-200px; /* half the wrappers height */
   float:left;
}

#footer{
   margin:0 auto; /* use if centering horizontally  */
   text-align:left; /* set text back to default if centering horizontally  */
   position:relative;
   height:50px;
   width:850px;
   clear:left;
   border: 0px solid red;
   background-color: blue;
}
</style>
</head>
<body>
<div id="outlinefindmid"></div>
<div id="header">
    HEADER
</div>
<div id="content">
<div id="contentfindmid"></div>
<div id="innercontent">
<h1>CONTENT</h1>
<p>This is an example of content. This is an example of content. This is an example of content. This is an example of content. This is an example of content. This is an example of content. This is an example of content. This is an example of content. This is an example of content. This is an example of content.This is an example of content.This is an example of content.This is an example of content.This is an example of content.</p>
<p>CONTENT</p>
<p>CONTENT</p>
<p>CONTENT</p>
<p>CONTENT</p>
</div>
</div>
<div id="footer">
    FOOTER
</div>
</div>
</body>

</html>

I think what I'm going to do, though, is have another div within the content one, so I can align it vertically. Take the border off the current content div and apply it to the new one, which won't have the height set. Hopefully, then, the content will always be dead middle and will only be surrounded by a relevantly sized border.

No idea if it's going to work.

Edit: Ha, that was a resounding no.
« Last Edit: June 23, 2011, 12:02:59 am by AJ »

Offline ♠Dirty Harry♠

  • Michael Pain the tittie-fixated inflatable doll salesman
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 19,031
Re: RAWK Web Development Circle
« Reply #310 on: June 23, 2011, 12:08:51 am »
Ahh, that's something I tried to get the hang of earlier - the idea of a spacer. I couldn't get it to work though. I think it's the idea of a variable sized content area that's been causing me most trouble. The original idea was that, if there was only 1 line of text in the content area, that's how big it would be, with it aligned in the middle of the header and footer with the rest white. It seems to be far too much of a pain, though, so I think I'll just have a fixed-height content area (as in your example).

One problem I think I may encounter is with min-height. Sadly, the solution I'm producing is to be used from within the organisation's intranet, and their standard browser is IE6, which doesn't support the attribute.

I've got it working as such:

Code: [Select]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>CSS Test</title>
<style>
html, body {
   height:100%;
   margin:0;
   padding:0;
}

body {
   text-align:center;
}

#outlinefindmid {
   height:50%;
   width:1px;
   margin-bottom:-300px; /* half the wrappers height */
   float:left;
}

#header{
   margin:0 auto; /* use if centering horizontally  */
   text-align:left; /* set text back to default if centering horizontally  */
   position:relative;
   height:50px;
   width:850px;
   clear:left;
   border: 0px solid red;
   background-color: blue;
}

#content{
   margin:0 auto; /* use if centering horizontally  */
   text-align:left; /* set text back to default if centering horizontally  */
   position:relative;
   height:500px;
   width:850px;
   clear:left;
   border: 0px solid red;
   background-color:yellow;
}

#contentfindmid {
   height:50%;
   width:1px;
   margin-bottom:-200px; /* half the wrappers height */
   float:left;
}

#innercontent{
   margin:0 auto; /* use if centering horizontally  */
   text-align:left; /* set text back to default if centering horizontally  */
   position:relative;
   height:400px;
   width:850px;
   clear:left;
   border: 2px solid red;
   background-color:white;
}

#inndercontentfindmid {
   height:50%;
   width:1px;
   margin-bottom:-200px; /* half the wrappers height */
   float:left;
}

#footer{
   margin:0 auto; /* use if centering horizontally  */
   text-align:left; /* set text back to default if centering horizontally  */
   position:relative;
   height:50px;
   width:850px;
   clear:left;
   border: 0px solid red;
   background-color: blue;
}
</style>
</head>
<body>
<div id="outlinefindmid"></div>
<div id="header">
    HEADER
</div>
<div id="content">
<div id="contentfindmid"></div>
<div id="innercontent">
<h1>CONTENT</h1>
<p>This is an example of content. This is an example of content. This is an example of content. This is an example of content. This is an example of content. This is an example of content. This is an example of content. This is an example of content. This is an example of content. This is an example of content.This is an example of content.This is an example of content.This is an example of content.This is an example of content.</p>
<p>CONTENT</p>
<p>CONTENT</p>
<p>CONTENT</p>
<p>CONTENT</p>
</div>
</div>
<div id="footer">
    FOOTER
</div>
</div>
</body>

</html>

I think what I'm going to do, though, is have another div within the content one, so I can align it vertically. Take the border off the current content div and apply it to the new one, which won't have the height set. Hopefully, then, the content will always be dead middle and will only be surrounded by a relevantly sized border.

No idea if it's going to work.


Yeah but the min-height isn't really an important factor though as long s the areas have content within them, I just threw min-height in there as another option

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #311 on: June 23, 2011, 12:38:39 am »
Oh helllooooo!

This is almost exactly as I want it:


 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<title>CSS Test</title>
<style type="text/css">
html, body {
   height:100%;
   margin:0;
   padding:0;
}

body {
   text-align:center;
}

#outlinefindmid {
   height:50%;
   width:1px;
   margin-bottom:-300px; /* half the wrappers height */
   float:left;
}

#header{
   margin:0 auto; /* use if centering horizontally  */
   text-align:left; /* set text back to default if centering horizontally  */
   position:relative;
   height:50px;
   width:850px;
   clear:left;
   border: 0px solid red;
   background-color: blue;
}

#nav{
   margin:0 auto; /* use if centering horizontally  */
   text-align:left; /* set text back to default if centering horizontally  */
   position:relative;
   height:25px;
   width:850px;
   clear:left;
   border: 0px solid red;
   background-color: green;
}

#content{
   margin:0 auto; /* use if centering horizontally  */
   text-align:left; /* set text back to default if centering horizontally  */
   position:relative;
   height:500px;
   width:850px;
   clear:left;
   border: 0px solid red;
   background-color:white;
}

#contentfindmid {
   height:50%;
   width:1px;
   margin-bottom:-200px; /* half the wrappers height */
   float:left;
}

#innercontent{
   margin:0 auto; /* use if centering horizontally  */
   text-align:left; /* set text back to default if centering horizontally  */
   position:relative;
   height:400px;
   width:850px;
   clear:left;
   border: 0px solid red;
   background-color:white;
}

#innercontentfindmid {
   height:50%;
   width:1px;
   margin-bottom:-50%; /* half the wrappers height */
   float:left;
   border: 0px solid green;
}

#innercontentmain{
   margin:0 auto; /* use if centering horizontally  */
   text-align:left; /* set text back to default if centering horizontally  */
   position:relative;
   width:850px;
   clear:left;
   border: 0px solid red;
   background-color:yellow;
}

#footer{
   margin:0 auto; /* use if centering horizontally  */
   text-align:left; /* set text back to default if centering horizontally  */
   position:relative;
   height:25px;
   width:850px;
   clear:left;
   border: 0px solid red;
   background-color: blue;
}
</style>
</head>
<body>
<div id="outlinefindmid"></div>
   <div id="header">
    HEADER
   </div>
   <div id="nav">
    NAV
   </div>
   <div id="content">
   <div id="contentfindmid"></div>
      <div id="innercontent">
      <div id="innercontentfindmid"></div>
         <div id="innercontentmain">
         <h1>CONTENT</h1>
         <p>content</p>
         </div>
      </div>
   </div>
   <div id="footer">
    FOOTER
   </div>   
</body>

</html>

When you add or remove some of the content, the size of the area underneath the content is automatically modified. My ideal solution was that the content (yellow bit) would be right in the middle of the white bit, and the areas above and below the content were BOTH automatically adjusted to keep the re-sized content in the middle, however, this will certainly do (for now).

The  main problem I had was that, without the changeable white bit underneath the content, the footer moved every time the content was modified. This has solved that, which is a start! (If it doesn't work when I try it on IE6 tomorrow in work, I really will kill someone!)
« Last Edit: June 23, 2011, 08:39:20 am by AJ »

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #312 on: June 23, 2011, 01:45:05 pm »
OK, so, to conform to W3 standards, I must learn to use divs rather than tables for layout.

More urgently, I need to make this thing secure.

I'm reading about trying to protect ASP (VBScript) websites from SQL injection and I'm seeing 'stored procedures' and 'paramaterized queries' a lot - which should I use? What are the differences?

I've been sat here reading articles/tutorials/information all morning and I still can't even begin to grasp it.
« Last Edit: June 23, 2011, 01:52:48 pm by AJ »

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #313 on: June 23, 2011, 07:19:57 pm »
Shameless bump.

I spent the rest of the afternoon trying to decide which method was best and it's just not going in. If I knew which one I should be using, I could get to work on understanding/implementing it but as it is, I don't even know that, or how to find it out!

Offline WorldChampions

  • Charlie uniform november tango fan...
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 23,555
Re: RAWK Web Development Circle
« Reply #314 on: June 23, 2011, 09:14:11 pm »
Stored procedures are done at the database end.

Paramatised queries go in your actual code.

Make sure you escape input to prevent SQL injections, if using mysql then a function such as this:

http://php.net/manual/en/function.mysql-real-escape-string.php

Also use regular expressions.


I once wrote an e-commerce site using ASP.net, although C# not VB. If you need any advise feel free to PM me.
« Last Edit: June 23, 2011, 09:17:17 pm by WorldChampions »

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #315 on: June 23, 2011, 09:36:55 pm »
Stored procedures are done at the database end.
Of all the things I've read all day, that has been the most helpful!

So - I'm currently using Access - a stored procedure would be a query created in Access that I would call from the code? Is that right? That would explain why I couldn't see within the code example I found how it worked.

So what makes that more secure than just parameterizing the query? From what I've read, assigning the value of the input to a parameter and then inputting that parameter to the SQL query makes the whole contents of the parameter part of the string, so whatever is in there can't exit the query....or something. I'm a complete novice so I may well have no idea what I'm talking about.

Offline WorldChampions

  • Charlie uniform november tango fan...
  • RAWK Supporter
  • Legacy Fan
  • ******
  • Posts: 23,555
Re: RAWK Web Development Circle
« Reply #316 on: June 23, 2011, 10:21:07 pm »
Of all the things I've read all day, that has been the most helpful!

So - I'm currently using Access - a stored procedure would be a query created in Access that I would call from the code? Is that right? That would explain why I couldn't see within the code example I found how it worked.

So what makes that more secure than just parameterizing the query? From what I've read, assigning the value of the input to a parameter and then inputting that parameter to the SQL query makes the whole contents of the parameter part of the string, so whatever is in there can't exit the query....or something. I'm a complete novice so I may well have no idea what I'm talking about.

Yeah you have to create your stored procedures using access. If your executing a stored procedure the SQL statement is set out in the database, this prevents attackers from altering the statement before sending it to the database.

For example, you have a stored procedure called 'select all'

The procedure contains the SQL query 'SELECT * FROM students;'

You call the 'select all' stored procedure from your application, the attacker has no knowledge of what the syntax of the SQL query is.

Not sure if that makes sense but it's as eloquently as I can put it after being awake for 20 hours :D Sleep time!


Heres a decent link on the subject, have a look


http://www.aspsnippets.com/Articles/Using-Parameterized-queries-to-prevent-SQL-Injection-Attacks-in-SQL-Server.aspx

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #317 on: June 23, 2011, 10:31:04 pm »
Yeah, thanks for that.

The theory of that makes sense to me, it's looking at the link that baffles me though - seeing how it's implemented without actually implementing it myself.

Furthermore, the database for my system is going to be moved from Access to Oracle in the near future - what effect will that have on any stored procedure/parameterized query method of securing the system?

Offline Azi

  • eckerslike
  • Legacy Fan
  • ******
  • Posts: 4,715
  • We all Live in a Red and White Kop
Re: RAWK Web Development Circle
« Reply #318 on: June 23, 2011, 10:32:53 pm »
am i being too simple minded in thinking you could create it all on vb ?

Offline AJ

  • a.k.a. Billy Two-Threads. Property of RAWK – soon to be raffled - has as much chance of becoming a mod as David Moyes
  • Legacy Fan
  • ******
  • Posts: 10,075
Re: RAWK Web Development Circle
« Reply #319 on: June 23, 2011, 10:35:27 pm »
Would it pain you if I said I have no idea what you mean by that?