Jump to content

dsonesuk

Members
  • Posts

    11,220
  • Joined

  • Last visited

  • Days Won

    117

Everything posted by dsonesuk

  1. No! but expected the example to at least relate to what the op asked for! for targeting many not singular divs.
  2. for the speed to be constant, not speed up and slow at end you would use "linear" after duration $('.'+tag)[effect](0,function(){ $(this).animate({'margin-left': '+='+left ,'margin-top': '+='+top , 'width': '+='+width ,'height': '+='+height}, +speed, 'linear'); });
  3. Ah! but what happens when you click one of the other MANY div elements? the status has change (true) for previous clicked div... you have to click it twice! once will return status to false (height: 0;) then again to set it to true (height 300px). Also! setting height to 0, will make div disappear one at a time, height='1em' will at least let you click some part of the div.
  4. normally jquery is written as $(document).ready(function(){ }); but sometimes using $, causes a conflict with other scripts (mootools is one), so jQuery.noConflict(); was created, you now replace $ with jQuery jQuery.noConflict(); jQuery(document).ready(function(){ }); if you use without first declaring 'jQuery.noConflict();' it does not recognise it as being used in place of '$' and it gives a undefined error.
  5. In ajax instead of<a href="mypage.php?page=Bob">Bob</a>which will cause the page to reload, to retrieve the content for 'bob' from DB. Ajax uses basically the same system to retrieve content using php through a querystring xmlhttp.open("GET","mypage.php?q="+str,true); where str would equal 'bob' the difference is ajax only retrieves and returns specific data from the database to go in the main_content container, where normally the whole page is returned with <html><head><body> etc when the page reloads. <a href="#" onclick="ajaxfunction('bob');">Bob</a> which would run the ajax script send the string 'bob' to a php page, that will also search and retrieve content for 'bob' and echo out the result, this result is then return to ajax script, where you direct it to where it should be placed for example a div element with id ref 'main_content' if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("main_content").innerHTML=xmlhttp.responseText; } } this will cause instant change without the page requiring to reload.
  6. you have a link <a href="mypage.php?page=Bob">Bob</a> you have database table with field names 'name' and 'content' and values would be similar to belowname | bob |content |<p>Eu fugiat nulla pariatur. Ullamco laboris nisi ut labore et dolore magna aliqua. Sed do eiusmod tempor incididunt cupidatat non proident, lorem ipsum dolor sit amet. Duis aute irure dolor excepteur sint occaecat mollit anim id est laborum. Qui officia deserunt ut enim ad minim veniam, cupidatat non proident.</p><p>In reprehenderit in voluptate ullamco laboris nisi ut aliquip ex ea commodo consequat. Consectetur adipisicing elit, lorem ipsum dolor sit amet. In reprehenderit in voluptate sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p><p>Velit esse cillum dolore quis nostrud exercitation duis aute irure dolor. Sunt in culpa eu fugiat nulla pariatur. Mollit anim id est laborum. Consectetur adipisicing elit, cupidatat non proident, in reprehenderit in voluptate.</p><p>Ut labore et dolore magna aliqua. Sunt in culpa excepteur sint occaecat lorem ipsum dolor sit amet. Velit esse cillum dolore.</p><p>In reprehenderit in voluptate eu fugiat nulla pariatur. Duis aute irure dolor velit esse cillum dolore ut aliquip ex ea commodo consequat. Ut labore et dolore magna aliqua. Ut enim ad minim veniam, in reprehenderit in voluptate lorem ipsum dolor sit amet. Duis aute irure dolor mollit anim id est laborum.</p>|within in mypage.php page you would have $current_person=$_GET['page'];$result = mysql_query("SELECT * FROM mytable WHERE name ='$current_person'");if (!$result) {die("Query to show fields from table failed");}while ($row = mysql_fetch_assoc($result)){echo '<h2>'.$row['name'].'</h2>';echo '<div id="content">'.$row['content'].'</div>';} whatever persons name is sent with querystring 'page=Bob' with be pick up, is searched for in database table and whatever content related to that specific name ref will be shown in the while loops$row['content'].You may want to use a id ref ?page=22, as you can have many people with first name 'bob'.This same method can be used in ajax, where the above processed content is added to the main document page in a specific id container 'main_content' when recieved back from mypage.php
  7. Can't you store content for bob page in database, use ref for 'bob' to look through database for name ref, and drag all content for 'bob' and place in content returned from ajax response into ONE single page.
  8. dsonesuk

    PHP Loops

    if you use $result = mysql_query("SELECT * FROM mytable");if (!$result) {die("Query to show fields from table failed");} <table width="960" border="1" cellspacing="0" cellpadding="0"><?phpwhile($row = mysql_fetch_row($result)) { echo "<tr>"; foreach($row as $column_value) { echo '<td>'.$column_value.'</td>'; } echo '</tr>'."\n"; } ?></table> will loop through rows with while loop applying the starting <tr>, and then foreach will loop through ALL the fields within a row, applying within <td>, and when the foreach loop has finished, it applies the finishing </tr> closing tag. If you want only specific fields then add the field names in the SQL statement and not use wildcard * $result = mysql_query("SELECT fieldname1, fieldname2, fieldname3 FROM mytable");if (!$result) {die("Query to show fields from table failed");}
  9. ? are you talking about the nav, header footer layout setup, or css styling, the styling is fine for modern browser FF, O, Chrome, Safari, and newer version of you know..IE9, older IE browsers won't recognise these new elements, unless you use javascript to create these elements (google) the layout seems fine! but you could use <section></section> instead of #imbored element.
  10. Well I was going to say nav being a block element, would not require width: auto; But! apparently its a inline element, but it acts as block? Oh hang on! they now called phrasing (broadly equiv to inline), and flow (broadly equiv to block), great!
  11. html5 STILL needs doctype <!doctype html> OR IE requires STILL requires doctype, as if you look as crappy IE9, crappy development tools it shows as being in 'quirks mode' not IE crappy standards to make me work like much better browsers mode.
  12. make backup of html and css, replace original html with below <div id="menu-bar"> <ul> <li><a href="http://www.roxannedavisphotography.com">Home</a></li> <li><a href="#">Portfolio</a> <ul> <li><a href="#">Bands</a> <ul> <li><a href="http://www.roxannedavisphotography.com/DespairsRay.html">D'espairsRay</a></li> <li><a href="http://www.roxannedavisphotography.com/Versailles.html">Versailles</a></li> <li><a href="http://www.roxannedavisphotography.com/Queensryche.html">Queensrÿche</a></li> <li><a href="http://www.roxannedavisphotography.com/Love_Said_No.html">Love Said No</a></li> <li><a href="http://www.roxannedavisphotography.com/Soundevice.html">Soundevice</a></li> </ul> </li> <li><a href="http://www.roxannedavisphotography.com/seniors.html">Seniors</a></li> <li><a href="http://www.roxannedavisphotography.com/wedding.html">Wedding</a></li> <li><a href="http://www.roxannedavisphotography.com/people_portraits.html">People & Portraits</a></li> <li><a href="http://www.roxannedavisphotography.com/pets.html">Pets</a></li> <li><a href="http://www.roxannedavisphotography.com/commercial.html">Commercial</a></li> <li><a href="http://www.roxannedavisphotography.com/graphics.html">Graphics</a></li> </ul> </li> <li><a href="#">Fine Art Prints</a> <ul> <li><a href="#">Scenic</a></li> <li><a href="#">Wildlife</a></li> <li><a href="#">Nature</a></li> <li><a href="#">Miscellaneous</a></li> </ul></li><li><a href="#">Price Lists</a> <ul> <li><a href="http://www.roxannedavisphotography.com/price_list.html">Session & Prints Price List</a></li> <li><a href="http://www.roxannedavisphotography.com/wedding_price_list.html">Wedding Price List</a></li> </ul> </li> <li><a href="http://roxannedavis.zenfolio.com/">Customer Order Page</a></li> <li><a href="http://www.roxannedavisphotography.com/profile.html">About the Owner</a></li> <li><a href="http://www.roxannedavisphotography.com/contact.html">Contact Me</a></li> </ul></div> replace original css with body{ padding:0px; background: #000000; font-size: 12px; color: white; font-family: 'Pontano Sans', sans-serif; } #menu-bar, #menu-bar ul, #menu-bar li{font-family: 'Pontano Sans', sans-serif; font-size:18px; text-indent:0; padding:0; margin:0; } #menu-bar li{ white-space:nowrap; list-style: none; position: relative; float: left; /* this makes the lists to appear horizontally */ height: 50px; text-align: center; background-color: #000000; line-height: 50px; padding: 0 22px 5px; padding-bottom:5px; } #menu-bar li:last-child {padding:0; } #menu-bar li li, #menu-bar li li:last-child{ width:100%; text-align: left; padding-left:25px; padding-right:0px; } #menu-bar li a{ display:block; /*added by dsonesuk */ text-decoration:none; color: white; } #menu-bar li:hover{ background-color:#000000; } #menu-bar ul ul{ position:absolute; /*added by dsonesuk */ width:225px; /*added by dsonesuk */ top:50px;/*amended by dsonesuk */ /*visibility:hidden;*/ /*background-image:/graphics/menu_background.jpg;*/ } #menu-bar ul li:hover ul{ visibility:visible; background-color:#CC9999; } #menu-bar ul ul ul{ top:0px;} /*reset positon for all sublevels below sublevel 1*/ #menu-bar ul ul li a {display:block; width:100%; height:100%; line-height:50px; float:none; } /*for every new sublevel add preffix ul (ul li:hover li ul = sublevel 1, ul ul li.hover li ul= sublevel 2 and so on. the .sfhover is for ie6 which should be identical to prev example but with replacment of ':hover' with '.sfhover' instead )*/#menu-bar ul ul,#menu-bar ul li:hover li ul, /*sublevel 1*/#menu-bar ul ul li:hover li ul /*sublevel 2*/{left:-999999em;} /*xxxxxxxxxxxxx set hover xxxxxxxxxxxxx*/#menu-bar ul li:hover,#menu-bar ul li ul{z-index:99;} /*prevents overlap from neighbouring images and borders*/ #menu-bar ul li:hover, #menu-bar ul ul li a:hover, #menu-bar ul ul li:hover {background-color:#333;} /*for every new sublevel add prefix ul (ul li:hover ul = sublevel 1, ul ul li:hover ul= sublevel 2 and so on. the .sfhover is for ie6 which should be identical to prev example but with replacment of ':hover' with '.sfhover' instead, THESE MUST BE DONE SEPARATE as below and not grouped together )*/ /*sublevel 1*/#menu-bar ul li:hover ul{left:0px;} /*sublevel 2*/ #menu-bar ul ul li:hover ul {left:0;margin-left: 250px;} /*sublevel 3*/#menu-bar ul ul ul li:hover ul {left:0;margin-left: 250px;} Here ends the difficult, copy and paste lesson for today.
  13. ??? you mean like this input[type="text"] { color: #5A5A5A; font-family:"Century Gothic";} <input type="text" name="search" value="Search..." onfocus="if(this.value==this.defaultValue){this.value='';} this.style.color='#000000'; this.style.fontSize='16px';" onblur="if(this.value==''){this.value=this.defaultValue;this.style.color='#5a5a5a';this.style.fontSize='14px';}else{this.style.color='#000000'; this.style.fontSize='14px';}">
  14. input[type=text] { font-size:20px; color: red;}
  15. dsonesuk

    PHP Loops

    for database listing a quick method is <table width="960" border="1" cellspacing="0" cellpadding="0"><?phpwhile($row = mysql_fetch_row($result)) { echo "<tr>"; foreach($row as $column_value) { echo '<td>'.$column_value.'</td>'; } echo '</tr>'."\n"; } ?></table>
  16. dsonesuk

    PHP Loops

    <table width="960" border="1" cellspacing="0" cellpadding="0"><?php $column_count = 6; $row_count = 6;if(isset($_POST['row_count']) && !empty($_POST['row_count']) && isset($_POST['column_count']) && !empty($_POST['column_count'])){ $column_count = $_POST['column_count']; $row_count = $_POST['row_count'];} $cell_count =0; for($row=1;$row<$row_count+1;$row++){echo '<tr>';for($col=1;$col<$column_count+1;$col++) { $cell_count++; echo '<td>'.$cell_count.'</td>'; }echo '</tr>';} ?></table><form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">Table rows <input type="text" name="row_count" /><br />Table columns <input type="text" name="column_count" /><br /><input type="submit" /></form>
  17. You can get same result using unordered list element, with position: absolute elements <!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><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><title>Untitled Document</title><script type="text/javascript">/*<![CDATA[*//*---->*//*--*//*]]>*/</script> <style type="text/css">ul,li {margin:0; padding:0; text-indent: 0; list-style-type:none;}#outer {height: 500px;width: 600px;margin-right: auto;margin-left: auto;position:relative;}.parent {height: 500px;width: 600px;border: 1px solid #F00;position:relative;}.elder-sibling {background-color: #000;height: 200px;width: 200px;position: absolute;color: #FFF;top:0;left:0;}.younger-sibling {background-color: #00F;height: 100px;width: 100px;position: absolute;top: 250px;color: #FFF;z-index:20;}#b2 {top:0; left:0; width:200px; height:200px; z-index:30;}#b1 {top:0; left:0; width:100%; height:100%; z-index:10;}ul li b { display:block; height:100%; width: 100%; position:absolute; z-index:0;}ul li li b { height:100%; width: 100%;}ul li li li b { height:100%; width: 100%;}ul.younger-sibling li, ul.elder-sibling li{height: 100%; width:100%; z-index:0;}#b1:hover + b {background-color:#FFFFFF;}#b2:hover + b { background-color:#FFFFFF;}ul li:hover{background-color:yellow;}ul li li:hover{background-color:red;}ul li li b:hover{background-color:#000;}ul li li li b:hover{background-color: blue;}</style></head><body><ul id="outer"><li class="parent"><b id="b1"> </b><b> </b><b id="b2"> </b><b> </b> <ul class="elder-sibling"> <li><b>elder-sibling</b> <ul class="younger-sibling"> <li><b>younger-sibling</b></li> </ul> </li> </ul></li></ul></body></html>
  18. At present there's no way to target preceding sibling elements OR parent element in CSS, for a succeeding sibling element yes! with '+' or '~', this could be achieved using JavaScript/Jquery though.
  19. <input type="text" name="search" value="Search..." onfocus="this.value=''"> once the input has focus, the input value is cleared completely and will never show again, if you make a mistake and to wish to correct the spelling you end up with same problem. One option is to identify when it is default value, hide, But! if not, keep the value entered, also if value deleted manually and you leave the input, return to default value. <input type="text" name="search" value="Search..." onfocus="if(this.value==this.defaultValue){this.value=''}" onblur="if(this.value==''){this.value=this.defaultValue}">
  20. #splashnolist { margin: 0 auto; overflow: hidden; /*added by dsonesuk*/ padding: 0 0 4px; width: 962px;}
  21. You Have major validation errors, misplaced <center> and </center> tags, which should be corrected body{ padding:0px; background: #000000; font-size: 12px; color: white; font-family: 'Pontano Sans', sans-serif; } #menu-bar, #menu-bar ul, #menu-bar li{font-family: 'Pontano Sans', sans-serif; font-size:18px; text-indent:0; padding:0; margin:0; } #menu-bar li{ white-space:nowrap; list-style: none; position: relative; float: left; /* this makes the lists to appear horizontally */ height: 50px; text-align: center; background-color: #000000; line-height: 50px; padding: 0 22px 5px; padding-bottom:5px; } #menu-bar li:last-child {padding:0; } #menu-bar li li, #menu-bar li li:last-child{ width:100%; text-align: left; padding-left:25px; padding-right:0px; } #menu-bar li a{ display:block; /*added by dsonesuk */ text-decoration:none; color: white; } #menu-bar li:hover{ background-color:#000000; } #menu-bar ul ul{ position:absolute; /*added by dsonesuk */ width:225px; /*added by dsonesuk */ top:50px;/*amended by dsonesuk */ /*visibility:hidden;*/ /*background-image:/graphics/menu_background.jpg;*/ } #menu-bar ul li:hover ul{ visibility:visible; background-color:#CC9999; } #menu-bar ul ul ul{ top:0px;} /*reset positon for all sublevels below sublevel 1*/ #menu-bar ul ul li a {display:block; width:100%; height:100%; line-height:50px; float:none; } /*for every new sublevel add preffix ul (ul li:hover li ul = sublevel 1, ul ul li.hover li ul= sublevel 2 and so on. the .sfhover is for ie6 which should be identical to prev example but with replacment of ':hover' with '.sfhover' instead )*/#menu-bar ul ul,#menu-bar ul li:hover li ul, /*sublevel 1*/#menu-bar ul ul li:hover li ul /*sublevel 2*/{left:-999999em;} /*xxxxxxxxxxxxx set hover xxxxxxxxxxxxx*/#menu-bar ul li:hover,#menu-bar ul li ul{z-index:99;} /*prevents overlap from neighbouring images and borders*/ #menu-bar ul li:hover, #menu-bar ul ul li a:hover, #menu-bar ul ul li:hover {background-color:#333;} /*for every new sublevel add prefix ul (ul li:hover ul = sublevel 1, ul ul li:hover ul= sublevel 2 and so on. the .sfhover is for ie6 which should be identical to prev example but with replacment of ':hover' with '.sfhover' instead, THESE MUST BE DONE SEPARATE as below and not grouped together )*/ /*sublevel 1*/#menu-bar ul li:hover ul{left:0px;} /*sublevel 2*/ #menu-bar ul ul li:hover ul {left:0;margin-left: 250px;} /*sublevel 3*/#menu-bar ul ul ul li:hover ul {left:0;margin-left: 250px;}
  22. dsonesuk

    date range

    $now = new DateTime($newdate);$today=$now->format('j m Y');$startDate = $mondayweek->modify("tomorrow")->modify("last Monday")->format('j m Y');$endDate = $mondayweek->modify("yesterday")->modify("next Sunday")->format('j m Y'); now() is the date you want to identify the startdate and enddate (monday to sunday), $today is the date but in specific format, therefore in the if condition using $today as it is if($today>= $startDate && $today <= $endDate) will always be true! hence repeated id ref, you need the variable applied to td cell increase by 1, and compare this variable value in the 'if' condition
  23. dsonesuk

    date range

    Err, sorry i have to disagree, its the php that assigns the id ref depending on the result of the if condition. try adding $today, $endDate to temp class to identify what it is checking against {echo '<tr id="current_week" class="td_'.$today.' sd_'.$startDate.' ed_'.$endDate.'">';}$today can't be a static date, it must the date applied within the td cells themselves, because yes, it will show repeated id ref , because yes the static date IS always between start and end dates.
  24. dsonesuk

    Next step?

    Whoopee! Well chaps, congrats for volunteering for share of 95%.
  25. dsonesuk

    date range

    what is $monday referring to? if $now is the date you are checking against, surly you would want to check against the monday (start date) and sunday (end date) that it falls between. $now = new DateTime($newdate);$today=$now->format('Ymd'); $monday = clone $now;$sunday = clone $now;$startDate = $monday->modify("tomorrow")->modify("last Monday")->format('Ymd');$endDate = $sunday->modify("yesterday")->modify("next Sunday")->format('Ymd'); EDIT: its the way i formatted the dates ('Ymd') produces 20120503 which is a better value to do calculations against, than ('j m Y') 3 05 2012 or ('Ymj') 2012053 as theres no leading zeroes for last digitYmjMonday = 20120430 = 20,120,430Sunday = 2012056 = 2,012,056current = 2012053 = 2,012,053 compared toYmdMonday = 20120430 = 20,120,430Sunday = 20120506 = 20,120,506current = 20120503 = 20,120,503
×
×
  • Create New...