Jump to content

spikypunker

Members
  • Posts

    158
  • Joined

  • Last visited

    Never

Everything posted by spikypunker

  1. I've solved this on me own guys, thanks the the help Here's the code if anyones interested! Its part of the code from the tool MooRainbow, and what i've added changes a CSS class which then changes the background color of table cells with that class, in realtime. Pretty cool if i do say so myself. <script type="text/javascript"> window.addEvent('domready', function() { var r = new MooRainbow('myRainbow', { 'startColor': [58, 142, 246], 'onChange': function(color) { $('myInput').value = color.hex; var css = document.styleSheets[0]; try { // IE css.addRule('.bgcolor1', 'background-color:' + color.hex + ';'); } catch(e) { // W3C css.insertRule('.bgcolor1 {background-color:' + color.hex + ';}',css.cssRules.length); } } }); }); </script>
  2. Hi dudes, i've implemeted a javascript tool that returns a HEX value from a color picker, it currently adds the value into an Input box. I really want to have the HEX value also get fired into a CSS rule? Here's the code snippet that i've amended, it contains the event and the previous action which added the HEX to the input box, and also the line ive TRIED to add which i thought would change the CSS rule but yeah it's not working Any ideas?? Cheers guys!! 'onChange': function(color) { $('myInput').value = color.hex; document.getElementById(bgcolor1).style.backgroundColor = color.hex; Bear in mind this is part of a slightly larger function which i can paste too, but this is the snippet i wanted to add the change to! Peace, Chris Edit/Delete Message
  3. Hey guys Need some help using ImageMagick, does anyone know how to do a simple resize? All i need it to do is upload an image and then resize to a set value and saved to a users folder. I'll work out how to get it to the users folder and take in the dynamic sizes using simple php, but i just need some help on implementing the ImageMagick calls, does anyone have any experience in this server tech? I've trawled the support for it and am having real troubles understanding it! So far i've got the image uploader and i just need to know how to add into this a line that calls ImageMagick and resizes, before saving? Here's what i got so far: <?php $user = $_GET['user']; if((!empty($_FILES["uploaded_file"])) && ($_FILES['uploaded_file']['error'] == 0)) { $filename = basename($_FILES['uploaded_file']['name']); $ext = substr($filename, strrpos($filename, '.') + 1); if (($ext == "jpg") && ($_FILES["uploaded_file"]["type"] == "image/jpeg") && ($_FILES["uploaded_file"]["size"] < 100000000)) { $newname = dirname(__FILE__).'/images/'.$filename; if (!file_exists($newname)) { if ((move_uploaded_file($_FILES['uploaded_file']['tmp_name'],$newname))) { echo "<meta http-equiv=\"refresh\" content=\"0;URL=profile.php?user=$user\">"; } else { echo "Error: A problem occurred during file upload!"; } } else { echo "Error: File ".$_FILES["uploaded_file"]["name"]." already exists"; } } else { echo "Error: Only .jpg images under 350Kb are accepted for upload"; } } else { echo "Error: No file uploaded"; } ?>
  4. wow thats awesome! Cheers it's works 99%, exactly what i needed however, check out this slightly wierd result... The alphabet has started again, i've noticed that they seem to have been seperated into uppper and lower case? peace
  5. Hi guys! I need some help! All i need to do is list the contents of a directory into a dropdown, with the filenames as the list values. I've found a script which does this, <?php // Set the path of the dir you want displayed... $path="../emails/ama/images/headers/"; $handle=opendir($path); while ($file=readdir($handle)) { echo "\t<option value='#/ama/images/headers/".$file."'>".$file."</option>\n"; } ?> Now this isnt doing a coupla important things, it's not sorting them, and it's including "." and ".." I've found a couple of much better scripts which put the results into an array and also excluse the "." etc BUT i dont know how to then perform a loop to populate the drop down from the array? It would be awesome if someone could first show me how to read into the array, and then loop the array into a dropdown? It's cool doing it that way cause i can then learn something rather than just finding script and slapping it in. Cheers for any help, Peace, Chris
  6. Heeey! That's great! Works perfectly Is there anyway of giving the user a choice as to where to save it to? That script is awesome, but it just gives the option to save, and then saves into your downloads. Is it fairly simple to add the extra functionality? If not then i'll be happy with the way it works now! Cheers again! peace
  7. Hi Guys I know this may be frowned upon? I can see potential for this kind of operation to be abused. But i have an online HTML editor and need the output to be saved as a TXT file on the users system. It would be best if a file browser appears and they choose save location etc etc. So far i'm just passing the content to a page called save.php which is picking it up, so where do i go from here? Kind regards, Chris
  8. haha awesome! I used your first reply which worked but now have learnt a new function! So this replaces all elements that needs a specific html code? Cheers!
  9. Ah i see so it's just doing a replace? Thanks! It's working perfectly now, brilliant! Answered in 7 minutes! Thanks again! Peace
  10. Hi Guys, loving the new look! I've got this developable software which i've bought and am trying to intergrate into my site but have encountered a problem. The company is based in Oz so the tech support replies come in the middle of the night and they werent very helpful, pretty much just told me what the error was so looks like i'm on my own in this one. It's saying there's a deprecated function, so i'm guessing the code was written for an out of date PHP version? Here's the error: And here's the function i belive is in question: function encodeHTML($sHTML) { $sHTML=ereg_replace("&","&",$sHTML); $sHTML=ereg_replace("<","<",$sHTML); $sHTML=ereg_replace(">",">",$sHTML); return $sHTML; } echo encodeHTML(file_get_contents($file)); Could anyone suggest what to replace this function with? Cheers! Peace Chris
  11. Hey guys Am trying to develop a page where a user has a dropdown box and chooses an image. I found a simple script that achieves this usign javascript here: <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Brand IT - Home page</title> <link rel=stylesheet href="brandit.css" type=text/css></link> <script language="javascript"> function showimage() { if (!document.images) return document.images.pictures.src= document.mygallery.picture.options[document.mygallery.picture.selectedIndex].value } </script> </head> <table border="0" cellspacing="0" cellpadding="0"> <tr> <td width="100%"><form name="mygallery" action="mail.php" method="post"><p> <select name="picture" size="1" onChange="showimage()"> <option selected value="http://www.#.co.uk/emails/gocruise/images/header1.jpg">Picture of me</option> <option value="http://www.#.co.uk/emails/gocruise/images/header3.jpg">Picture of my aunt</option> <option value="http://www.#.co.uk/emails/gocruise/images/header2.jpg">Picture of my brother</option> </select> <input name="" type="submit" /> </p> </form> </td> </tr> <tr> <td width="100%"><p align="center"><img src="http://www.#.co.uk/emails/gocruise/images/header1.jpg" name="pictures" width="99" height="100"></td> </tr> </table> This works really well, but as soon as i add a SUBMIT button with an action and method, it stops working.... I guess i can understand why it does this but i cant think of a way to make it work. The idea is the user chooses the image and then a couple of other fields and then a mailer.php page sends an email with the choices they made. Does anyone know how this is possible? Kind Regards, Chris H
  12. No i didnt sorry, i dont really see the point of that tho, if people are finding it hard to locate something and someone can help them it'll make the world easier. Oh well.
  13. Hi guys Does anyone know of some software that allows this? I'd ideally like one that is simple to intergrate into my current websites which links to a browser based chat relay? So that i can assign agents each day and they can log in and 'man' the website to take real time questions from users? I am in a position to find some software that is paid for Kind regards, Chris
  14. <div class="deals_of_week"> <h3>Deals of the week!</h3></div> <div class="deals_of_week_container"> <div class="offers_region2"><a href="/fusion/gotocruise.pl?cid=%CTCID%&sid=6924">Grand Caribbean Adventurer</a></div> <div class="cruiseoffer2"> <div class="cruiseoffer2_col1"> <div class="offers_image2_box"> <div class="offers_image2"><img src="test.jpg"></div></div> <div class="cruiseoffer2_col1_logo"><img src="princess.gif"></div></div> <div class="cruiseoffer2_col2"> <div class="cruiseoffer2_depart"><a href="">Departs: 6th Feb 2010</a></div><br> <div class="cruiseoffer2_text"><a href=""><b>Ship:</b> Sea Princess</a><br><a href="" <a><b>Nights:</b> 15</a><br><a href=""><b>Price:</b> From £1580</a></div><br> <div class="cruiseoffer2_click"><a href="">Read about this cruise...</a><br><a href="">Enquire</a></div></div></div></div> <div> <div class="offers_region2"><a href="/fusion/gotocruise.pl?cid=%CTCID%&sid=6924">Grand Caribbean Adventurer</a></div> <div class="cruiseoffer2"> <div class="cruiseoffer2_col1"> <div class="offers_image2_box"> <div class="offers_image2"><img src="test.jpg"></div></div> <div class="cruiseoffer2_col1_logo"><img src="princess.gif"></div></div> <div class="cruiseoffer2_col2"> <div class="cruiseoffer2_depart"><a href="">Departs: 6th Feb 2010</a></div><br> <div class="cruiseoffer2_text"><a href=""><b>Ship:</b> Sea Princess</a><br><a href="" <a><b>Nights:</b> 15</a><br><a href=""><b>Price:</b> From £1580</a></div><br> <div class="cruiseoffer2_click"><a href="">Read about this cruise...</a><br><a href="">Enquire</a></div></div></div></div> <div></div>
  15. Hey guys Am trying something simple which isnt working how id expect it. I've got a container box with another box inside it, the containers height is not set so i assumed it would expand with the more boxes were inside it??? Here's the code: .deals_of_week {background-image:url(offers_region.gif);color:#000000;float:left;height:20px;padding:0px 0 0 5px;width:415px;background-repeat:no-repeat;margin-right:200px;} .deals_of_week_container {background-image:url(gocruise_offer_bg.gif);color:#FFFFFF;float:left;width:405px; border:0.5px solid;border-color:#dddddd;} .cruiseoffer2 {width:415px;height:190px;padding:10px;} .cruiseoffer2_col1 {width:205px;height:166px;float:left;} .cruiseoffer2_col1_logo {height:27px;width:90px;margin-top:10px;margin-left:50px;} .cruiseoffer2_col2 {width:167px;height:166px;float:left;display:inline;margin-left:10px;} .cruiseoffer2_depart {width:146px;height:16px;background-color:#ffED00;padding:6px;} .cruiseoffer2_depart a {color:#001883;font-family:'Lucida Grande',Arial,Helvetica,sans-serif;font-size:11px;font-weight:bold;text-decoration:none;} .cruiseoffer2_text a {color:#001883;font-family:'Lucida Grande',Arial,Helvetica,sans-serif;font-size:11px;text-decoration:none;} .cruiseoffer2_click a {color:#FF0000;font-family:'Lucida Grande',Arial,Helvetica,sans-serif;font-size:11px;font-weight:bold;text-decoration:none;} .cruisedetail2 {margin-bottom:5px;border-bottom:1px solid #FFD600;}
  16. Ok i think i was over complicating a simple problem, all i've done to fix it is duplicate the link rule and then add an ON to the name, then changed this on each page, i only have 5 pages so it wasnt needed to overthink it Thanks for your help! a.rollover { display: block; width: 98px; height: 20px; text-decoration: none; background: url("images/button.gif"); padding-top:5px; } a.rolloverON { display: block; width: 98px; height: 20px; text-decoration: none; background: url("images/button.gif"); padding-top:5px; background-position: -98px 0; } a.rollover:hover { background-position: -98px 0; } a.rollover:active { background-position: -98px 0; } Simple as that, then obviously on each page i changed which button used the new rolloverON class, simples
  17. Hey guys, i've got this rollover working but the client wants it to stay "down" when on the page they are currently on, this should work???? a.rollover { display: block; width: 98px; height: 20px; text-decoration: none; background: url("images/button.gif"); padding-top:5px; } a.rollover:hover { background-position: -98px 0; } a.rollover:active { background-position: -98px 0; }
  18. I'm getting an error Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /websites/123reg/LinuxPackage21/th/eb/oo/thebookhive.co.uk/public_html/aboutus.php on line 72
  19. AHHHH sorry i'd totally missed what you'd done, LIMIT cool beans! Cheers for that
  20. This right? <?php mysql_connect ("#","#"); @mysql_select_db("#") or die ("unable to connect"); $query = "SELECT * FROM events ORDER BY date DESC LIMIT4"; $result = mysql_query($query); mysql_close(); while ($a = mysql_fetch_array($query) && $ < 4) { $date = $a['date']; $title = $a['title']; $id = $a['id']; if(strlen($title) > 20){ $title = substr($title,0,20).'...';} print date("d.m.Y",strtotime("$date")); echo " <a href='eventitem.php?id=$id'>$title</a><br>"; } ?>
  21. Ok cool so i need to use an array? Hmm i really need to do some reading up on them. Cheers for helping amend the code, the only thing is, i also need to limit it to 4! :/
  22. Hi guys, am slowly finding my way into the php world. I've managed to build an events sidebar, that displays 4 entries from the events database and then links to a page displaying details. The only problem is, currently the code goes haywire if there's not 4 entries in the database? Is there a simple fix? <?php mysql_connect ("#","#"); @mysql_select_db("#") or die ("unable to connect"); $query = "SELECT * FROM events ORDER BY date DESC "; $result = mysql_query($query); $num = mysql_num_rows($result); mysql_close(); $i = 0; while ($i < 4) { $date = mysql_result($result,$i,"date"); $title = mysql_result($result,$i,"title"); $id = mysql_result($result,$i,"id"); if(strlen($title) > 20){ $title = substr($title,0,20).'...';} print date("d.m.Y",strtotime("$date")); echo " <a href='eventitem.php?id=$id'>$title</a><br>"; $i++; } ?> Cheers dudes! Chris
×
×
  • 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.