-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
is_file will check if the file exists on the server, nothing related to the current file in your array. You need to compare it directly: if (basename($PImg) != 'thumbnail.jpg') { // ... } Though if you plan on expanding this list, you might want to create an array of exceptions and then check the current file in your loop is not within the exceptions array: $exceptions = array( 'thumbnail.jpg', 'another-file.jpg' ); [...] if (!in_array(basename($PImg), $exceptions)) { // ... } Edit Define your exceptions array before the loop by the way.
-
Download works... following web page never appears
Adam replied to jhsachs's topic in PHP Coding Help
Ah apologies for that. I haven't used the META refresh tag for a long time. You could try using a JavaScript redirect, but I'm not sure if that would trigger the same sort of messages? I don't have IE8 on my work computer, but you can test it yourself: window.onload = function() { // Redirect to download file after page has finished loading location.href = 'path/to/file.ext'; } Again I would include a hard link just in-case. -
Download works... following web page never appears
Adam replied to jhsachs's topic in PHP Coding Help
Just to clarify: headers are sent before/ahead of the output. Once the first byte of output is sent, that triggers PHP to first send the headers. So obviously after that point the headers have been sent and you can't send any more. Think of it like a HTML document structure, you can't have a second <head> embedded within the <body>. In order to achieve what you're after, you need to first take the user to the success/confirmation type page, and then fire off a second request (meta redirect, with hard link to be sure) to the file. The browser won't redirect away from the current page, but the download will start (or a pop-up asking what the user wants to do). If you make the redirect instant it should have just finished loading the page when the download starts. Does that explain it better? -
Download works... following web page never appears
Adam replied to jhsachs's topic in PHP Coding Help
I'm not sure if you're confused with MIME headers, but browsers can/will only read a single HTTP response content-type header. Currently you're trying to send "application/octet-stream", followed by HTML which would need "text/html" -- I'm guessing anyway, you haven't shown much of your code. This means you need to have separate requests for downloading the file and displaying the page, so that you can send separate responses back. You will need to display the page first though, because you can't return a location header (redirect after download) with a message-body. Then you need to request the file for download, which you can use a meta refresh tag to make the process seem instant (though I would include a hard link to the file just to be sure). -
I should image most FTP clients will automatically determine the right transfer method, but if you've accidentally set it to ASCII always, then that could be the cause of the issue.
-
Are you transferring the file via ASCII or binary?
-
What do you mean it doesn't work? It works in your example when you add $this to the geta() call..?
-
Yup, as long as "A" is an object with a public method called "a()", there's no problem.
-
You need to call internal class methods using the special $this var: public function getafoo(){ return $this->geta(); }
-
hover() accepts two call backs, one for mouseover and one for mouseout. You need to call the toggle function in each: $(document).ready(function(){ $('.SubFade').hover(function(){ $('.subMenuContainer').toggle(2000); }, function() { $('.subMenuContainer').toggle(2000); }); });
-
Use toggle() instead then - that automatically switches the CSS display style and detects the current state.
-
With just the jQuery core (UI not required), you can use the show() method with a delay passed in to achieve the fade effect you're after.
-
No, try reading it for longer. I read your post in five seconds so I have no idea what you're trying to do, but I very much doubt what you just said is true.
-
While I get the point, those comparisons were awful. One poops? My point was that they both ultimately achieve the same thing, where as JS and PHP do not. You could have put anything in there...
-
Well to be fair, they would be comparable. They both do the same thing really..
-
Can you show us your .htaccess file?
-
What kind of JOIN? What other table? Which columns are related?
-
Your while condition above is to keep looping "while $row = a row from the database". So when the while loop has finished, it's because mysql_fetch_array has returned null because there are no more rows, subsequently meaning that $row now contains null.. So basically what you're getting back is correct.
-
I would pass the ISO 693-1 standard locale code into each URL, at the base though. For example: mywebsite.com/en/posts/21 mywebsite.com/fr/posts/21 Passing it at the base would mean it's in a constant place and allow you to apply a preliminary rewrite rule before any others, meaning you wouldn't have to factor it into every other rule. Passing the locale on every page means that no search engine will be unable to differentiate between the pages, because to the best of my current knowledge GoogleBot doesn't accept cookies.
-
Only Internet Explorer supports custom coloured scroll bars, and I'm not sure if that's even still the case in later versions. Personally I would advise using a custom JavaScript scroll bar instead. A decent one though.. Rubbish ones wreck usability!
-
Be sure to protect yourself against XSS using htmlspecialchars.
-
When there's multiple matches with a selector, an array of raw DOM objects is returned -- you can tell they're the raw object because you have to pass them through the jQuery 'constructor' again within the handler. So $('.notificon')[0] would equate to the first DOM object in the array, which explains why it worked for the first icon only. You were on the right track using the each iterator, but the logical problem is if it's say the second notification that was clicked, when the first notification was checked first it wouldn't be equal to the event target and so the pop-up would be hidden immediately. So before you call .hide() you need to have checked each object, which would be best done with a simple flag: $(document).click(function(event) { var match = false; $(".notificon").each(function(i, obj) { if (obj == event.target) { match = true; } }); if (!match) { $('.newslist').hide(); } }); Question that comes to mind though, is that do these icons all trigger the same pop-up? If so this wouldn't really be the best method to do it. I would suggest checking for a shared class within the event target: if (!$(event.target).hasClass('notificon')) { $('.newslist').hide(); } Might have been the best method anyway thinking about it! Also I've just realised the pop-up would be hidden even if you clicked the actual pop-up, so need to add a further check: var target = $(event.target); if (!target.hasClass('notificon') && !target.hasClass('newslist')) { $('.newslist').hide(); } Sorted!
-
Is compressed code considered "source code" for licensing purposes?
Adam replied to jhsachs's topic in Javascript Help
Remember that they're quite likely to be using a generic license that's been written to suit the needs of software written in no specific language. Chances are it's just a loose term to describe the code as it's executed. Usually "source" means the un-compiled / unencrypted plain-text programming behind the software, but you need to give more information on your actual product for us to say whether you'd be breaking the terms of the license on the distribution side of things. On a side-note, the V8 JavaScript engine written by Google and used in Chrome, compiles JavaScript before executing it. That's the only use of "binary JavaScript" I know off the top of my head - I'm sure Google would reveal all. -
You don't want to bind a click event to virtually every single element in the document, you should bind it to the document itself: $(document).click(function() { ... }); That will be far more efficient during the bind. You can then use the event object's target property, which will contain a DOM object of the element clicked, in a comparison with itself: $(document).click(function(event) { if ($('#id_of_icon')[0] != event.target) { $('.list').hide(); } else { $('.list').show(); } }); The [0] is included there so that we compare the raw DOM object, instead of the jQuery wrapper object.
-
Can you check the output from phpinfo and check if you have the mod_rewrite module enabled?