From: Jonathan A. <ja...@ce...> - 2002-10-16 21:15:59
|
Hello Matthew, On Wednesday, October 16, 2002, Matthew Hagerty wrote... >> $var = 'abc'; >> // some stuff here >> $var = 1; >> >> First line, $var is a string, second it is an integer. Languages I >> work with would have a field day with that unless declared as variants >> ;) >> > Well, PHP is a loosely typed language, so they allow you to get away > with changing the type of a variable on-the-fly. It does come in > handy, but it can also make things more confusing. The idea behind > the single letter prefix, outlined above, is to show the intent of > the variable, i.e. how the original programmer intended it to be > used and the type of data it should contain. I understand completely, doing software programming for a living, I find the use of prefixed variables quite useful, especially as our main product has 120 applications as part of it, and a lot of them use a shared global variable pool ;) >>> ignore_user_abort(TRUE); >> >> What does this one do? >> > ignore_user_abort(), without a long explanation, means that if the > user hits stop on their client, the PHP script still runs to > completion. Usually the script would stop execution if the user hits > stop, and that can be a bad thing when databases are involved, etc. > It can also mess up your session and/or state. And what happens in the event you accidentally create an infinite loop? ;) I think user_abort is a useful thing. >> I do agree 100% on this. Comments are your best friend in 2 months >> time ;) I've seen so many lines of code that I wrote myself, and >> wondered why the hell I did it like that ;) > Yup! I know what you mean, but for me it is usually with other > people's code (I'm a comment nut.) Same here, working with several developers, comments are a useful thing ;) It does help me if I forget what I was doing ;) I've also got used to my //@@@ to find where I was working, or if I am putting debugging code in... makes it easier to find than reading all the code again :) >>> o Use longer lines. I know, I know. I used to be an 80 character >>> advocate >> >> I use 800x600, and still have to wrap lines in my code, purely >> because some of the lines get a little long. Maybe consider >> wrapping at a certain point, and then indenting the wrapped lines >> so it is easier to see a wrapped line? > Well, there you go, didn't take long for someone to stand up and say > they still need the 80 character limit. ;-) Unfortunately I'm forced to work on a smaller resolution than I'd like because we still try and target our software for those using 640x480 (bleugh, boy am I glad they forced 800x600 in XP ;) ). >> I'm currently looking at the session code myself as there have been a >> couple of issues with merged session and user prefs caused by multiple >> logins on the same browser/computer. One of my theories in this would >> result in (maybe depending on others views) the cookies going away. >> I'd love to see your idea though. >> > Well, I've written a session/login module 5 times for various > projects over the last 3 or 4 years, so my latest is the best of all > that I have done and learned. It is a 100% PHP implementation and > designed to maintain sessions and logins. However, it is more than > just a module, it is also more of a framework for writing > applications with the MVC model and a template system (Smarty right > now.) I just have to add a logout function and I was planning on > releasing it to the open source community. It requires JavaScript > for the login because I use md5 on the client side to prevent > passwords from being passed in the clear. It does not require > cookies, but will use them if they are available. Could you send it over to me so I can take a look? >> I believe the devel team, once the core is nice and tidy, are going >> to be implementing a templating system. It is one of the things on >> the books of todo lists :) >> > Personally I believe Smarty is the best PHP based template system. It is > very flexible and extendable. I'm not sure on the system they have planned, but for some reason Smarty sounds familiar. -- Jonathan Angliss (ja...@ce...) |