Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
Well, in addition to providing you with new functionality, e.g. making you able to perform array specific operations on objects, there are also several benefits in using the SPL. See for instance: http://blueparabola.com/blog/spl-deserves-some-reiteration. That blog post finds that the SPL is actually faster than using traditional array approaches, and in some cases much faster.
-
You could add an event handler to onload and write a function in Javascript that resets the form. I would be careful with that though. People might have entered something wrong and want to go back to correct it. It might be annoying for them if they have to start over. So perhaps it would be better to have a reset button that triggers the aforementioned resetting function.
-
If you really want to do this then I would still stick with one database, and in that database create a table called e.g. sites with the following fields: site_id - unsigned int, auto increment, primary key domain - varchar Now, assuming you're using Apache, have a virtual host setup like this: <VirtualHost *:80> ServerAdmin [email protected] ServerName base.yoursite.com ServerAlias www.example.com example.com www.somethingelse.com somethingelse.com # all your domains DocumentRoot /var/www/htdocs RewriteEngine on RewriteCond %{REQUEST_FILENAME} !-f RewriteRule .* index.php [L] <Directory /var/www/htdocs> Order allow,deny Allow from all Options -Indexes </Directory> # [...] </VirtualHost> Now use $_SERVER['HTTP_HOST'] to determine which site it is, and the request you can get the request through $_SERVER['REQUEST_URI']. So if we make the request http://www.example.com/user/login then you'll have: HTTP_HOST = www.example.com REQUEST_URI = /user/login Now, also have a field called site_id in your settings, users, etc. tables - where ever it is relevant to distinguish between the different sites. Yes, but I don't think it's the best solution (see below). The above should accomplish that. It should be entirely transparent to the user. I'm not sure, but seeing as they all run on the same server, if one site takes a lot of resources then it'll negatively effect the other sites. Doing a setup like this will make it difficult to move one server to another place seeing as they're all tied together. Querying the database on each request isn't a problem. Most dynamic sites, including this one, have several queries on every single page. Another solution could be using version control like SVN, git, or Mercurial (in fact, I'd recommend it regardless). Then you can simply do a checkout on the individual setups, and you could write a shell script that will run the update command on each setup. In relation to this you could also use something like Phing to automatically handle database schema changes. Here you would want to have a separate database for each site. This setup is more advanced and requires some sysadmin skills, but I think this would be better in the long run seeing as it is much more scalable. Using this setup it would require minimal effort to move sites to different servers should that be necessary. You could even create a shell script that would make it easy to deploy an entirely new site (or of course, use Phing to this as well).
-
http://www.phpfreaks.com/tutorial/sessions-and-cookies-adding-state-to-a-stateless-protocol
-
[SOLVED] Administrative Images
Daniel0 replied to The Little Guy's topic in PHPFreaks.com Website Feedback
No you cannot. -
round doesn't preserve the exact amount of decimals you specify, so round(12.012, 1) returns 12 exactly the way you want it to.
-
You could say that it forwards PHP pages to the PHP interpreter and that it then outputs whatever PHP tells it to, yes.
-
Well, you're right, they aren't. Assembly, C, Haskell, ML, Lisp, Scheme, Prolog, etc. are all languages without an object model. "Not necessary" is not the same as "not useful" though.
-
Well, you also need a stronger signal to send a response back again. Otherwise it's practically useless.
-
... It's just requesting your index page.
-
http://web.archive.org/web/20080209154336/http://www.phpit.net/article/simple-mvc-php5/
-
Though I prefer to leave them for consistency and readability.
-
Plus you'll look like a fool and people will ignore you. It's counter-productive.
-
Except you'll only get the filename and not the path that way.
-
I'd recommend a flamethrower.
-
Try this one for C: http://publications.gbdirect.co.uk/c_book/
-
There are many ways you could do that. The simplest would probably be to award points for certain actions and then upgrade people's levels when they hit X points.
-
Theoretically speaking, you can create anything using any program.
-
Fixed. Unless you serve it as application/xhtml+xml it'll de jure get parsed and interpreted as HTML by the browsers anyway, but if you serve it as such then you'll cut off all IE users.
-
I believe this is often the case. There have been some problems presented in some topics that I genuinely found interesting, and that made me research the topic and sometimes write small scripts that I thought were pretty neat.
-
It returns a value just like all other methods/functions do. You need to store that return value somewhere, e.g. $username = $profile->retrieve_username($userid); echo $username; You need to lookup the word "scope" in the manual.
-
You may call me picky, and I do recognize that this doesn't address your question, but Adobe is a company and they make a product called Adobe Flash Professional. Adobe would indeed be too expensive to purchase unless you're insanely rich; it's probably worth several billions of dollars.
-
Seems like it's stored in the db.
-
What distro are you using? Why don't you use your distro's package manager instead of choosing a third-party bundle?