Tag Archives: php

How to add comments with AJAX in CakePHP

In today’s article we are going to create a very basic blog that allows people to create a post and posts comments on that post via AJAX.  We are going to keep it extremely basic and just focus on that actual AJAX functionality.

Ready? Let’s begin.  We are going to start by creating two database tables: posts and posts_comments.  Below is a sample create statement for the posts table: Read more »

Share

How to advance our CMS in CakePHP

At the end of part one, we had a working CMS.  Well, at least it was saving files and they could be displayed to the public.  In today’s article, we are going to further advance our CMS.  We will cover the following items:

  1. fckEditor
  2. Revisions

Read more »

Share

How to create a CMS with CakePHP

I really enjoying writing code and I find that snippets just don’t always cut it for me.  So in today’s article, I am going to describe the process of creating a CMS (Content Management System) with CakePHP.

This will be a two part article, in part one we will focus on getting the basics working.  The basics will include ability to add, edit, and delete static content pages.

Part two will advance on our basis and allow us to create drafts and revert back to previous versions.

To begin, let’s download the latest release of CakePHP.  After you’ve downloaded it, extract it to a folder of your choice.  In my case it will be c:\xampplite\htdocs\CMS.  I can now access my new web site by browsing to http://localhost/CMS. Read more »

Share

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:

Read more »

Share

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.

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. Read more »

Share

Facebook Development and $_SERVER['HTTP_REFERER']

If you are new to creating Facebook applications or even if you’re not.  When you go to use $_SERVER['HTTP_REFERER'] you might be in for a surprise when this _SERVER variable does not exist!

Just recently I encountered this problem, when I thought about it for a few seconds it made sense why the variable wasn’t there.  Your server cannot properly track the history because every page request in your Facebook application occurs through a request from a Facebook server, not the user them self. Read more »

Share

Buy one of my books