James Andrews

PHP Development

Full Circle – A WordPress plugin. v 0.020

by admin on Mar.27, 2009, under PHP Development

When I get started on something sometimes it’s just hard to stop. Once I was pretty happy that it was working. I renamed a bunch of variables and functions to match the new name of the plugin. Full Circle. What Full Circle is right now is a combination WordPress plugin that talks via Facebook’s Application API. One of the things I wanted was to make it so that your FB friends did not have to install any application on their side. Once you install the FB app into your profile, you need to grant it authorization to “share things”. The plugin takes advantage of these permissions to post “links” to your feed making them application independent to your target audience.

Currently the only feature is post to your Facebook stream as a link. I am trying to think of other features that may be useful. I was thinking maybe making it so that your Facebook status showed on your blog as a widget, or maybe even posting to Twitter and other SM type sites, so you don’t have to post in 1000 places. I read one post the other day about that, and the guy thought it was bad, but I have to disagree with so many SM outlets it can be hard to manage. This way you can get the word out in one shot, and then interact with what people say. Let me know what you think.

Leave a Comment :, , , , more...

WordBook Plugin

by jandrews on Mar.26, 2009, under PHP Development

One of my goals is to be able to advertise my Blog over Facebook. The most popular of the Facebook wordpress plugins is “WordBook”. I have it installed and indeed when I publish a blog post it shows up as a “recent action” link on my profile page. Not exactly what I want to happen. and survey says [X] I want to be able to have it show up in my new feed. No problem I say. I can hack anything ANYTHING, ok well maybe not anything, but I can hack PHP until my heart is content, or until I hit a brick wall I can do nothing about. I backed up my copy of WordBook, and started poking around the code. Once I figured out where it was calling Facebook’s client library, I saw what call it was making. Should be simple right? and survey says [X][X]. In order to post a link to your feed, which is what I was trying to do, you need to call facebook.links.set(…) which is not part of the current php library that facebook has published. No biggie. I understand what the library is doing, so I make a function similar to the one above but with only the attributes I need. It calls facebook, and survey says [X][X][X]. See in order to call facebook.links.set the user has to have granted the Wordbook application running on facebook access to a new kind of permission. Since the Wordbook developer has not done any work on his end to include this new feature I am how do we say. Shit out of luck.

Leave a Comment :, , , , , more...

PHP Framework.

by jandrews on Mar.25, 2009, under PHP Development

With one of my php endeavors I decided to stay away from using one of the many PHP frameworks. When we started Givvy we decided to use the Symfony 1.0 framework as our base. This was good for a lot of reasons. Primarily it allowed us to push ahead relatively quickly and made a website that should have taken 4-5 developers 12 months to make and allowed 2 developers to make in the same time span. You ask “Why not just continue using symfony?”. Well first off, I am not 100% happy with the direction the framework is going in. Not that it’s the wrong way as there is no right or wrong way, but I just don’t care for it. Second is I feel that it’s memory foot print per page load is excessive. Try doing a print_r($this) inside a module action and you’ll see what I mean. Time after time, the same objects seem to be in memory 5 or 6 times. Then if you want to get at some of those objects there is no way for asking $this for them, you actually have to instantiate another instance of the object carrying the object and ask for it, which seems a bad when you already have it in memory. Lastly KISS, Symfony creates holders for data sent via form whether it’s a GET or a POST the idea is to ask for it using $this->getRequestParameter(‘paramName’);, Why? What’s the point. If you have $_GET and $_POST you already have access to the data, what is the purpose of passing it through an arbitrary function? Then just looking through the source code it seems like you are loading 3-5 different objects just to create the parameter holder for the action/component. It doesn’t seem like a good use code, and seems rather unnecessary.

That said, Symfony has a lot of ideas that I do like. I am a huge fan of MVC and looking at the different frameworks I like Symfony’s method the most. I also like how they use some external libraries to handle the model aspect. Here they are KISS-ing. Propel came default with 1.0, and the 1.0 has a plugin for using doctrine. I like their basic idea for routing, but one of the problems that wasn’t addressed until either 1.2 (or maybe it’s coming in 1.3) is making other applications within the project aware of each other’s routes. Therefore, I will be using some of the ideas of symfony for structuring my framework. I want something.

The goals of my frame work are as follows:

  • Small size: I’d like to see the core framework at under 150K Currently it’s at 52K
  • MVC capable. Currently the MC aspect are in place. I want to allow for use of any model library (Propel/Doctrine etc) which should be fairly easy to accomplish. I will not be shipping a model library with the framework, but it is possible I may add script for working with the one I decide to use.
  • Helpers and modules: I like Symfony helpers, it’s a great idea, so I am going to do something similar, but not the same as 1.0, modules will be completely different, but serve the same purpose as Symfony plugins. Neither will be included in the framework itself, but the base abstract class for creating them will be.
  • Caching ability. I’ve already got a class for caching array data. Now for one for content data. I also want the cacher to work with Memcache (currently it works off Cache_Lite) I’ll allow the site creator to chose which to use, but at least one of them has to be used.

I’ve got the repository set up, and once I get a usable version up I will post so people can use it and tell me I am right or wrong about why I did it. ;-)

Leave a Comment :, , more...

Multisite PHP caching schema.

by jandrews on Mar.20, 2009, under PHP Development, Technology, Web Development

I am working on a website project.  The website will have multiple domains/hosts pointing to it, and will have different themes for each domains/hosts that visit it.  I want to give the site owners as much flexibility as possible with their layouts so that not everyone can have their own look.  One problem that I see with giving them flexibility to change things is most of those things get stored in a database, and this is well and good but once the site starts to ramp up I expect there will be huge draws on server resources and database calls.  Enter caching.  I will admit I don’t have any experience writing a caching application.  Symfony does it for you so Givvy has it, but not through my hands.  Digibug had os-commerce, but I don’t think it cached anything really.  Which explains why  the CM Photocenter has so many performance issues. After researching php caching I can see 100 ways we could have increased performance on that site, and the same on the Digibug.

So I am researching, and everything I’ve read seems to be about the same, so now I am kind of at the point of “where and when to cache”. Not everything is going to be cache-able, but more importantly because I’ll have multiple sites pointing to the same server, I need a caching schema that caches based on the host that is being requested. This is my plan of action.

  1. Create a cached configuration file. This needs contain the basic information needed to connect to the database, and all the configuration items for that particular sites.
  2. Create cached items that are common on all pages. This includes page headers and footers. In different states
  3. Create cached items that won’t be updated often. Blog information. Gallery lists/thumbnail views. Event list pages
  4. Come up with a plan so that when something is updated in the database it regenerates the cache files, so the end user is not waiting.

I think it will help keep the big bad resource monsters at bay, allows some great customization abilities, and give me a good way to grow the site, I just need to think it through a bit more, decide which cache library I am going to use (or if I am going to roll my own), and figure out how to implement it. Lots of fun ahead. I have some ideas, and an entire weekend to play around with them :-p

Leave a Comment :, , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...