Jump to content

Goose

Members
  • Posts

    78
  • Joined

  • Last visited

Everything posted by Goose

  1. That's exactly what I was looking for. Thanks!!!
  2. By default AddThis uses the current URL for liking, tweeting, bookmarking, etc.. If you are not using the current URL you must provide that parameter specifically when you make your AddThis links. See their support page here: http://www.addthis.com/help/url-and-title
  3. Sounds like a javascript problem, and I am guessing it has something to do with the IDs getting used more than once, or something along those lines.
  4. Lines 12 and 13 are the repeating lines. If you insert that code in between the curly brackets on line 11 and 14, those will repeat. It will look something like this: while($row = mysql_fetch_assoc($result)) { echo "Name: {$row['name']} <br>"; echo "Subject: {$row['title']} <br><br>"; ?> <a href="javascript:;" onclick="document.getElementById('<?php echo $row['id']; ?>').style.display='block'; window.open('http://www.google.co.uk');"><img src="../../graphics/Click here.png" border="0" /></a> <div id="<?php echo $row['id']; ?>" style="display:none;"> ...your text here </div> <?php }
  5. You should be able to replace the ..... with <?php echo $id; ?> Does that not work? Also, on line 8, which says "$id = $row{"id"};", that should look like this: $id = $row["id"]; You should use square braces when notating an array. Lastly, you are trying to store the value of $row['id'] into the variable $id, but when you are doing that assignment the variable $row is not defined yet.
  6. This solution isn't using regular expressions, but I think it might be quicker. If you are sure that you will have that pattern you showed above you can do this: $pos = strpos($yourString, ' '); if($pos !== false){ $yourNewString = substr($yourString, $pos + 1); }
  7. I am working on a website that depends on a complex cookie being set. In an effort to fix problems before they become big problems, I want to monitor that the cookie is getting set correctly with a cron job. I can setup the cron job just fine, but I can't figure out how to get the value of the cookie. By visiting the main site the cookie is set automatically, and I've also made a special script on that server that only gets me that cookie value and spits it out. I am trying to use cURL to call the main page, and then right after that, call the get-cookie.php page which should then have cookie data to display. Here is how I am trying to do it now: <?php $c = curl_init(); // making the initial call to the real website curl_setopt($c, CURLOPT_URL, 'http://domain.com'); curl_setopt($c, CURLOPT_HEADER, false); curl_exec($c); curl_close($c); $c = curl_init(); // now making a call to the script that spits out the cookie curl_setopt($c, CURLOPT_RETURNTRANSFER, true); curl_setopt($c, CURLOPT_URL, 'http://domain.com/get-cookie.php'); curl_setopt($c, CURLOPT_HEADER, false); $output = curl_exec($c); curl_close($c); echo 'output: ' . $output . "\n\n"; ?> I've tried a few different things here, but so far no luck. Anyone have any ideas on how I can make this work? Thanks so much!
  8. Well, after doing some more research I found this awesome JavaScript library that does exactly this: http://cufon.shoqolate.com/generate/
  9. I was hoping that there would be a way to do it in PHP, as I don't want to enable the shell() command on my server, but if no one can think of a way, I may have to do that.
  10. Have you tried the fputcsv function? All you have to do is pass in a file handler and an array of data and it should be good to go.
  11. I would like to dynamically generate text filled in with a gradient using some graphics library. Currently I've gotten Image Magick to do most of what I want (using non-standard fonts, centering, etc.) but I still haven't figured out the gradient part. Does anyone know how to make Image Magick fill the text with a gradient color or know of another library I can do this with? Thanks! <?php $canvas = new Imagick(); $text = $_GET['text']; if(empty($text)){ $text = "Unknown"; } // sanitize, remove non-words and non-spaces $text = preg_replace("/[^\S ]/","", $text); $draw = new ImagickDraw(); // set font $draw->setFont("DejaVuSerif.ttf"); $draw->setFontSize(32); $draw->setFillColor('#ffffff'); // center the $draw object $draw->setGravity(Imagick::GRAVITY_CENTER); $canvas->newImage(400,50, 'none'); // draw the text onto the canvas $canvas->annotateImage($draw, 0, 0, 0, $text); // png is 1337 $canvas->setImageFormat('png'); header("Content-Type: image/png"); echo $canvas; ?> When I call this script passing in the phrase "this is a test", I get the following image:
  12. Cool, well that is all great information. I will try using sessions instead. If anyone can point me to a good tutorial (I haven't looked yet, but will do the regulars (check php freaks and google)), that would be awesome. Thanks again all.
  13. Great information. I hope some more people post their thoughts.
  14. Not sure I completely follow what you are saying here, but thanks for your input. Would love more input on the subject.
  15. I am not really looking for a definitive answer here, but just people's opinions. For the longest time I have written PHP login systems that use cookies to store the login "session". Now, I am wondering if this isn't the best method. What do you guys think? What methods do you use and why? I am assuming people are using some combination of cookies, sessions and/or MySQL. My criteria for login is most importantly, security followed by utility (i.e. can keep a user logged in for longer than their browser is open, or can store other account information). Thanks ahead of time. P.S. If your best choice uses some special implementation I would love to know more details about that.
  16. Here is my situation: var myString = 'this is the right string'; obj.onmouseover = function(e) { showTip(e, 'this is the wrong string'); }; Since the onmouseover function can't see the myString variable, due to scope, I am unable to pass the contents of myString to the function. I thought I would try a global variable, but since the function that does this will get called multiple times it will only use the last value that the global variable was set to. Is there a way to pass multiple arguments into the onmouseover function? I know this is incorrect, but something like this: var myString = 'this is the right string'; obj.onmouseover = function(e, myString) { showTip(e, myString); }; Thanks much.
  17. So in the change_title() function you want to say something like document.getElementById('title').value = document.getElementById('select2').value;
  18. kamsmartx I don't quite follow what you are asking here. If you have a JavaScript object, lets cal it obj. // this changes the value of the object obj.value = 'a new value'; You can also but the above code into some sort of function and add an event listener to your list. Something like this: <input id="list" onchange="yourFunction();" /> Hopefully this helps, if not, please try and re-ask your question. Or maybe someone else gets it
  19. O figured it out obj.onmouseover = function(e){showTip(e, 'Some random text.')} This allows me to pass the event and another argument into the showTip function.
  20. <script type="text/javascript"> function makePass(obj){ obj.value = ''; obj.type = 'password'; } </script> <input type="text" onfocus="makePass(this);" value="enter password" /></input> So, basically what I did was bind the function makePass() to the focus event on the element. Meaning that when the user puts their cursor over the field and clicks on it, the event is called. The function then simply takes the calling object and changes the value and the type. Enjoy.
  21. Is there a way to also pass in the event handler with this method?
  22. Interesting... I didn't know that I could make my own attributes. I think I will explore that option. I know that the second option won't really work because I am dynamically creating the object. I will let you all know how it works out.
  23. Basically I have some code in Javascript that looks like this: ... obj.onmouseover = showTooltip; obj.onmouseout = hideTooltip; ... When I am doing this, is there a way to pass in an argument to the showTooltip function? I know that when the showTooltip function actually gets called it has the object that called it, which can be accessed by the reference this. I know this is illegal and won't run, but I want to do something like this: ... obj.onmouseover = showTooltip('Some random text.'); obj.onmouseout = hideTooltip; ... Thanks so much!
×
×
  • 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.