-
Posts
5,717 -
Joined
-
Last visited
-
Days Won
6
Everything posted by Adam
-
What mark-up are you working with? Adding an element to an array is easy, but for the rest it's a lot easier for us if we have an understanding of the HTML structure.
-
javascript/jquery detect user scroll 200px from bottom of page
Adam replied to shortysbest's topic in Javascript Help
Almost there. You just forgot to subtract the target distance from the bottom, from the height of the document: [...] >= $(document).height() - 200) { Also I change the operator to "more than or equal" - as you most likely won't hit the 200px mark exactly. Once this expression evaluates to true I'd also .unbind() the event, so the browser doesn't try loading the comments multiple times. -
Can you show us the name input?
-
This isn't the case here, as he's using the append operator "+=" and not the standard assignment operator "=". The file inputs shown in the screen-shot are obviously not standard and have something running in the background to provide that behaviour. I think the problem here is down to another script running on the page; perhaps when you add another input it's reset or something? What code are you using?
-
JavaScript Not Working on Localhost Wordpress Installation
Adam replied to chaseman's topic in Javascript Help
Okay great stuff. JavaScript can be quite temperamental sometimes, and it's not always obvious why. -
I don't want to test the limits myself, but are you aware Google requests Captcha verification if you spam it? Being behind a proxy we sometimes get it at work..
-
Just starting out.. How much should I charge for a PHP web applications site?
Adam replied to sandpc's topic in Miscellaneous
I don't think you should base your prices on what some of the freelancers here would charge. As you said, you're learning as you go which puts you in a different position. Does the client know that, as current, you aren't able to do what you're saying you will do? -
... Though by the 90s retro looks of geedoo.com, convincing the owner to sell it might not be difficult.
-
The problem is you're blindly trying to return rows from a MySQLi result resource, that isn't actually a result resource -- i.e. the query has an error. $r = @mysqli_query ($dbc,$q); mysqli_query() never actually throws a PHP error, so there's no use in the "@" to suppress errors. However you should handle the error here and throw one yourself: $r = mysqli_query($dbc, $q) or trigger_error('MySQLi Error: ' . mysqli_error()); That will tell you why the query is failing. Obviously you'll fix any errors before pushing to a production server (where display_errors should be turned off anyway), so it should never throw an error the user will see.
-
No worries. Unusual use of a closure by the way, did you write that yourself?
-
JavaScript Not Working on Localhost Wordpress Installation
Adam replied to chaseman's topic in Javascript Help
Do you receive any JS errors as you try? There should be an error console for your browser (for FF you can press Ctrl+Shift+J). -
It works for me without the alert. What browser are you testing with?
-
Ha.. right click and view the source, then copy from there. That will preserve the formatting..
-
Could you post it again within tags?
-
If you have lots of functions requiring the same data - and so presumably are related in what they do - you should consider an object-orientated approach. That way you need only pass it to the constructor method, and you can have it available throughout the object.
-
I'd guess that there are no children nodes of $post, so the children() method doesn't return an object. Use var_dump to view what $post contains, and post here if you're unsure.
-
Yeah, and I think the 'junk' values are just what it will be using as it tests the forms - doesn't necessarily mean it's open to SQL injections.
-
*Shudder* MSN avatar.. frames. Really? I posted this before, but what exactly are you after? You keep going away and re-designing, then asking for more feedback on something that.. from what I can tell it's still in its infancy (and you'll probably scrap in a few weeks). Links in the header don't work, parts of the website seem to be in your older design, bugs scattered about. It feels very unusable still. Is this really a BETA stage project? As thorpe also pointed out, this is for critiques of the design, not BETA testing which is what you seem to want.
-
No include or require statement REQUIRES an absolute path. Also, you can't add get parameters to an include file like you showed. Parameters like that are a part of the HTTP protocol, which isn't used when including internal files. Any GET parameters that are passed to the originally requested file are available within the included file too. So if you request "foo.php?str=Hello", then include a file, $_GET['str'] is available within the included file too. So are normal variables you define within the parent file.
-
You could tarball the files you need to upload first, and then extract them in place. That would cut out the transfer rate issues. Although you should really perform roll-outs late at night, or when usage is at it's lowest to prevent issues like this. If that's not possible, then you should consider putting the site into 'down for maintenance' state, with permits access for yourself, so that you can test the updates are okay and you don't need to roll-back the files.
-
What's the problem with it?
-
Yeah, pass the data into whatever class or function it's needed as a parameter.
-
Okay - I assume you use a relative path to include this file originally? I would decide whether you actually need any complex logic to include files - is your file structure that complex you can't just use simple relative paths to include everything? If so.. In PHP you can configure the 'include path' used by the include/require control statements. You can also set multiple include paths it will use to attempt to include the file, in the order they're stored. By default these are generally the current directory, followed by the root directory of your website - though this may not be the case on a development server you've set-up yourself, in which case it's generally the document root. Better than creating a variable, that you would have to add to all your includes, would be to configure this include path so that it automatically checks a certain directory so that you don't need to add anything manually. If the path of all your PHP files that you want to include is the same as your config file, you can use this code: set_include_path( get_include_path() . PATH_SEPARATOR . dirname(__FILE__) ); That will set the include path as the already set include path, but amend it with the directory name (and path) of the special __FILE__ constant, which stores the file path of the current executing file. As I said that will only work if the PHP files you wish to include are within the same, or sub-directories of, the directory in which the config file is. If that's not the case you can add a relative path, based on the config file's directory, to set it to what you want. For example, assume you have the following file structure (config is separate from the PHP purposefully): You would want to set the include path as the "php/" directory, however you always run the config file from "config/" - it's a bit of a stupid set-up in that regard, but it's just as an example. In that case you could use the following code: $include_path = dirname(__FILE__); $include_path = realpath($include_path . '../php'); set_include_path( get_include_path() . PATH_SEPARATOR . $include_path ); That does almost the same as before, except adds in an extra part which makes use of realpath - which can return the absolute path for any relative path you give it. In this case we add the relative path to the PHP directory from the config file, which will give us our absolute path. So whichever way you set the include path, now you should be able to just include files from any location like: include 'file-i-want-to-include.php'; Don't be put off by how much I've ranted about this, it's extremely simple once you know what you're on about.
-
Removed? In the code you posted before there wasn't a closing bracket after the foreach expression..? Should be: foreach ($errors as $msg) {
-
No, the URL path refers to "http://example.com/..." It's the public - "document" - root from where users can request files. The server path is the internal path, like for example on a *nix machine it could be "/var/www/example.com/...", or on Windows "C:\Program Files\Apache\www\example.com\..." or something along those lines. Absolute just means from the root , the base, point of the path. A relative URL/path means from the current location.. I.e. "../path" means go up a directory, and "./path" means from the current directory. Using those you can set the path to any point on the server, but it's from a relative position. Edit Sorry to actually answer your question, you can set the include path PHP uses to include files. What's the structure like of your files? Do you have a config or header type file you include to set the $site_url variable you mentioned?