Jump to content

greenday

Members
  • Posts

    45
  • Joined

  • Last visited

    Never

Everything posted by greenday

  1. Please could you look at: http://www.vineyardroads.co.nz/testsite/ In a screen resolution of 1024 x 768 in IE7, the body background image (top centered aligned) doesnt line up with the main verticle repeating background (also center aligned) in a div called 'outset'. This looks fine in FF at all resolutions, and only seams to break in IE7 at the lower screen size. Any ideas please?
  2. Thanks for your help. I managed to get it working with your help. I will post all the code i have ever written in a new thread for you
  3. Hi thanks for your quick reply. I have never come across mysql_data_seek before. I looked it up, but still cant work out where to put it in the code, please could you show me? Also, could you tell me why I need to do this on this occassion, as i have never had to do this before? Thanks.
  4. I have a sql array, but i can only out it in a while loop once. If try to put the same result in another while loop, the results are blank. Has anyone had this problem before? My php / mysql is within javascript, but i dont think this has anything to do with it. Here is the code : <script type="text/javascript"> //<![CDATA[ var map = new GMap2(document.getElementById("map")); map.addControl(new GLargeMapControl()); map.addControl(new GMapTypeControl()); map.addControl(new GScaleControl()); map.setCenter(new GLatLng(<?php echo $row_mapsize['lat']; ?>, <?php echo $row_mapsize['lon']; ?>), <?php echo $row_mapsize['zoom']; ?>, G_NORMAL_MAP); // Creates a marker whose info window displays the given number function createMarker(point, number) { var marker = new GMarker(point); // Show this markers index in the info window when it is clicked var html = number; GEvent.addListener(marker, "click", function() {marker.openInfoWindowHtml(html);}); return marker; }; <?php $regionid=$HTTP_GET_VARS['id']; mysql_select_db($database_admin, $admin); $query_bizlist = "SELECT * FROM wineries where region = '$regionid' AND "; If($_GET['tastings'] == 'full') { $tastings = $_GET['tastings']; $query_bizlist =$query_bizlist. "full_desc != ' ' AND "; } If($_GET['tastings'] == 'openpublic') { $tastings = $_GET['tastings']; $query_bizlist =$query_bizlist. "open_public_tastings = '1' AND "; } If($_GET['bordeaux_style_blends'] >= '1') { $bordeaux_style_blends = $_GET['bordeaux_style_blends']; $query_bizlist =$query_bizlist. "bordeaux_style_blends = '1' AND "; } $sql = rtrim($query_bizlist," AND "); $bizlist = mysql_query($sql, $admin) or die(mysql_error()); $row_bizlist = mysql_fetch_assoc($bizlist); $totalRows_bizlist = mysql_num_rows($bizlist); while ($row_bizlist = mysql_fetch_assoc($bizlist)) { echo "var point = new GLatLng(" . $row_bizlist['lat'] . "," . $row_bizlist['lon'] . ");\n"; echo "var marker = createMarker(point, '<div id=\"mapWindow\" ><strong><a href=details.php?id=".$row_bizlist['id']." > ".$row_bizlist['name']." </a></strong><br /><form method=post name=form1 action=$editFormAction><input type=submit value=Add to My Wine Trail><input type=hidden name=wtentryid value=><input type=hidden name=username value=".$user->data['username']."> <input type=hidden name=wineryid value=".$row_bizlist['id']."><input type=hidden name=MM_insert value=form1></form> <br/> ".$row_bizlist['address']." <br /> Ph: ".$row_bizlist['phone']." <br/> <a target=_blank href= ".$row_bizlist['website']." > ".$row_bizlist['website']." </a> <br /><a href=mailto:".$row_bizlist[email]." >Email Winery</a> <br />Cellar Hours: ".$row_bizlist[cellar_hours]." </div>');\n"; echo "map.addOverlay(marker);\n"; echo "\n"; } ?> //]]> </script>
  5. Sorry for the REALLY late reply, got so busy, and then couldnt find this post in the forum. The first suggestion works good, but removes the whole last loop, not just the last "to:" The second suggetsion works perfectly. The only main differance I can see is the second suggestion echos out the output with <pre>? Anyway thanks very much for your help, it solved my problem
  6. I have a while loop like this: <?php do { ?> <?php echo $row_mapdirections['name']; ?>@<?php echo $row_mapdirections['lat']; ?>, <?php echo $row_mapdirections['lon']; ?> to: <?php } while ($row_mapdirections = mysql_fetch_assoc($mapdirections)); ?> This will ouput something like: Name@lat, lon to: Name@lat, lon to: Name@lat, lon to: How can I store the above output as a vairable? The reason i want to to do this is to echo the result later with a right trim on to remove the unwanted 'to' at the end. Thanks!
  7. Hi I am using PHP File Upload add on to Dreamweaver, and am getting some serious cross browser probs. Its an extension which allows form data file fields to upload to a directory, and insert the name into a DB. There are options to limit file size and dimensions etc. If the dimensions of the intended image are too big, an alert box will pop up with a message saying the size is too big. If you still try to submit the form regardless, the alert will come up again, and not allow the form to submit. This works fine in IE6, but in IE7 and FF3, the alerts will not appear (except if the file is not an image), and allows the form to be submitted, going to a detail error page with a back button. Once the back back is pressed, the form has lost all the inputed data, and the user gives up. Here is an extract from the js file which should give the alert: function showImageDimensions(fieldImg) { var is_ns6 = (!document.all && document.getElementById ? true : false); var img = (fieldImg && !is_ns6 ? fieldImg : this); if (img.width > 0 && img.height > 0) { if ((img.minWidth != '' && img.minWidth > img.width) || (img.minHeight != '' && img.minHeight > img.height)) { alert('Uploaded Image is too small!\nShould be at least ' + img.minWidth + ' x ' + img.minHeight); img.field.uploadOK = false; return; } if ((img.maxWidth != '' && img.width > img.maxWidth) || (img.maxHeight != '' && img.height > img.maxHeight)) { alert('Uploaded Image is too big!\nShould be max ' + img.maxWidth + ' x ' + img.maxHeight); img.field.uploadOK = false; return; } if (img.sizeLimit != '' && img.fileSize > img.sizeLimit) { alert('Uploaded Image File Size is too big!\nShould be max ' + (img.sizeLimit/1024) + ' KBytes'); img.field.uploadOK = false; return; } if (img.saveWidth != '') { document.PU_uploadForm[img.saveWidth].value = img.width; } if (img.saveHeight != '') { document.PU_uploadForm[img.saveHeight].value = img.height; } if (document.PU_uploadForm[img.field.name+'_width']) { document.PU_uploadForm[img.field.name+'_width'].value = img.width; } if (document.PU_uploadForm[img.field.name+'_height']) { document.PU_uploadForm[img.field.name+'_height'].value = img.height; } img.field.uploadOK = true; } } Any help much appreciated
  8. Great, thanks so much, got it them to work together now Here is the final code incase it may help others out: /* var accordion; var accordionTogglers; var accordionContents; var checkboxHeight = "25"; var radioHeight = "25"; var selectWidth = "190"; /* No need to change anything after this */ document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; z-index: 5; }</style>'); var Custom = { init: function() { var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active; for(a = 0; a < inputs.length; a++) { if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className == "styled") { span[a] = document.createElement("span"); span[a].className = inputs[a].type; if(inputs[a].checked == true) { if(inputs[a].type == "checkbox") { position = "0 -" + (checkboxHeight*2) + "px"; span[a].style.backgroundPosition = position; } else { position = "0 -" + (radioHeight*2) + "px"; span[a].style.backgroundPosition = position; } } inputs[a].parentNode.insertBefore(span[a], inputs[a]); inputs[a].onchange = Custom.clear; span[a].onmousedown = Custom.pushed; span[a].onmouseup = Custom.check; document.onmouseup = Custom.clear; } } inputs = document.getElementsByTagName("select"); for(a = 0; a < inputs.length; a++) { if(inputs[a].className == "styled") { option = inputs[a].getElementsByTagName("option"); active = option[0].childNodes[0].nodeValue; textnode = document.createTextNode(active); for(b = 0; b < option.length; b++) { if(option[b].selected == true) { textnode = document.createTextNode(option[b].childNodes[0].nodeValue); } } span[a] = document.createElement("span"); span[a].className = "select"; span[a].id = "select" + inputs[a].name; span[a].appendChild(textnode); inputs[a].parentNode.insertBefore(span[a], inputs[a]); inputs[a].onchange = Custom.choose; } } }, pushed: function() { element = this.nextSibling; if(element.checked == true && element.type == "checkbox") { this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px"; } else if(element.checked == true && element.type == "radio") { this.style.backgroundPosition = "0 -" + radioHeight*3 + "px"; } else if(element.checked != true && element.type == "checkbox") { this.style.backgroundPosition = "0 -" + checkboxHeight + "px"; } else { this.style.backgroundPosition = "0 -" + radioHeight + "px"; } }, check: function() { element = this.nextSibling; if(element.checked == true && element.type == "checkbox") { this.style.backgroundPosition = "0 0"; element.checked = false; } else { if(element.type == "checkbox") { this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px"; } else { this.style.backgroundPosition = "0 -" + radioHeight*2 + "px"; group = this.nextSibling.name; inputs = document.getElementsByTagName("input"); for(a = 0; a < inputs.length; a++) { if(inputs[a].name == group && inputs[a] != this.nextSibling) { inputs[a].previousSibling.style.backgroundPosition = "0 0"; } } } element.checked = true; } }, clear: function() { inputs = document.getElementsByTagName("input"); for(var b = 0; b < inputs.length; b++) { if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") { inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px"; } else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") { inputs[b].previousSibling.style.backgroundPosition = "0 0"; } else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") { inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px"; } else if(inputs[b].type == "radio" && inputs[b].className == "styled") { inputs[b].previousSibling.style.backgroundPosition = "0 0"; } } }, choose: function() { option = this.getElementsByTagName("option"); for(d = 0; d < option.length; d++) { if(option[d].selected == true) { document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue; } } } } window.onload = function() { Custom.init(); { accordionTogglers = document.getElementsByClassName('accToggler'); accordionTogglers.each(function(toggler){ //remember the original color toggler.origColor = toggler.getStyle('background-color'); //set the effect toggler.fx = new Fx.Color(toggler, 'background-color'); }); accordionContents = document.getElementsByClassName('accContent'); accordion = new Fx.Accordion(accordionTogglers, accordionContents,{ //when an element is opened change the background color to blue onActive: function(toggler){ toggler.fx.toColor('#6899CE'); }, onBackground: function(toggler){ //change the background color to the original (green) //color when another toggler is pressed toggler.setStyle('background-color', toggler.origColor); } }); }}
  9. Ken2k7, thanks for your help, but you need to be more specific, i mentioned that i am new to javascript. I made the change as suggested and it doesnt work. Is that all i need to do? Should i copy and paste one script into he other aswell? If so which script at the begining? I really need fool proof advice as i am new. Thanks.
  10. thanks both for your help. I am not sure on the syntax to group them together. Here are the two scripts, if anyone could show me how to group them together, it would be a useful lesson. thanks. var checkboxHeight = "25"; var radioHeight = "25"; var selectWidth = "190"; /* No need to change anything after this */ document.write('<style type="text/css">input.styled { display: none; } select.styled { position: relative; width: ' + selectWidth + 'px; opacity: 0; z-index: 5; }</style>'); var Custom = { init: function() { var inputs = document.getElementsByTagName("input"), span = Array(), textnode, option, active; for(a = 0; a < inputs.length; a++) { if((inputs[a].type == "checkbox" || inputs[a].type == "radio") && inputs[a].className == "styled") { span[a] = document.createElement("span"); span[a].className = inputs[a].type; if(inputs[a].checked == true) { if(inputs[a].type == "checkbox") { position = "0 -" + (checkboxHeight*2) + "px"; span[a].style.backgroundPosition = position; } else { position = "0 -" + (radioHeight*2) + "px"; span[a].style.backgroundPosition = position; } } inputs[a].parentNode.insertBefore(span[a], inputs[a]); inputs[a].onchange = Custom.clear; span[a].onmousedown = Custom.pushed; span[a].onmouseup = Custom.check; document.onmouseup = Custom.clear; } } inputs = document.getElementsByTagName("select"); for(a = 0; a < inputs.length; a++) { if(inputs[a].className == "styled") { option = inputs[a].getElementsByTagName("option"); active = option[0].childNodes[0].nodeValue; textnode = document.createTextNode(active); for(b = 0; b < option.length; b++) { if(option[b].selected == true) { textnode = document.createTextNode(option[b].childNodes[0].nodeValue); } } span[a] = document.createElement("span"); span[a].className = "select"; span[a].id = "select" + inputs[a].name; span[a].appendChild(textnode); inputs[a].parentNode.insertBefore(span[a], inputs[a]); inputs[a].onchange = Custom.choose; } } }, pushed: function() { element = this.nextSibling; if(element.checked == true && element.type == "checkbox") { this.style.backgroundPosition = "0 -" + checkboxHeight*3 + "px"; } else if(element.checked == true && element.type == "radio") { this.style.backgroundPosition = "0 -" + radioHeight*3 + "px"; } else if(element.checked != true && element.type == "checkbox") { this.style.backgroundPosition = "0 -" + checkboxHeight + "px"; } else { this.style.backgroundPosition = "0 -" + radioHeight + "px"; } }, check: function() { element = this.nextSibling; if(element.checked == true && element.type == "checkbox") { this.style.backgroundPosition = "0 0"; element.checked = false; } else { if(element.type == "checkbox") { this.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px"; } else { this.style.backgroundPosition = "0 -" + radioHeight*2 + "px"; group = this.nextSibling.name; inputs = document.getElementsByTagName("input"); for(a = 0; a < inputs.length; a++) { if(inputs[a].name == group && inputs[a] != this.nextSibling) { inputs[a].previousSibling.style.backgroundPosition = "0 0"; } } } element.checked = true; } }, clear: function() { inputs = document.getElementsByTagName("input"); for(var b = 0; b < inputs.length; b++) { if(inputs[b].type == "checkbox" && inputs[b].checked == true && inputs[b].className == "styled") { inputs[b].previousSibling.style.backgroundPosition = "0 -" + checkboxHeight*2 + "px"; } else if(inputs[b].type == "checkbox" && inputs[b].className == "styled") { inputs[b].previousSibling.style.backgroundPosition = "0 0"; } else if(inputs[b].type == "radio" && inputs[b].checked == true && inputs[b].className == "styled") { inputs[b].previousSibling.style.backgroundPosition = "0 -" + radioHeight*2 + "px"; } else if(inputs[b].type == "radio" && inputs[b].className == "styled") { inputs[b].previousSibling.style.backgroundPosition = "0 0"; } } }, choose: function() { option = this.getElementsByTagName("option"); for(d = 0; d < option.length; d++) { if(option[d].selected == true) { document.getElementById("select" + this.name).childNodes[0].nodeValue = option[d].childNodes[0].nodeValue; } } } } window.onload = Custom.init; var accordion; var accordionTogglers; var accordionContents; window.onload = function() { accordionTogglers = document.getElementsByClassName('accToggler'); accordionTogglers.each(function(toggler){ //remember the original color toggler.origColor = toggler.getStyle('background-color'); //set the effect toggler.fx = new Fx.Color(toggler, 'background-color'); }); accordionContents = document.getElementsByClassName('accContent'); accordion = new Fx.Accordion(accordionTogglers, accordionContents,{ //when an element is opened change the background color to blue onActive: function(toggler){ toggler.fx.toColor('#6899CE'); }, onBackground: function(toggler){ //change the background color to the original (green) //color when another toggler is pressed toggler.setStyle('background-color', toggler.origColor); } }); }
  11. Hi I have 2 linked .js files in my page, each uses the onload to trigger the script. Only one of the scripts will work at a time. Is there anything i can do to get them both to work? I am new to javascript! Here are the links: <script src="scripts/custom-form-elements.js" type="text/javascript"></script> Has this at the very END of the script: window.onload = Custom.init; And the other linked .js file is: <script src="scripts/accordian.js" type="text/javascript"></script> Which has this at this at the begining after the variables are set: window.onload = function() { Any help much apreciated
  12. aschk, thanks alot for your help, your sql statement gives me 1 record exactaly how i need, by selecting the highest articleid gives me the latest. However, I am looking to get the 'latest' article that is in each articlecategoriy. My origional group by done this, but it used the first results 'oldest' and lowest articleid. Any ideas? maybe i need to somehow combine the group by and the join? cheers.
  13. thanks for your suggestion, but this gives me the entire records. I used group by as I want just one articlesummary for each articlecategoryid. Can you think of another way? Cheers.
  14. thanks, but that doesnt seem to work, even when i group by articles.articlecategoryid as suggested. I think the problem is that any ordering happens after the results have been got, so its only ordering the same results differantly. Where as I am needing to get differant results in the first place. Maybe my topic title was wrong. Any other ideas?
  15. Hi, I am getting results from 2 tables using the group by method. The reason for 2 tables is one contains all the news details and categoryid, and the other contains the categoryid and categoryid title. Here is the code SELECT articles.articlesummary, articles.articleid, articles.articlecategoryid, articlecategory.articlecategoryname FROM articles, articlecategory WHERE articles.articlecategoryid = articlecategory.articlecategoryid GROUP BY articlecategory.articlecategoryname ORDER BY articles.articlecategoryid ASC LIMIT 0 , 30 Works great, just as i want, except that its getting the first(oldest) articleid listing from the table for each article. I want the last(newest) articleid listing for each. Any help please? Thanks.
  16. Thanks, thats great. However this will only give the results for 1 category i.e. International News. How can I cycle through all differant categories, with 1 news for each category like this: Articlecategory Title 1 Latest story for articlecategory title 1 Articlecategory Title 2 Latest story for articlecategory title 2 Articlecategory Title 3 Latest story for articlecategory title 3 Thanks.
  17. the 'and' was just written in plain english to get an idea of what the sql was like. I have joind the table, but cant work out how to do the correct join to get the results i need.
  18. ok sorry its like this: Category 1 Heading First article in category 1 Category 2 Heading First article in category 2 Category 3 Heading First article in category 3 .. and so on. Cheers
  19. Thanks for your reply. I would like the out put to look like Article Category Title Article Summary And this is repeated, one article summary underneath each differant article title. How could i use group by to achieve this - i have only used it to count? Thanks.
  20. greenday

    Query Help

    Hi, here is my sql staement: SELECT * FROM articlecategory, articles WHERE articles.articlecategoryid = articlecategory.articlecategoryid And here I echo this in a while loop: <?php echo $row_news['articlecategoryname']; ?></strong><br> <?php echo $row_news['articlesummary']; ?></p> Trouble is I only want 1 article suammary under each article category heading, and i am getting all the results. Any ideas please?
  21. I have 1 table called article, and another called articlecategory. They are linked through a field called articlecategoryid. To display the results in the front end I am creating an SQL statement for each article category like: SELECT * from articles and articlecategory WHERE articlecategoryid both = international news and then another for the next articlecategory: SELECT * from articles and articlecategory WHERE articlecategoryid both = local news and so on. I know this is the wrong way to do it, and if an administrator adds a new articlecategory, then it obviously wont show up because each articlecategory is hand coded in. What is the correct way to do this, so it will cycle through each articlecategory and add the latest story underneath the title for each like this: Articlecategory Title 1 Latest story for articlecategory title 1 Articlecategory Title 2 Latest story for articlecategory title 2 Articlecategory Title 3 Latest story for articlecategory title 3 And so on.. Some articlecategory's may not have any related stories . Thanks!
  22. awesome - thanks so much guys for the quick responses - case solved!
  23. Hi, when i output a web address from a DB entry, it could have been entered as just www.domain.com, or http://www.domain.com. I am trying to find a way where I can check if the http:// exists, and if not add it to the begining. Having tried various ways, I cant get it to work -any help please? Here is my code before I have tried any ways to get it to work: Web: <a href="<?php echo $row_clubinfo['clubweb']; ?>" target="_blank"><?php echo $row_clubinfo['clubweb'] = str_replace('http://', '', $row_clubinfo['clubweb']); ?></a> You will see from the code I am removing the http:// from the visible text, but need to add it to the href link. Thanks!
  24. bronzemonkey - thanks for reinforcing the idea of the image indicating a link, whilst doing this it also crossed my mind. At first all the H2's were links, but as the site progressed it changed, you know how it is. So I will consider what to do here. Also, I have gone for the negative margin as suggested for the momment, and this has worked just as I need. Thanks all for your help. Here is the finall code I have used: HTML: <h2><a href="/about">About</a></h2> CSS: .insert h2 { background:transparent url(img/green_arrow.gif) no-repeat top left; color:#2D6EBC; margin:0 0 10px 0; padding:0 0 0 37px; font-size:17px; font-weight:bold; font-family: arial, Verdana, times; height:24px; } h2 a:link, h2 a:visited { color:#2D6EBC; display:block; width:100%; padding-left:37px; margin-left:-37px; }
  25. Thanks all for your help, its been very usefull. However I have encountered another problem - not all the <h2>'s are links, so this makes those as links correct, but those that arent have 0 left padding, which causes the text to run over the image. Can anyone help on this last matter? Thanks.
×
×
  • 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.