Daniel0
Staff Alumni-
Posts
11,885 -
Joined
-
Last visited
Everything posted by Daniel0
-
A question about using a text file as a PHP Array.
Daniel0 replied to cuboidgraphix's topic in PHP Coding Help
Yes. The function file() returns an array with every line of the file having an index in the array. -
It seems that you're aren't passing any data to the get_leadactor() and get_leaddirector() functions. The $movie_leadactor and $movie_director variables are never set within the while loop. Only on non-integer values, which an ID probably isn't.
-
The way I do it is to have a couple of naming conventions and folder structure conventions. If we say that all classes are placed in library, then the class PHPFreaks_Auth_Plugin_SMF would be in library/PHPFreaks/Auth/Plugin/SMF.php. That makes the __autoload() function very simple: <?php function __autoload($className) { require_once 'library' . DIRECTORY_SEPARATOR . str_replace('_', DIRECTORY_SEPARATOR, $className) . '.php'; } ?>
-
I don't think that's particularly small. If you're having trouble reading it you could always increase the text size in your browser. We don't use FTP
-
Indeed. And nobody is mocking you for that. When fenway asked "Where is the join?", it was a pointer to where the JOIN statement where. You could've then look at your query and you would've seen that there was no such thing. fenway's question also implied that there should be a such thing in the query. All you did however, was to respond in a harsh manner which would hardly trigger any further help. Also, please refrain from posting multiple posts after each other. I believe you say it yourself:
-
What are you? Like 10 years old? There is only a single person on this site who outrank me (the site owner, who by the way seldom interfere with any issue), so I am in my fullest right to respond and judge the situation, and I know fenway as being quite capable in regards to databases. On a related sidenote: This text might be useful for your further learning: "The Allegory of the Cave" by Plato.
-
Sure you're going to die. It's just a matter of when and how
-
@stuart7398: Do you know who Socrates was? He was a philosopher in the ancient Greece. He believed that by asking the right questions, the learner would come to the answer themselves. This is called maieutics. He also believed that one could not "get" knowledge, they'd have to learn it themselves. They could however be helped using maieutics. He believed that every individual had the knowledge within themselves, but it was only a matter of asking the right questions to get the learner to find the solution/answer himself instead of just giving it to him - otherwise he'd learn nothing. Bringing this into context, fenway is asking a question for you to find the answer yourself. He guided you towards the answer. He is thereby helping you by not just giving you the solution although it might take a little more effort from your side. I think fenway did the right thing here and I'd appreciate if you show respect to high ranking and respected members (and just any member in general) so that you yourself may be respected in return.
-
You can see the operator precedence here: http://php.net/manual/en/language.operators.php#language.operators.precedence How you're doing it is perfectly fine though and probably how I would do it as well.
-
That's not particularly secure, it's just creating additional overhead.
-
If you run that on a GIF file then it'll obviously break. Use a different function depending on whether it JPEG, GIF or PNG.
-
<?php echo '<table>'; foreach ($array as $subArray) { echo '<tr>'; foreach ($subArray as $item) { echo "<td>{$item}</td>"; } echo '</tr>'; } echo '</table>'; ?>
-
[SOLVED] problem line breaking inside message of mail function
Daniel0 replied to kts's topic in PHP Coding Help
Make sure you're using strings with double quotes, otherwise they will be treated as a literal backslash followed by an n. -
As I said... anchors do not have a "value". The code Zhadus provided you with works.
-
You can use tools like GeoIP to figure that out.
-
Anchors cannot have a value. You can use the title attribute instead though.
-
Please don't double post. Locked.
-
That sounds strange. I've yet to see a VPS where you aren't root.
-
Just purchase a VPS or dedicated server. In that way you'll have root access to the server. You could use ServerPowered which is owned by the same guy that owns PHP Freaks.
-
In PHP it is. In the code you provided there are thrown no exceptions whatsoever. Try to read the manual again and you'll find I'm right. I see you do Java as well, and yeah, with Java, exceptions and run-time errors are the same thing, but that doesn't mean every single language does that. In PHP there is a distinction between errors and exceptions.
-
Firefox has some extensions called "Tamper Data" and "Switch User Agent" (not sure if I got the name right here). They might be of help.
-
Building an efficient PHP framework/modular structure - how??
Daniel0 replied to LemonInflux's topic in Application Design
Ok... let me try to rephrase that... [user Request] | | v Frontcontroller <-------> Router | | v PageController <-----> Model | | v View So first the user makes a request. Information about the request is sent to the front controller which delegates various tasks to other classes such as the router class. The router class' task would here be to extract information from the URL that is required in order for the front controller to call the right page controller. So if we follow a convention of /controller/action, /users/list would go to the users controller, and the list action (i.e. something like UsersController::listAction()). The router would pass this information back to the front controller and the front controller would then create a new instance of UsersController and then call the listAction(). Upon instantiation of the page controller object, the front controller could possibly also forward various information. That could for instance be any parameters (e.g. if the URL had been /user/view/1, the 1 could have been a parameter, a user id). The page controller then calls the model which would get the list of all users, and the page controller would then give the view that information. The view then figures out how to make this data, which came from the model via the page controller, into whatever way the user is supposed to see it. That's how the MVC pattern and Front Controller pattern often works together. -
Building an efficient PHP framework/modular structure - how??
Daniel0 replied to LemonInflux's topic in Application Design
The MVC pattern often goes along with the front controller pattern. You'd have the front controller as an intermediate between the user request and the page controller, so it is the one which is responsible for picking the right page controller and call the right method in that controller. Sometimes, parsing the URL is delegated to a routing class which would for instance turn /profile/Daniel0 into information needed to pick the right controller (e.g. "UsersController") and the right method within that (e.g. "UsersController::profileAction()") as well as any parameters specified in the URL. The routes could be a combination of default routes and specialized/custom routes like the previous example. -
The ever returning question... It's funny how people wish to restrict people from viewing something when viewing is necessary to the functionality. My usual analogy used in this instance is that you cannot read a book which is in the room next to you, it has to be where you are. Likewise does the content has to be downloaded to the user's computer before it can be displayed to them.