-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
I don't see the connection between appending and show()ing the next sibling?
-
If you just want to strip out HTML comments, you can use this: $str = preg_replace('/<!--.*?-->/s', '', $str);
-
What event are you using to trigger the function? In which browser (or all of them) down it not work? What's the code behind "is_key()"?
-
I recommend Adobe Kuler for that.
-
Okay had a play around and got a similar case working using an output buffer: header('Content-Type: image/gif'); ob_start(); passthru('convert test.jpg gif:-'); $output = ob_get_contents(); ob_end_clean(); echo $output; I'm not convinced it's the best way to do it, and someone may have a better suggestion, but it's all I could get working at the moment.
-
What does a var_dump of $output return? Being binary, you won't be able to just have line-feeds in the middle.. although I'm not sure why it would be split in the first place. Perhaps there's other stuff being returned with the binary..? Just a guess though. I'll try to recreate the issue here and see what I can find.
-
Ah, course: RewriteEngine on RewriteRule ^([a-z0-9]+)$ profile.php?username=$1 [L] Forgot the parentheses that create the back reference to the username.
-
It should work. Can you post a print_r of $_GET?
-
If you can wait a day or two I can help you get it working? I'm at work right now though and don't have the time.
-
You're not defining the variables n, c, cv, or e anywhere. Instead of giving them an ID each and using getElementById to return the element object though, use the DOM tree to access them. You can even use a with structure to prevent much modification to your code: with (document.form1) { if (n.value=="") { alert('please enter your name') } // ... } On a side-note you're calling the function "check()" only when the user clicks the submit button. How many times do you press Enter on the last field, or tab to the button and press Enter, to submit? Instead of assigning it to the click event of the button, assign it to the submit event of the form. That will call the function no matter how they submit the form.
-
The code I provided is an event, executed after the page has finished loading. If you want to run the code as the HTML is generated, just place it within script tags at the bottom of the page.
-
Ha.. I agree. I've only tried replying to forum posts on here before with small bits of code, and it's not a pleasant experience. More frustrating than anything else. It's not the display that's the problem, it's that the keyboard is so limited!
-
You can execute code after the page has loaded, using this inside the <head>: <script type="text/javascript"> window.onload = function() { // code to execute here } </script> That will bind the code contained within the anonymous function to the "onload" event of the window. Although this approach seems pretty odd. If you're altering the content after the page has loaded, why not just modify it at the source? Wouldn't that be easier than trying to manipulate the code with JS afterwards? If you do decide to go ahead for whatever reason, then you should look into the children property of an object. That will provide a collection of children objects that you can traverse through to find your target points to insert the additional mark-up. Here's a few links that should help you get going: https://developer.mozilla.org/en/document.getElementById https://developer.mozilla.org/en/DOM/element.children https://developer.mozilla.org/En/InsertBefore Be aware that not all the functions on the MDC site will work with other browsers (namely IE) - you need to test in different browsers to ensure your code is cross-browser compatible.
-
Let PHP do the work or let JavaScript do the work?
Adam replied to unemployment's topic in Application Design
You have that wrong. I work in an enterprise-level company; first and foremost concern (for this kind of issue) is that the functionality will work for every user, regardless of their browser. This means for any JS solution you would have to provide a PHP solution anyway. There's also a time issue in companies like mine, so if a combined PHP & JS implementation would take too long it simply wouldn't be a requirement (unless specifically requested). Of course performance is an issue, but with internal core processes where the performance would have a large impact. -
This unexpected behaviour is documented in the manual (example #3).
-
The holiday come-down! Glad to see you back anyway..
-
The email's in HTML entities. Just run it through html_entity_decode first. As for matching new-lines, you can add the 's' modifier after the last percent: [...] {1,}/.$%s Edit: Actually if the email string is split over multiple lines, you might want to first remove line-breaks, using similar to: $string = str_replace(array("\n", "\r"), '', $string); .. As the 's' modifier will allow only the dot character to match over multiple-lines.
-
You need to use mod_rewrite to internally rewrite the URL. While the user sees "domain.com/username", it's actually pointing to "domain.com/profile.php?username=username". This is actually quite a common request, and the very basic rewrite rule would be: RewriteEngine on RewriteRule ^[a-z0-9]+$ profile.php?username=$1 [L] Be sure to modify the regex to allow whatever characters/format your usernames are made up of.
-
You're missing echo/print.
-
From the forum guild-lines: "5. Users will post relevant code and information to their question(s)" You have posted several hundred lines of code and expected us to look through it line-by-line. Can you please re-think your question? Only post the relevant code with an explanation of what the differences are and a better description of the overall problem. You don't have to of course, but you will receive better help a lot faster.
-
Using link in child window to write to textbox in parent window
Adam replied to JLitkie's topic in Javascript Help
You've not really explained what's not working. Do you receive an error? What does the HTML look like after it's been processed? I.e. what's the source of the child window? If there's a line-break or single/double-quote in $row[1] then it'll be generating a JavaScript error, in which case would explain why it's not working. -
php inside of div tag not passing value to parent page
Adam replied to CyberGuru's topic in Javascript Help
If the function isn't defined then it's either out of scope for the content within the DIV, or you're not correctly including it. All we can see is the definition of the function, which doesn't explain why it's not working with the rest of the page. Can you post the whole source? -
I think if there was a dedicated forum for this kind of thing then it would just end up inactive after a short while. It's been interesting and got people involved this time, but I think that's purely down to the fact that it's rare.. Like Christmas. Have that everyday and the novelty would soon ware out. Perhaps creating the odd thread here and there in Misc. would be better?