Call for Speakers

Is there a php topic that you have been just itching to learn? Maybe something that you think would be of great help to the rest of our PHP loving community? Speaking at the KCPUG is a great way to make friends and gain experience. The “usual” speakers are just swamped this month, so this would be a great time to volunteer. 😉

I’ll even buy a can of soda (or bottle of water) from the machine for the brave soul who steps up to the plate! If you are serious about speaking, please comment to this thread by Apr 21st.

Thanks!!

EDITED: 2003-04-23 dholmes, Ok…So I whipped up a little something for this month. But the offer for a can of soda for just a little effort still stands. 😉 Feel free to “Sign-up” with your comments below. If you don’t want to speak but have an idea, please offer those too. Half the work is finding something to talk about. 🙂

SOAP and PHP; now on phppatterns

Like him or not (I personally do), Harry Fuecks always has pleanty of great info on his site: phppatterns.com. There is no exception this week. He has just posted a flury of articles on using php to write SOAP/WSDL clients, SOAP servers and all kinds of other sudsy goodness. Read more for the direct links, or just go to his site: phppatterns.com
Posted in PHP

Remember: This is your site!

Just wanted to remind our viewers that commenting on articles is HIGHLY encouraged. This site (as well as our group) exists to learn and discuss PHP concepts and “best” practices.

So if you want to comment on a presentation, ask a related question, etc…please feel free to post a comment on the related article. This site is for you: The PHP community of Kansas City. We are all learning, so criticism and feedback are always welcome.

– Dan

Polls? Anyone???

Does anyone want to know what the (residing) KC PHP community thinks about some topic? Don’t be shy, request a new poll topic by commenting on this article. It’s quick and painless…and it can give you new insight into the minds of the other developers.

February Meeting – XML_Tree/RSS

When people ask me for a list of “why PHP” I often include in my response that it has All of the Buzzwords. Simply put, if there is a reasonable web-related standard out there, chances are that there is class or something to work with it in PHP. XML may or may not be a buzzword, but whithout question PHP does support it.

Learn more about working with RSS and other XML types in this month’s PUG! Read on for more

The problem may be that PHP supports XML processing in a bunch of different ways but only one (or maybe two) of them ship standard. This can make it tough when you don’t run your own server

Also, I won’t be covering schema’s or DTDs, you can find info on those at the w3c website. What I do want to show are ways to work with XML that don’t require any additional compiling or loads of work!

As usual, when I want to work on something new,I look at what is in pear first. There are a ton of places for other classes out there (like phpclasses.org) but there is also (quite often) a whole lot of junk out there too

PHP ships with the expat libraries enabled these days for parsing XML. While it works… well, let’s just take a trip to the onlne doc, shall we…

Notice that it is event (or call-back) based. That’s all well and good…and see how easy it is to manipulate start tags into something and end tags into something….Hmmm, isn’t that what XSLT is for? Anyway, I’m not even going to cover this. I’ve used it…it’s in a production system, actually…but I had to keep track of state in class variables, etc…it was not pretty. Maybe there are better ways to do this, but it does take practice to wrap your arms around it. If it works for you, go for it…it is the fastest and most efficient way to parse XML.

One of the many who know what they are doing, has written an RSS parser using the expat extensions. Perhaps more accuratly, using the Pear XML_Parser which helps you write event parsers in a class.

RSS – A very popular XML application

As I understand it, RSS is a small part of the Resource Description Framework (RDF). Put simply, it is a way for sites to publish meta-data about their content for other applications (and sites) to use. While this has not cough on with many of the big sites, for fear of loss of revenue (cough, cough) or whatever…there are plenty of RSS feeds out there on the web.

First, let’s look at a simple RSS feed in the docs for XML_RSS.

Let’s start actually working through some other examples:

  • Here is a goofy little function to (poorly) draw out an html representation of the feed. Source: rss.php
  • And a little program to drive it. Source:simple.php
  • And finally, what we get when we run simple.php
  • What about other types of XML?

    Of course, working with a canned standard and a canned class is one thing, but what if we need to work with our own xml layouts?

    Just for the sake of example, we are going to write our own XML application. That’s application in the XML sense of the word. We are going to make up our own file format to hold the “feeds” array.

    Of course, we will take it a bit farther though, as XML is just so darn flexible

    So, let’s start with our Example XML file.

    First off, notice that we have kept the concept of “feeds”. These are just “groups” of RSS links. Notice, that we have even sprinkled some formatting data into our XML. This is generally BAD, but I’m just trying to give examples.

    Now, we are going to keep the same drawFeed() function that we used before…but we do want to try to swank it up a little, right? Also, we are going to use the pear library XML_Tree. This was written with the intention of creating an object-oriented XML writer for php. However, the author added the ability to read in an existing document and viola.

  • Take a look at the new code: Source: better.php
  • As well as the Output of better.php.
  • The new formatting (aka pretty stuff) is all handled by a few lines in the style.css.
  • For an easy listing of the demo files, just go to the doghouse

    Keep in mind, the XML_Tree library can be used for outputting XML in a clean (sorta) OO kind of way. Check out the docs for XML_Tree for more details.

    Happy PHPing!
    Dan Holmes

    January Meeting

    With the new year comes a new website, assorted info, and a way to speed up your use of frameworks. All inside this month’s PUG

    New year, new site: Powered by GeekLog

    I introduced the new PUG site…now powered by the geeklog site-in-a-can solution. I wanted to discuss some of it’s internals, available modules, etc…but instead just rambled a bit. 😉 There is already an intro article out there, so read that for more info if interested. After the meeting, Doug pointed out that codingtheweb.com has a portal-portal with RSS/RDF feeds. And, oh yes…they have a PHP feed (which I think is just stuff with the letters PHP in them). I added the RDF Portal box to the PUG site. Enjoy!

    Everyone is invited to write articles/comments/etc for our PUG…you can even submit one anonymously!

    Other Topics

    We had a general Q/A section and discussed things such as our favorite editors (VIM, komodo, ftpedit, and dreamweaver MX to name a few), some of PHP 4.3’s new features, using GD and ionCube’s PHPAccelerator.

    Image_Transform

    In answering a question, I introduced Image_Transform…a PEAR class for abstracting various image manipulation libraries. I have used it to scale images down on the fly but without the headaches involved with different GD versions or pixel math manipulation.

    This abstract factory style library provides member functions such as: resize, scale, scale to a max height/width, add Text and others. Having this in an abstraction layer allows you to switch libraries out depending on what is available on you system or based on what performs the best for your needs.

    For example, I had always assumed that GD’s imageCopyResampled would be the fastest way to size images on the fly. As it turns out, I actually got better performance letting Image_Transform use the mageMagik command line utilities.

    The ionCube PHP Accelerator

    We all know that PHP is bashed by “other” developers because a PHP script is usually compiled every time before it is run. When using single scripts or even small libraries, this compilation takes so little time it goes unnoticed. However, as you site grows, frameworks are implemented and your compile times start getting up there into the .5-.8 second range…you might start thinking that you need to invest in more hardware. This just usually isn’t the case.

    Sometimes, all you really need is something that will cache that compiled byte code. There are several alternatives available, such as the ones from Zend. However, as money is sometimes hard to find we have to go in search of other solutions. Enter ionCube and their PHP Accelerator

    There are some restrictions: It requires PHP 4.0.6 or higher (and you should too) and Apache 1.x in *nix, but if that is your setup…then enjoy!

    It also may not play with other Zend/PHP modules. For instance, the Komodo debugger did not work when I used it in the same server as PHPA. No big….I doubt that you will want to use it on a dev machine anyway as it can lead to a little “weirdness”. For instance, say you had an abstract class called Fruit and it is in a file called fruit.inc. Then you have a class called Apple which includes fruit.inc and extends Fruit. Now, all is good and the cache works great. Until, say, you add a member function to your base class: Fruit. PHPA will notice that THAT file has changed, and will recompile it. However, the functionality will not propagate down to the Apple class. Apple will still be the compiled version from before the functionality was added to it’s parent.

    If this doesn’t make sence…then you probably won’t have a problem with it anyway. 😉

    While I didn’t bother to write down exact numbers, when I was implementing this for our framework I noticed response times (from start of request to page render, using the advanced “time lynx -dump www.yourwebsite.com” command) were easily cut in half. Of course, I have written a fairly sloppy framework built on top of another big framework…but hey…like I said: in half. 😉

    Behind the scenes it uses apache shared memory segments and a directory on your filesystem to efficiently cache your PHP byte code. If your code wants a pick-me-up…this might be an afternoon alternative to a major rewriting effort.

    Happy Coding! And see you next month!

    Where are the meeting notes?

    If you are looking for the notes from the 2002 meetings…never fear. You can still find them on the old site. More specifically, you can find them by clicking here. They will get moved over eventually…I just want to learn what the new system can do first.

    Welcome to our new Site!

    It was a LONG time coming, but with little fan-fare and much rejoicing (mostly from from myself)…I bring to you the new KC PHP UserGroup website. Read on for more.

    There is much to do, but I wanted to bring up something before tomorrow’s meeting. I wanted a site that belongs to all of us where anyone could submit an article. Of course, there will be an approval step…but I’m hoping that maybe this will become what I had hoped the Discussion Boards would.

    I was also really tired of using an ancient version of the content management system that I am writing for my place of employment. The thing has come a long away…but it is just not what I wanted for this site.

    I wanted fast content addition, polls, article/event/url submission, extendibility and maybe a photo album

    Oh, and for personal reasons, it could not be PostNuke 😉

    So, I stumbled into Geeklog, and I am happy.

    I’m sure it will take me a little while to move the content and get all settled in…but I like what I see, and can’t wait to see what this baby can do for us.

    If you have comments, feel free to add your voice here or on the Poll.

    See you at the PUG!