ClassiPHPied – Open Source PHP Classified System

ClassiPHPied is a very simple PHP Classified Ads System. Yes, this is not a “we have a load of features, but you won’t even use half of them” kind of system. This is just a basic one, with the raw essentials to you started quickly – Be it for a small business, or expanding on top of it.

 

TABLE OF CONTENTS

Download & Notes How To Use Quick Reference
How To Develop Common Problems

 

 

DOWNLOAD & NOTES

First, here are the download links and a quick “setup guide” for the impatient folks who don’t have the patience to read through everything.

 

DOWNLOAD LINKS

Download ClassiPHPied | GitHub | SourceForge

 

REQUIREMENTS

ClassiPHPied has not been extensively tested, but it is developed and works on a WAMP8 (Apache MySQL PHP 8) server. The requirements:

  • Apache Mod Rewrite
  • PHP PDO Extension
  • Best to have at least PHP 7

 

INSTALLATION

As for the “installation”, sorry… There is no installer. But this should be simple enough for the developers:

  • Create a database and import the lib/classiphpied.sql file.
  • In lib/GO.php, change the host settings (A2), and database settings (A3) to your own.
  • Access http://your-site.com once, let the system generate the .htaccess file.
  • That’s all, access http://your-site.com/admin for the admin panel.

The default user is “admin@clp.com” and the password is “123456“. Remember to change it later.

 

 

HOW TO USE

So far so good? Let us now go through a quick crash course on how to use ClassiPHPied.

 

STEP 1) REGISTER CATEGORIES

Go to the “Manage Categories” section, register all your categories – Vehicles, jobs, properties, and whatever else you want.

 

STEP 2) UPLOAD IMAGES

Next, go to the “Manage Images” section and upload all your images.

 

 

STEP 3) CREATE CLASSIFIED ADS

Lastly, go to the “Manage Classifieds” section, register all the ads.

 

DONE!

That’s all! Head back to the front end and verify the listings.

 

QUICK REFERENCE

This section is for the developers, a quick walkthrough of the general system structures.

 

FOLDER STRUCTURE

  • api API handlers.
  • assets Public images, CSS, Javascript, and whatever else.
  • lib Core library files.
  • pages HTML pages.

Yes, there are only 4 folders in the entire system.

 

 

THE DATABASE

categories – Classified Categories
Field Description
cat_id Category ID, primary key.
cat_name Category name.
cat_desc Category description, if any.
classifieds – Classified Ads
Field Description
cla_id Classified ID, primary key.
cla_title Title (255 characters max).
cla_summary A short summary (255 characters max).
cla_text The body text.
cla_person Contact person (or company).
cla_email Contact email.
cla_tel Contact telephone number.
cla_images – Classified Ad Images
Field Description
cla_id Partial primary key and foreign key.
slot_id
Partial primary key.
img_file
Image file attached to the ad.
cla_to_cat – Classified To Category
Field Description
cla_id Partial primary key and foreign key.
cat_id
Partial primary key and foreign key.
users – The Users
Field Description
user_id The user ID, primary key.
user_name
The user name.
user_email
The user’s email address.
user_password
The password. Encrypted.

 

 

THE FRAMEWORKS

ClassiPHPied is built with Bootstrap, TinyMCE, and Core Boxx. Believe it or not, the initial version of ClassiPHPied is built within 48 hours using:

Go ahead and check those out if you want… The other “pre-developed” modules of Core Boxx should also snap right in.

 

DEVELOPING CLASSIPHPIED

As simple as it may be, going through the entire system is still going to take some time. So instead of “explaining line-by-line”, here is a condensed version of “how to quickly customize and upgrade”.

 

STEP 1) CREATE/MODIFY DATABASE TABLES

Add your new tables, modify the existing ones.

 

STEP 2) ADD/UPDATE SYSTEM MODULE

Create a lib/LIB-Module.php, define class Module, add functions inside. For example, to add a new report module – Create lib/LIB-Report.php.

core/LIB-Report.php
class Report {
  function getNewClassifieds () {
    return $this->DB->fetchAll(
      "SELECT * FROM `classifieds` ORDER BY `cla_date` DESC LIMIT 0, 20",
      null
    );
  }
}

That’s it. The new module can now be loaded via $_CORE->load("Report") and the new function can be accessed via $_CORE->Report->getNewClassifieds().

 

STEP 3) ADD/UPDATE API ENDPOINT (OPTIONAL)

api/API-report.php
// (A) MUST BE SIGNED IN
if (!isset($_SESSION["user"])) {
  $_CORE->respond("E", "Please sign in first");
}
 
switch ($_REQ) {
  // (B) INVALID REQUEST
  default:
    $_CORE->respond(0, "Invalid request");
    break;
 
  // (C) GET NEW CLASSIFIEDS REPORT
  case "getNewClassifieds":
    $_CORE->autoGETAPI("Report", "getNewClassifieds");
    break;
}

If you need an API endpoint for AJAX processes and mobile app support, create api/API-module.php. For this example, we simply access http://site.com/api/report/getNewClassifieds/ to fetch the report in a JSON-encoded string.

 

STEP 4) ADD/UPDATE HTML CSS JAVASCRIPT

  • Add new pages with pages/PAGE-name.php. For example, pages/PAGE-report.php will be accessed from http://site.com/report.
  • For admin pages, it is pages/PAGE-ADM-name.php instead.
  • Take note – PAGE-ADM-name.php can only be accessed by users who are signed in.

That’s about it. Just reverse engineer and copy from the existing libraries, API, and pages… You will see the development pattern here.

 

 

COMMON PROBLEMS & FIXING THEM

Storage Boxx is “not working”? Here are a few of the common problems and how to “fix” them.

 

I FORGOT THE PASSWORD OR DELETED ALL ADMIN ACCOUNTS

Create an “account recovery” script to create a new account, or update an existing one.

recover.php
require "lib/GO.php";
$_CORE->load("Users");
$_CORE->Users->save("NAME", "EMAIL", "PASSWORD", OPTIONAL-USER-ID);

Run and delete this afterward…

 

MIGRATED TO A NEW DOMAIN

  • Simply update HOST_BASE in lib/GO.php.
  • Delete .htaccess.
  • Clear the browser cache to prevent irritating cache redirects.

Done. The system will regenerate a new .htaccess file the next time you access the system. If you have some extra URL rewrite to add – Go ahead and modify index.php, section B.

 

NOT WORKING. DON’T KNOW WHY.

Open the developer’s console, reload the page and see the error message.

How To Debug Javascript – A Very Simple Guide

How to Debug PHP Code – A Very Simple Guide

Leave a Comment

Your email address will not be published. Required fields are marked *