Blog

  • AJAX Select box in CakePHP

    When I created my first personal CakePHP web site, this was something that had me quite frustrated.  I struggled and struggled to figure out and understand how to do a simple “if I change this select box, how can I populate another one”.

    I had previously done this a million times in other languages with a simple Javascript onchange() function that would do my AJAX and populate my other select box.

    To solve this problem, I checked CakePHP’s web site and did not find anything useful.  Don’t forget this was almost a year ago, I find the web site has come a long way now.  Because I couldn’t find a could example, I did the next best thing, I dove write into the form helper and ajax helper.  Shortly after, I found enough information to start my trial and error process.

    Excellent, now we are getting some where.  Now that we know this, let’s create our two select boxes and make our second one populate through AJAX. (more…)

  • How to setup a route in CakePHP

    If you are like me and are creating personal web sites, one of the best ways to gain traffic to your site is through SEO.  I won’t go into detail here as I want to focus on how to setup a route in CakePHP, but having SEO friendly URLs will go a long way in helping.

    First let’s define what a “route” is.  In CakePHP it allows you to add a different path to access a specific controller and/or function in that controller.

    For example, let’s say I want to create a CMS.  I might create a controller called “StaticContent” and then place a function for each page a client would like to create.  I’m pretty sure I would start getting a lot of calls saying, “Jamie, why is my URL http://www.myaddress.com/StaticContent/myCustomPage?”  So to avoid those calls, we can use a route to make it more accessible and SEO friendly. (more…)

  • How to create a socket server in PHP

    Ever want to build a chat application or perhaps even a game? If so, a socket server will help you get started. Once you understand the underlying functionality of creating the server, enhancing it is just as easy.

    The way a socket server works is, it will be running continously and waiting for a client to connect to it. When a client connects, our server will add it to our list of clients and begin waiting for messages from that client.

    Without further adieu, here is the full source code:

    (more…)

  • StringExtractComponent for CakePHP

    Hi folks, I have just finished creating my first CakePHP component and I wanted to share it with the community.  After I finish writing this article, I will be submitting it to CakePHP for inclusion.

    The component is called StringExtractComponent.  As you may guess, it extracts content from a piece of content.  I have created this component to mimic the STREXTRACT function in Microsoft Visual FoxPro.  I have come to fall in love with this function because it makes retrieving data from a string with a start and end delimiter. I’ve also created two other examples with SQL substring between two characters SQL substring between two characters as well as a String Extract Extension Method with C#.

    To help you understand how it is used, I read the contents of one of my articles into a string.  I then proceed to extract a specific section that is contained within the code syntaxes that exist in the article and it is important to truncate a string.
    (more…)

  • Top 5 SEO Tips To Achieve Top 10 Rankings In Google

    I thought I would follow-up my “How to get indexed by Google in ONE hour” article with my top 5 SEO (search engine optimization) tips.

    The following 5 items are by no means in order of importance, it’s best to try the ones that you think you can do first.  When you are implementing the following 5 SEO tips, it’s important to not rush anything.  When you are creating a web site and writing content, it’s important to take your time, write good content, read it, update it to better market your keywords, and read it again to ensure you are marketing your keywords to the best of their potential. (more…)