Jump to content
Old threads will finally start getting archived ×

bionic25

Members
  • Posts

    36
  • Joined

  • Last visited

    Never

Everything posted by bionic25

  1. Hi, I've been into web design for a while now but I have a problem that I need to fix. I'm self taught so have some odd gaps in my knowledge, and this one has plagued me for some time: i want set a background that is only applied to the centred content. To do this I'm trying to use a bg url under the "content" div. The problem is, despite content being a parent of the left hand column (which sets the minimum height of the page) and containing all the other object DIVs, the content background wont stretch to the full height to be a bg for all of the content. Please note, this works fine in IE. A FF bug only. Here's the code, Using colors to illustrate point: grey should fill the area between the header and footer but doesnt in ff. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/2002/REC-xhtml1-20020801/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN"> <head> <title>CSS Problem</title> <style type="text/css"> /* Gen/Def Rules */ body {font-family: arial;} a {text-decoration: none;} /* Objects */ #wrapper {width: 800px; margin: 0 auto;} #content {width: 100%; /*HERES THE PROBLEM */ background: #e3e3e3; height: auto;} #header {width: 100%; height: 100px;} #left {width: 150px; float: left; height: 500px;} #mid {width: 400px; float: left;} /* HEIGHT OF PAGE FIXED BY NAV COLUMN */ #right {width: 250px; float: left;} #footer {width: 100%; float: left; height: 75px;} /* Classes */ .red {background: red;} .green {background: green;} .blue {background: blue;} .yellow {background: yellow;} .brown {background: brown;} </style> <body> <div id="wrapper"> <div id="content"> <div id="header" class="brown">header </div> <div id="left" class="red">left </div> <div id="mid" class="green">middle </div> <div id="right" class="blue">right </div> </div> <div id="footer" class="yellow">footer </div> </div> </body> </html> I know there are javascript solutions to equal column heights and some other tricky workarounds, but I like simplicity and want to solve it pure css. Can anyone help me please?? Thanks in advance ~Bionic25
  2. I'm new to javascript. I found this code for breadcrumbs that i like and need help in changing it to add a space before a capital. Why? The directories on my site are called thing like root/MyFirstDir/MySecondDir/etc... I want the breadcrumb trail to then display it like root > My First Dir > My Second Dir > etc... Here's my code: Code: function breadcrumbs() { sURL = new String; bits = new Object; var x = 0; var stop = 0; var output = "<div class=topnav><a href=/>Home</a> > "; sURL = location.href; sURL = sURL.slice(8,sURL.length); chunkStart = sURL.indexOf("/"); sURL = sURL.slice(chunkStart+1,sURL.length) while(!stop){ chunkStart = sURL.indexOf("/"); if (chunkStart != -1){ bits[x] = sURL.slice(0,chunkStart) sURL = sURL.slice(chunkStart+1,sURL.length); } else { stop = 1; } x++; } for(var i in bits){ output += "<a href=\""; for(y=1;y<x-i;y++){ output += "../"; } output += bits[i] + "/\">" + bits[i] + "</a> > "; } document.write(output + document.title); document.write("</div>"); } if anyone could give me the code / advise me / whatever, I would be most obliged. Thanks ~Bionic_25
  3. Thanks for reply. I changed the case but still no luck... By the way that form double up was just a copy/paste typo Any other ideas? It's not outputting anything, not even the form?!?!
  4. I'm having difficulties creating a self-containing .php page which has drop downs for price ranges eg £0 < £1000, £1000 < £2000 etc. I then want it to query a mysql database called "cars" and field "price" and then display the results. code so far: <form action=\"<?php $_SERVER['PHP_SELF'] ?>\" method=\"post\"> Lowest price:<input type=\"text\" name=\"low\"> Highest price:<input type=\"text" name=\"high\"> <input type=\"submit\" value=\"submit\" action=\"submit\"> </form> <?php if (isset($_POST['Submit'])) { mysql_connect("***", "***", "***") or die(mysql_error()); mysql_select_db("***") or die(mysql_error()); $low = $_POST['low']; $high = $_POST['high']; $result = mysql_query("select * from cars WHERE price BETWEEN $low and $high"); while($r=mysql_fetch_array($result)) { $carName=$r["carName"]; $description=$r["description"]; echo " $carName $description "; } } else { echo" <form action=\"<?php $_SERVER['PHP_SELF'] ?>\" method=\"post\"> <input type=\"text\" name=\"low\">Lowest price: <input type=\"text" name=\"high\">Highest price: <input type=\"submit\" value=\"submit\" action=\"submit\"> </form> "; ?> This just doesn't work at all. Anyone know where I'm going wrong? (this is one of the first scripts I've written from scratch) Thanks, ~bionic25
  5. if(file_exists("/***/***/****/*/*/******/public_html/******/images/thumbs/$username.jpg")) { echo "<img src=\"..newCar/images/thumbs/$username.jpg\">"; } else{ echo "no image"; } Right, tried that ^^ but now the entire page isn't working!! I tried removing this section and it worked again?! What is wrong with this code it is confusing the hell out of me, but im sure its a code error (newbie php'er)
  6. Thanks for the posts they are both solutions. I tried the file_exist one, which seems to fit exactly what I need. this is the new code: if(file_exists("..newCar/thumbs/$username.jpg")) { echo "<img src=\"..newCar/thumbs/$username.jpg\">; } else{ echo "no image"; } problem is, for some reason, when i tested it it will only output "no image" even though the file DEFINITELY exists?! Im new to php so may be problem in code, any ideas??
  7. On an auction listing page im making the user who has uploaded their listings' info can also upload a photo. on the page "listing.php?&id=***" their listing is auto-generated from mysql. part of this auto generated info is an image. As a user can only upload one photo, and their user ID is unique, the html to display this message is: ../images/thumbs/$username.jpg Problem: If they chose not to upload a photo with the listing that ugly broken image symbol is displayed. How can i hide this or have an auto ____________________ | | | NO | | IMAGE | | UPLOADED | | | |___________________|.jpg type file that is default outputed. Thanks for any answers ~bionic25
  8. Thanks for the replies. I was only mentioning longblob as I was saying this WASN'T the way i wanted to do it and indeed am not. "bigPic" is VARCHAR, I'm just having troubles getting the right value into the bigPic field.
  9. I have a script that allows logged in users to create a listing on the auction site I am developing. I have no problem with this and am using $_GET and "?&id=" etc. to generate individual listing pages. I want users to be able to upload images for their listing too. I plan to store the images in a directory /images/. I have a field in the listings database for bigPic and smallPic where I hope to put a link to the listing's image so when displaying the listing it will have info then just a simple <img src="$bigPic" /> type thing. I have an image upload script (credits go to "Mohamed Ahmed") <!doctype html public "-//w3c//dtd html 4.01 transitional//en"> <html> <head> <title> .: Maaking.Com :. Upload and Resize Images</title> <?php //load the config file include("config.php"); //if the for has submittedd if (isset($_POST['upForm'])){ $file_type = $_FILES['imgfile']['type']; $file_name = $_FILES['imgfile']['name']; $file_size = $_FILES['imgfile']['size']; $file_tmp = $_FILES['imgfile']['tmp_name']; //check if you have selected a file. if(!is_uploaded_file($file_tmp)){ echo "Error: Please select a file to upload!. <br>--<a href=\"$_SERVER[php_SELF]\">back</a>"; exit(); //exit the script and don't do anything else. } //check file extension $ext = strrchr($file_name,'.'); $ext = strtolower($ext); if (($extlimit == "yes") && (!in_array($ext,$limitedext))) { echo "Wrong file extension. <br>--<a href=\"$_SERVER[php_SELF]\">back</a>"; exit(); } //get the file extension. $getExt = explode ('.', $file_name); $file_ext = $getExt[count($getExt)-1]; //create a random file name $rand_name = md5(time()); $rand_name= rand(0,999999999); //get the new width variable. $ThumbWidth = $img_thumb_width; //keep image type if($file_size){ if($file_type == "image/pjpeg" || $file_type == "image/jpeg"){ $new_img = imagecreatefromjpeg($file_tmp); }elseif($file_type == "image/x-png" || $file_type == "image/png"){ $new_img = imagecreatefrompng($file_tmp); }elseif($file_type == "image/gif"){ $new_img = imagecreatefromgif($file_tmp); } //list width and height and keep height ratio. list($width, $height) = getimagesize($file_tmp); $imgratio=$width/$height; if ($imgratio>1){ $newwidth = $ThumbWidth; $newheight = $ThumbWidth/$imgratio; }else{ $newheight = $ThumbWidth; $newwidth = $ThumbWidth*$imgratio; } //function for resize image. if (function_exists(imagecreatetruecolor)){ $resized_img = imagecreatetruecolor($newwidth,$newheight); }else{ die("Error: Please make sure you have GD library ver 2+"); } imagecopyresized($resized_img, $new_img, 0, 0, 0, 0, $newwidth, $newheight, $width, $height); //save image ImageJpeg ($resized_img,"$path_thumbs/$rand_name.$file_ext"); ImageDestroy ($resized_img); ImageDestroy ($new_img); //print message echo "<br>Image Thumb: <a href=\"$path_thumbs/$rand_name.$file_ext\">$path_thumbs/$rand_name.$file_ext</a>"; } //upload the big image move_uploaded_file ($file_tmp, "$path_big/$rand_name.$file_ext"); echo "<br>Image Big: <a href=\"$path_big/$rand_name.$file_ext\">$path_big/$rand_name.$file_ext</a>"; echo "<br><br>--<a href=\"$_SERVER[php_SELF]\">back</a>"; }else{ //if the form hasn't been submitted. //print the form echo "<script> function view_img(img_name){ document[img_name].src = upForm.imgfile.value; document[img_name].width = 150; } </script>\n\n <br><h3>:: Browse an Image to Upload:</h3>\n <form method=\"post\" name=\"upForm\" enctype=\"multipart/form-data\" action=\"$_SERVER[php_SELF]\">\n <input type=\"file\" name=\"imgfile\" onchange=\"javascript:view_img('img_vv');\"> <img src='' name='img_vv' width='0'><br>\n Image width will resize to <b>$img_thumb_width</b> with height ratio. <br><input type=\"Submit\" name=\"upForm\" value=\"Upload & Resize\">\n </form> <a href=\"view_gallery.php\">View Images</a>"; } ?> MY PROBLEM: integrating this into my database is confusing the hell out of me, and using LONGBLOB seems a bad way to go about things... Any help is much appreciated, and make it as simple as possible please as I am very new to PHP! Thanks Bionic25
  10. Thanks, that did indeed help. Turns out the problem was i didn't know about the whole $_GET thing. Managed to make a script that works fine now
  11. Hi, I'm new to PHP. I'm trying to create a site where people can add listings. I've managed to successfully script the php form they need to add info to a database called "listings". each "listing" row has a unique ID. I know how to query the databse and return results. My problem is this: I can't manually set up a new php page for every listing, so i need some way of having page like ../listings/default.php where the page template is stored and when an ID (relating to that unique ID in the listings database) is added to the URL in some way the default.php page automatically displays the "listing" info within the template. I know I should have figured this out but after hours of fruitless googling for an answer I felt I really needed to post! Thanks in advance for any answers! -Bionic25
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.