Home arrow Site Administration arrow Page 2 - Building a Barebones Content Management System: The Yaapi API

Under The Hood - Administration

This article will show you how to use the different API methods of yaapi, which is an API tool useful for managing content. It will explain how to retrieve a list of articles, display an article on a web page, retrieve a list of categories, and more.

TABLE OF CONTENTS:
  1. Building a Barebones Content Management System: The Yaapi API
  2. Under The Hood
  3. yaapi -- Getting Started
  4. yaapi -- Listing Articles
  5. yaapi -- Display An Article
  6. yaapi - Display List Of Categories
By: Harish Kamath
Rating: starstarstarstarstar / 6
September 21, 2005

print this article
SEARCH DEV SHED

TOOLS YOU CAN USE

advertisement

As I may or may not have already mentioned, yaapi is an object-oriented API. It consists of a utility article() class that is equipped with a bunch of useful properties and utility methods -- youíve already seen its constructor in action in the first part -- that strikes the right balance. While it is not so complicated that it intimidates a novice PHP programmer, it does provide enough functionality that it will not disappoint the experts.

Consider this: the article() class has a get_recent() method, which returns the last five items added to the database. I can conveniently invoke this method to render a "Whatís New" section on my website without the need to resort to any custom programming.

The bottom line: the object-oriented approach of yaapi allows me to update the business logic encapsulated within its API methods. For example, if I want to update the aforementioned get_recent() method to return ten items instead of five, the default value, all I need to do is tweak the core PHP script containing the definition of the articles() class, and the front-end display is updated seamlessly.

Coming back to the introductory section (of this article): I spoke about "articles" and "categories", the two entities at the core of the yaapi application. Let me provide some insight about them and why they play such a critical role as far as my barebones CMS is concerned.

An "article", as the name suggests, is the most basic unit in yaapi (and most CMS software packages). Each article in yaapi is associated with a bunch of attributes; these include among other things the "title", "author" (or "authoress") and his/her "email address", the "category" (more about this in a minute) and finally, we have the "content" that represents an article. I can also turn off the display of an article without having to delete it from the database, courtesy of an "approved" attribute.

Next, I demystify the concept of a "category." In a yaapi context, this concept allows me to group "articles" logically. Letís consider the example of the website on which you are reading this article -- DevShed. Youíll notice that the content has been organized on the basis of different technologies. So, you have categories such as "PHP" for PHP-related articles, "Perl" for Perl-related articles, "Apache" for Ö you get the picture!

Yawning already, are you? Well, things begin to get interesting from here on as I demonstrate how different methods of the yaapi article() class can be used in PHP scripts. I promise.



 
 
>>> More Site Administration Articles          >>> More By Harish Kamath
 

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort
   

SITE ADMINISTRATION ARTICLES

- Coding: Not Just for Developers
- To Support or Not Support IE?
- Administration: Networking OSX and Win 7
- DotNetNuke Gets Social
- Integrating MailChimp with Joomla: Creating ...
- Integrating MailChimp with Joomla: List Mana...
- Integrating MailChimp with Joomla: Building ...
- Integrating MailChimp with Joomla
- More Top WordPress Plugins for Social Media
- Optimizing Security: SSH Public Key Authenti...
- Patches and Rejects in Software Configuratio...
- Configuring a CVS Server
- Managing Code and Teams for Cross-Platform S...
- Software Configuration Management
- Back Up a Joomla Site with Akeeba Backup

Developer Shed Affiliates

 


Dev Shed Tutorial Topics: