Archive for the ‘ PHP ’ Category
PHP allows you to write functions similarly to the way functions are written in other languages. Functions in PHP provide the same advantages that they provide in other languages also. Functions provide a way to encapsulate a block of code so it can be reused as often as needed. This allows you to avoid rewriting the same blocks of code over again. Which makes your job easier by writing less code. This also keeps your from having to write similar or the same block of code more than once.
You may find that you have a problem with special characters not displaying or showing up as a small black diamond with a ? in the center. Here’s a quick fix seems to work well.
These would be characters like: <, > and &. It also includes characters like: é,?, ø and the curly quotation marks.
At the point you are printing these characters into a page you’ll want to run them through the php htmlentities function. Here’s an example:
htmlentities( $str, ENT_COMPAT, 'Windows-1252' );
Where $str would be any string you wanted to convert to compatible characters.
For more info: http://www.php.net/manual/en/function.htmlentities.php
Here’s an app I thought up the Firday. I managed to “finish” it up after dinner Friday and and with a few spare hours Saturday. I put finished in quotes, because it’s not really finished. There’s a still a lot to do. I did manage to mock up the basic ideas and get them all working.
http://newmedia.academyart.edu/~mhudson/doodle/
So what’s the idea anyway? Anyone can make a user account, login and create a small drawing, and then list all of the drawings that have been created. My idea was to create a sort of Twitter for the visual set. Instead of typing a short message of the moment. You can draw a small picture of the moment, and post it for everyone to view.
The basic functionality works now, but to make this really useful will require more features. At this point you are viewing all of the drawings in the database. The real idea is to show only drawings from people that you feel like seeing.
Here’s a great tutorial on making your own WordPress themes. Very detailed with a lot of good information.