PHP Code to Include Content in Layout
When I didn’t know PHP I spent a lot of time trying to find the coveted script that would allow me to include content in a page by including a page so that I could change the layout and it would remain the same for all pages, only the content would change. I of course didn’t want to use an iframe because these scroll and look hideous. The solution I found, but did not understand for several months later. When a bit later I lost this code I realized it was time for me to learn PHP. The code I wished to know was the code that allows you to include pages with content like http://example.com/index.php?page=home.php. The layout would be in the file index.php but the content for the homepage would be at home.php. The code to do this would be:
<?php if($_GET['page'] == null) { include “default.php”; } else { include $_GET['page']; } ?>
The explaination of this is:
$_GET['page']
is the PHP way to get a parameter from a url. In PHP all the page parameters are stored after the ? in the url. For example in this page index.php?page=anything.php the only variable is page and in this case page is equal to “anything.php”. The $_GET['page'] gets the value of page. If you wish to add more variables to the url you simply add an & in between the variables. For example “index.php?page=anything.php&loggedin=false” Thus $_GET['loggedin'] would result in false. Next time you do a go0ogle search check the url and you can see these variables.
include “default.php”
The first include will be shown if the page variable is null. In this case it will show the default page you assign it.
include $_GET['page']
This will show the page of whatever follows the page variable in the url.
For an example of this visit my homepage http://rkania.com/index.php?view=home. My site has customized code and mod rewrite so it won’t work exactly the same.
Have you ever?
Have you ever used Facebook? You have, have you? Well then I built a great application for you. The Have You Ever Facebook application. I built this Facebook application last year in a night, but never blogged about it. It was down for a few months while I upgraded my webhost, but now it is back up and slightly improved. I currently have over 3000 current users and approximately 250 monthly active users which has increased from about 150 before I upgraded it last week. This application allows you to ask your friends a question and have them respond yes or no to the question. I am trying to improve this application so that it can do more things, but I will to sort out the source code. In order to create this application I had to use the Facebook Develper’s PHP api. I learned a lot from this project. I got the idea to create this application from the game we had to play at college orientation. We stood in a circle with some sort of marker where we stood. Then someone in the center calls out something that they have done or are wearing etc and everyone who has also has to move to a new spot.
To visit my application go to: http://apps.facebook.com/have_you_ever/
My Hard Drive Space
Below is a list of my current hard drives attached to my desktop computer. If you add the storage space you get roughly 3.00 TB of storage! Add to that the 250GB hard drive in my laptop. You can say I have a ton of data and I use it quite efficiently
Review: Zhtml, the Pain
I am writing this because I just finished my extremely long Facebook imitation program that was our required project in my introductory CS curse (this was an accidental misspelling but it seems fitting). Starting this semester I thought the class would be extremely easy, and it is except for one aspect…the zhtml. I thought zhtml would be simple, just like HTML, which I learned back in eighth grade, but of course it wasn’t. Zhtml adds an enterprise version of “Ajax” capability to html (that I am sure not many enterprises use) on a special “zk” server. It also allows you to call java code from java classes in your folder. However, a lot of tags are added to zhtml and a lot are also removed from traditional html. Zhtml does not allow much configuration as well. Overall, I think zhtml is not a very useful language and creates a lot of frustrations. They shouldn’t be teaching us a language that has no real world use and has many complications as well. Moreover, it gives 500 server errrors that are very difficult to debug. Having worked with PHP for years, I am used to a web language giving me at least some indication or line number that causes it to fail, but the zk server gives you a message that sometimes helps such as the one below (which means you need to reset the session because your page is not compatible with older versions of the program you wrote before if you added attributes to a user.)
The zhtml changes standard html syntax. For example, although technically okay, they make it so that there is no <center> tag. Also they add a attribute to <div> called visible. Though typically in the css this now becomes a normal attribute in the div tag. This is useful for making certain areas visible based on a boolean return such as:
<div visible=”@{user.isFriend}”>This user is a friend.</div>
The above example checks that the user is a friend by executing the java method isFriend() in the variable user. This method of course returns a boolean value. However, this feature really lacks the ability to evaluate statements since this must return a boolean and cannot check for example that the array size of friends is equal
to 0. They do include the ability to evauluate an if statement by:
<div if=”${user.friends == 0}”></div>
But this always resulted in another server error.

The login "window"
Zhtml adds predefined windows and panels and other graphical eye candy, but the capabilities of each and the amount to which you can customize them is very limited. By default the windows and panels have their own shade of blue, but this blue stays unless you specifically define css to change the color r create your own images to grace the background of the window. I have tried my hand at Ajax before, and although I say it is difficult, there is no reason why a premade Ajax simplifier has to make customization s difficult. If they wanted us to use these windows they should have allowed a much more user friendly way to change the appearance. A s such, when I decided to create my own layout, of course I had to default to blue so that it would blend with the rest of the default zhtml widgets. As one girl who saw my page said, “It’s very blue.” And indeed it is.
Finally I finished this project on Friday night after several nights staying awake until 4:30 am…and now I am hoping I win the extra credit contest

While doing this project I discovered many useful resources that enabled me to add features previously un-thought of to my application since our teacher had not given us the resources to utilize the full potential of zhtml. These include the api to zhtml functions and official style guides. They are linked below:
Links:
Finally my official application is viewable here (for how ever long it stays up):
And my source code including the zhtml page is here:













