Showing posts with label php. Show all posts
Showing posts with label php. Show all posts

Tuesday, December 09, 2008

How I got PHP Eclipse running in Ubuntu 8.10 The Intrepid Ibex

First off, PHP Eclipse is awesome. (That's probably why Zend is repackaging it and selling it with all kinds of extra features.) Aside from code coloring, collapsing, and function assistance (which gPHPedit does great at as well), it also does some pretty awesome code completion and custom code tips based on your own code!

Basically if you are working on a project with custom classes, it will intelligently recognize your custom class's methods and variables, and will give tool-tips based on them if you have been adding comment blocks.

So, now that I've made you want PHP Eclipse (and I've already made you want Ubuntu 8.10), let's get to installing!

  1. Open Add/Remove under the "Applications" Menu
  2. Change the "Show" drop down to "All Available Applications"
  3. Type "Sun" in the search box
  4. Check Sun Java 6 Runtime
  5. Click "Apply Changes"
  6. When it finishes downloading and installing, click "Close"
  7. Head over to the Eclipse website and download the latest version of Eclipse.
  8. Extract it to a folder somewhere, then double click the eclipse script. (it should immediately run Eclipse.
  9. Click Help>Software Updates
  10. Click Add Site, and add the PHPEclipse 3.3-3.4 or 3.2 Repository
  11. Check the box next to the new PHP Eclipse Repo and install any available software from it. (Accepting the license agreement, of course)
  12. Close and restart Eclipse.
  13. Open the PHP Eclipse IDE by going to Window>Open Perspective>Other and then selecting "PHP"
  14. That's it!
Troubleshooting:
If you get some obscure message like "An error has occurred. See error log for more details.", that's probably because you are using gcj (an open source Java runtime) or an old version of Eclipse.

My solution to this was to totally uninstall anything gcj related via synaptic, and make sure I was launching the version of Eclipse I downloaded from their site.

If all else fails, you can always purchase and download Zend Studio for Eclipse. It works great and has a few polished finishing touches that makes it worth it for the avid PHP devloper. (I've downloaded it since I purchased it a while back, but I'm going to see how far I get on straght PHP Eclipse)

Rock on, Razzle Dazzle, and enjoy PHP Eclipse!
Link

Thursday, May 17, 2007

Making my own intranet, Part 1

The General Idea
So I've decided to make my own intranet, eh? (oh wait... I'm not Joe Burns)

I have decided to make my own intranet at work, and have opted against out-of-the-box solutions because I plan on doing some heavy development on little projects here and there that I want to integrate nicely into the intranet.

Since I'm having fun doing this, I thought I'd describe just what I'm doing to make my life a little bit easier.

The Content Management System (CMS) Idea
First off, I wrote my own CMS which is uber-lame. It is a table that looks up the URL in a database and lets the database tell it the title of the page, whether or not the page is available or not, and it gives it a small string which is a path and file prefix for the actual content of the site...

Yeah, I'm horible at describing things, so let's start with an example, if you go to http://ourserver/intranet/myhr/ then it looks up "/intranet/myhr" in the database to find the following data:
title: "My HR"
file: "myhr"
enabled: y

Yay, we have a title and it is enable, things are looking good!

Now it goes to my super top-secret folder that is not accessible via the web and looks for the following files:

myhr.head.php
myhr.content.php
myhr.tail.php

The head is called before anything is displayed on the screen, but right after sessions have been started.

The content is what is displayed in the middle of the page... this should really do nothing more than display what was processed in the head.

The tail is the file included at the bottom of the page, which I doubt I'll use much other than to include javascript calls that need to be made at the end of the document.

The content page is required, but the head and tail are optional. If the content page does not exist, it displays an error page instead... if I were smart, I would send 404 headers in the notfound.head.php file, just to maintain standards.

The Cool Idea(s)

Cool idea 1: tossing the milk when it goes bad

I've also got launch and expiration dates in the page table, so the page only displays during the time it should be displayed... I will probably also write a script to browse the database for pages that are nearing expiration to send me an email reminder, which means I can set a 1 year expiration on every content page if I wanted to, then have it remind me in a year to review the content for accuracy then make changes and extend the expiration date.

Cool idea 2: group-based access
I've always enjoyed user and group-based access levels, and with the magic of Active Directory, LDAP, PHP, and some out of date trail mix I've been able to do just that! (and get a stomach ache)

Basically I've thrown together a short script that authenticates usernames and passwords against LDAP (which is pointed at our Active Directory domain controller) and after authenticating I'm grabbing the "memberof" attribute of the user since I've already got a valid ldap bind.

This means I can take all of the users and groups I'm already managing for file permissions and use those same users and groups to manage permission on the intranet! Wo0t!

Cool idea 3: wiki-style page creation
Quite possibly the second-coolest idea (sorry, but that ldap thing is cool !), adding some code in the page-not-found script to add a "create this page" link if the logged in user is a member of the intranet admin group!

I could also add an "edit this page" link at the bottom of each page, or possibly just assign a shortcut key or something to edit the page.

I would do 99% of my coding in the Zend Development Environment anyway, but man it would be nice to manage user permissions, expiration dates, and things of that nature in a nice GUI other than phpmyadmin!

More to come...