Jump to content

afish674

Members
  • Posts

    148
  • Joined

  • Last visited

Everything posted by afish674

  1. Hi Ingolme, Tried this and it doesn't seem to make much difference. I think its something to do with the Bootstrap framework CSS but I need to overwrite it. link: http://www.pontus-web.co.uk I added the class "nocrush" and gave it a min-width of 100%, I also tried min-width 1170px (the size of the largest outer container). I just want it to scroll rather than the menu and gradient bar under the header breaking when the window shrinks, and to stop the sidebar popping under the main content div.
  2. I've been using a Wordpress barebones template to create my own. However it has some CSS that is breaking my layout on resizing the window (and on small screens like phones). I'd rather have it so that it adds scrollbars when the content won't fit in the window, so it at least works until I can configure it properly. When you resize the window the sidebar div goes below the main content div. The main content div then gets cut off because of its fixed width and the overflow property. I'm not sure where this is defined in the CSS or how to override it. Any suggestions? Link: http://pontus-web.co.uk/ Thanks!
  3. Try: body{padding:0px;margin:0px;}
  4. The HTML code includes: <section class="homebackground"> <img src="img/image1.jpg" /> <img src="img/image2.jpg" /> <img src="img/image3.jpg" /> <img src="img/image4.jpg" /> </section> This does apply .homepage to the container rather than the images.
  5. Cheers dsonesuk, that worked perfectly!
  6. In the Wordpress template i'm developing a class is returned dependent on the existance of a sidebar like so: <div id="main" class="<?php echo roots_main_class();?> round-corners wborder" role="main"> <?php include roots_template_path(); ?> </div> However, although this class is picked up in Firebug on the left, on the right panel it is not detected, meaning any rules applied to it are not working. Any idea why is this happening? Picture of problem in firebug (the class I want to style to 100% width is called "no-side") Thanks!
  7. You could also try using the jQuery UI for styling buttons. You can make them look pretty swish! http://jqueryui.com/button/
  8. afish674

    Web Speed Help

    Have you optimised all of your images for web? If you're using photoshop open up your images then file > save for web and devices and change the quality down. Make sure they're jpegs or gifs and use the lowest quality you can get away with without making it pixelated. Save, then upload them again.
  9. I'm reading a magazine article about creating a dynamically resizing background image slideshow. This uses CSS initially: .homebackground{z-index:-200;overflow:hidden;min-height:1080px;min-width:1920px;width:100%;height:auto;}.homebackground img{position:absolute;width:100%;height:auto;} and then in case the browser and image aspect ratios are different, it uses some jQuery: function bgresize(){var viewportwidth = $(window).width();var viewportheight = $(window).height();var imagewidth = $('.home').find('.homebackground img').first().width();var imageheight = $('.home').find('.homebackground img').first().height();var imageratio = imagewidth/imageheightif (viewportheight > imageheight) {$('.home').find('.homebackground img').css('width',viewportheight*imageratio).css('height', 'auto');}if (viewportwidth > imagewidth ) {$('.home').find('.homebackground img').css('width', viewportwidth).css('height', 'auto');}if (viewportheight < imageheight) {$('.home').find('.homebackground img').css('height', viewportwidth/imageratio).css('width', 'auto');}if (viewportwidth < imagewidth ) {$('.home').find('.homebackground img').css('height', viewportheight).css('width', 'auto');}}$(window).load(function(){$(window).resize(function(){ bgresize();}); bgresize();}); My demo page using this can be found here: https://dl.dropbox.com/u/13032629/HTML-Flash-Lesson/index.html It doesn't work properly however. The page does rescale, but it has scroll bars on a smaller screen, and even on my large monitor at the native resolution (1920x1080) it scrolls. The magazine indicates that the overflow:hidden; property should stop the scroll bars on a smaller screen. This doesn't happen. Infact taking this rule out makes no difference at all. I'm also unsure as to whether the javascript is doing anything. I put some console.log(); commands in to check the variables were collecting data (they were) but it doesn't seem to make any difference to the image. I don't know if this is to do with my function call being in the main.js file rather than in the HTML file, or if this makes any difference at all? Help much appreciated. Thank you!
  10. //DATABASE CONNECTIONtry{ $pdo = new PDO("mysql:dbname=birthdays; host=localhost","root","Rockon!");}catch (PDOException $e){ die ("ERROR: Could not connect: " . $e->getMessage());}$getBdayInfo = "SELECT first_name, second_name, day, month, note FROM birthdays WHERE month = '$monthName' AND username = '$_SESSION[user]'";$result = $pdo->query($getBdayInfo);$row = $result->fetchAll();if ($row > 1){foreach($row as $r){ echo "'$r'"; }}//END QUERY AND CONNECTIONunset($pdo); I think this code should return a list of First Name Second Name Day Month Note For the logged in user in the current month, I inserted this above the code block I posted above. I don't get any parse errors when opening this page but I don't get a list either. Also this list wouldn't publish the information in the right calender box. I'd need to test the day against the current day and then insert the data in the right box using that somehow. I'm just not exactly sure how.
  11. Sorry, the code is: <?phpfunction build_calendar($month,$year) {$today_date = date("d");$today_date = ltrim($today_date, '0'); // Create array containing abbreviations of days of week. $daysOfWeek = array('S','M','T','W','T','F','S'); // What is the first day of the month in question? $firstDayOfMonth = mktime(0,0,0,$month,1,$year); // How many days does this month contain? $numberDays = date('t',$firstDayOfMonth); // Retrieve some information about the first day of the // month in question. $dateComponents = getdate($firstDayOfMonth); // What is the name of the month in question? $monthName = $dateComponents['month']; // What is the index value (0-6) of the first day of the // month in question. $dayOfWeek = $dateComponents['wday']; // Create the table tag opener and day headers $calendar = "<table class='calendar'>"; $calendar .= "<caption>$monthName $year</caption>"; $calendar .= "<tr>"; // Create the calendar headers foreach($daysOfWeek as $day) { $calendar .= "<th class='header'>$day</th>"; } // Create the rest of the calendar // Initiate the day counter, starting with the 1st. $currentDay = 1; $calendar .= "</tr><tr>"; // The variable $dayOfWeek is used to // ensure that the calendar // display consists of exactly 7 columns. if ($dayOfWeek > 0) { $calendar .= "<td colspan='$dayOfWeek'> </td>"; } $month = str_pad($month, 2, "0", STR_PAD_LEFT); while ($currentDay <= $numberDays) { // Seventh column (Saturday) reached. Start a new row. if ($dayOfWeek == 7) { $dayOfWeek = 0; $calendar .= "</tr><tr>"; } $currentDayRel = str_pad($currentDay, 2, "0", STR_PAD_LEFT); $date = "$year-$month-$currentDayRel"; if($currentDayRel == $today_date ){ $calendar .= "<td class='day' id='today_date' rel='$date'><b>$currentDay</b></td>"; } else { $calendar .= "<td class='day' rel='$date'>$currentDay</td>"; } // Increment counters $currentDay++; $dayOfWeek++; } // Complete the row of the last week in month, if necessary if ($dayOfWeek != 7) { $remainingDays = 7 - $dayOfWeek; $calendar .= "<td colspan='$remainingDays'> </td>"; } $calendar .= "</tr>"; $calendar .= "</table>"; return $calendar;}?> Would I need to enter code somewhere around here? $currentDayRel = str_pad($currentDay, 2, "0", STR_PAD_LEFT); $date = "$year-$month-$currentDayRel"; if($currentDayRel == $today_date ){ $calendar .= "<td class='day' id='today_date' rel='$date'><b>$currentDay</b></td>"; } else { $calendar .= "<td class='day' rel='$date'>$currentDay</td>"; } I'm struggling a bit to follow some of the code as I'm quite new to PHP.
  12. I found out the problem with this eventually. The form re-directs to a different page for processing (form action="submitted.php") before it got to the code defining the exception. Therefore it was bypassing it. After I changed the form to process using the same page the exceptions worked fine! Thanks for your help in troubleshooting.
  13. I'm using a calender from CSS tricks: http://css-tricks.com/snippets/php/build-a-calendar-table/#comment-73575 What I want to do is use this as a base and then do some database queries to input data into the relevent cells about events. The data I have in my database includes day and month. I'm just not sure what code should be added and where in order to get the database entries to appear in the right place! Thanks for any help you can give!
  14. I tried this and it said that it couldn't do it because my headers were already set?
  15. I want to put within my form logic a way of loading up a new page (i.e. login area) when my login form is submitted. I wondered what is the best way to do this? I read on another forum that this can be achieved by: $url = 'thepageyouwanttogoto.html'; echo '<META HTTP-EQUIV=Refresh CONTENT="0; URL='.$url.'">'; But I seem to remember from doing some JavaScript a while back that this is not a good way of re-directing and is penalised by Google (because you could trick users onto other domains unwittingly).
  16. Do you mean applying CSS:Block to the anchor element as it was would validate correctly? I took the div elements out of the anchor element to fix it, as I'm not too fussed about the pin images not being part of the link, I'm just curious for future reference. Cheers!
  17. Hi Ingolme, Thanks for bringing up the fact you can render the older IE's within 9. Thats VERY useful! I corrected the nested list elements, although it didn't fix anything, I couldn't find where you referred to a div inside an a, what was the element called? I found that the source of my problems was the fact the document was HTML5. I used the HTML5 boiler plate (http://html5boilerplate.com/) as a template for my code but when I uploaded it to the server I neglected to also upload the modernizr JS file and update the link in my document. Subsequently anything contained in an HTML5 element broke in IE7/8 because of the lack of support for HTML5 tags. I changed my doctype and updated the elements, this fixed the problem. There are however still a few of things that I don't understand. The 2 validation errors that remain. Why the main menu doesn't display on one line. The "Jam of the month" renders with less margin or padding in IE7
  18. I've just been using http://netrenderer.com/index.php to preview my site in IE 7&8 and it looks a mess! I'm lost as to how to get it to render things in the correct places, any help as to what the issues are and how to solve them massively appreciated! http://lovespreading.co.uk - Renders fine in IE9, Firefox & Chrome.
  19. Thanks for your replies. This makes my $result variable return the SQL statement rather than false, which is a step in the right direction. But I want it to be the result of the query, so then I can test this against the form input username in the next conditional statement. How would I do this? I thought that$chkUsr = "SELECT COUNT(*) FROM login WHERE username='$username'";$result = $pdo->query($chkUsr); I thought that $result should now contain the result of "$pdo->query($chkUsr)" ? Use this instead of the error messages I'm using at the moment? Ideally later on I'm going to remove the die() statements and use some better error reporting that won't terminate the script, Just using them as placeholders at the moment. In cases where I genuinly don't know whats happened then I'll deffo use this. Thanks.
  20. i'm trying to compare a user inputted username to one already in my database so I can see if the name is taken. I don't understand why my query isn't working or understand why $pdo->query($chkUsr); returns either false or the query string itself when it should display the RESULT of the query? <?php} else{$username = $_POST['username'];$password = $_POST['password']; if (empty($username)){ die ('ERROR: Please enter your username!'); }if (empty($password)){ die('ERROR: Please enter your password!');} $username = makeSafe($username); try{ $pdo = new PDO("mysql:dbname=birthdays; host=localhost","root","mypassword!");}catch (PDOException $e){ die ("ERROR: Could not connect: " . $e->getMessage());} $chkUsr = "SELECT COUNT(*) FROM login WHERE username=$username";$result = $pdo->query($chkUsr);var_dump($result);if($pdo->query($chkUsr) = $username){ die('ERROR: This username is already taken!');}unset($pdo);}?>
  21. Hi Ingolme, yes this is correct. It proceeds to the next page and displays the output: " 's birthday on has been added to your reminders. "
  22. Apologies, was that a better explanation?
  23. I'm trying to create exceptions that trigger when specific fields are left blank (fName, sName & date). According to the book i'm following, something like the following should achieve this: class EmptyField extends Exception{ }$fName = $_POST['fName'];$sName = $_POST['sName'];$date = $_POST['date'];$note = $_POST['note'];try{ if (empty($fName)){ throw new EmptyField("First name!"); } if(empty($sName)){ throw new EmptyField("Second name!"); } if (empty($date)){ throw new EmptyField("Birthday!"); }}catch (EmptyField $e){ echo"<div class=\"ui-state-error\"><p>Please enter a ". $e->getMessage()."</p></div>"; exit(); I want it so that when the form is submitted, if any of these fields are left blank, it throws the exception and creates an error div underneath the field in question. Currently using the above code (my first post), when the form is submitted it just proceeds to the echo statement at the bottom, if you don't fill in the fields it just uses blanks in the variables. If you do fill in the fields, it works as intended.
×
×
  • Create New...