go top


  • Colection of 65 PHP scripts for $4.29 each

Get 65 PHP scripts in a bundle for $4.29 each!

View Offer

PHP Framework Introduction

by Dimitar Ivanov /  Updates & Releases

As we continue to update our products, most of them are now using the same framework based on the MVC model.  The MVC model is a method to develop a software in three parts - Model, View and Controller (MVC). The Model is the part where logic is defined, for example the type of fields that user has - name, email, phone, last login, unique ID, etc... The View part is the output of the software. These are the layouts and templates. The Controllers is where the magic happens – the code in the controllers accepts the input, manipulates the data and sends back all the output to the “views”. As you can imagine this makes it super easy even for a non experienced person to make small changes to the code. If for example you need to change the front end layout you only have to work with “views” and there is no need of more complex code in the controllers.


You can find all PHPjabbers' scripts that currently support the new framework at the bottom of the "One admiN" presenation page.


Now lets talk about folder and file structure. I will present some general information about how files and folders are organized. In the upcoming weeks we will also post another articles related to different parts of the PHP framework - components, plugins, creating SQL, how multi lang is organized, etc..


Root folder

In the root folder you will see two sub-folders /app/ and /core/.

App and core folders in file explorer


The /app/ folder is where all the specific files are located - models, controllers, views, options, plugins, css, js, data files, etc.. If you need to make a change to any part of the script - functionality or design - this is the folder where you should look. We will discuss it later in the post.


The files in the /core/ folder are code libraries that are used by our scripts. Instead of writing the same piece of code multiple times we’ve created a code library for these repeatedly used functions. For example we have pjEmail.component.php which is used to send emails. Of course it handles mail() and SMTP methods, file attachments, multiple recipients, etc.. which makes the PHP code used very long. To avoid writing the same long PHP code for sending an email when an email has to be sent we just call a function defined in that pjEmail.component.php file. This saves a lot time writing the code, studying it and modifying it. This is a very productive way to code because if you ever need to make a change to the mail sending code you need to update it in one place only - the email component file.


In the /core/ folder there are also folders for external libraries (such as jQuery, TinyMCE, et..).


There are also a couple of obfusticated files which as per our license agreement you cannot change. These files are used to process and manipulate the data on a low level so as long as you understand the MVC model logic you will not need to do any changes to them anyway. 


The /app/config/ folder

PHP scripts and an SQL file inside an application configuration folder


In that folder you can find script configuration files. When you install the product, the config.inc.php file is generated together with all the necessary information in it - MySQL login details, server installation path and URL. So if you ever decide to change the MySQL database password for your server you need to open config.inc.php file and change the password there too. Please, note that before you install our product, this config.inc.php file is empty (0 bytes). Also depending on your server configuration, write permissions to it may need to be set. This is of course checked by our installer wizard and you will be notified if such permissions need to be set.


There is also database.sql file where all the SQL queries to set up the script are stored. So when you make a fresh installation and run the installer it will execute all the queries found in this file.


The /app/models/ folder

PHP scripts inside an application model folder


You can find all models for our software in /app/models/ folder. There you can see a different file for each of the product’s specific features. A model that is pretty much the same for all our products is pjUser.model.php.  In that file we have the fields defined for each user plus the type of these fields, their default values and validation types. This is basically a PHP class which defines the data type. So if you decide to add a new field for your users one of the places where you should add it is the model file.


The /app/controllers/ folder

PHP scripts inside an application controllers folder


In this folder you can find the controllers for the product. These are the files which process all the data. There is a different controller file for each product element. For example the controller for managing user accounts is pjAdminUsers.controller.php


Within the file you will find different functions which are used to manipulate the data. A typical functions would be

  • pjActionCreate() - to create a new user
  • pjActionUpdate() - to update an existing user
  • pjActionDeleteUser() - to delete an user


As you can see we have named the functions in an easy to read format. So when you see a function such as pjActionExportUser you will know that it is used to export user(s) details.


The /app/plugins/ folder

Sub-folders inside an application plugins folder


In this folder you can find different plugins that are the same for the different products that we have. For example pjOneAdmin is a good example for a plugin which works the same way in all our products. Each plugin is built using the MVC model and consist of models, views and controller files.


The /app/views/ folder

Sub-folders and a PHP script inside an application views folder


Here you can find all the web page templates - or so called “Views” in the MVC model. So if you want to change the layout of a particular page you need to look into this folder. As you can see the folders and file names are named in an easy to read format so you can easily understand what each file is about.

Lets open the “pjAdminUsers”. By its name you can imagine that there you can find the page templates used for managing user accounts - list, add, edit pages. You will see these files in the folder.

PHP scripts inside the pjAdminUsers folder


  • pjActionCreate.php - this is the template for the create new user page
  • pjActionIndex.php - this is the template for the list all users page
  • pjActionUpdate.php - this is the template for view and edit user pages


The /app/web/ folder

The last folder is the /web/ folder. If you open the folder you will see that there are different subfolders where all JavaScript and CSS styles are stored. There are also a couple of folders used by the plugins - backup, invoice, etc. If the product that you use lets you upload images (for example Vacation Rental script where you upload images for each property) then you will have /uploads/ sub-folder where these images will be uploaded.


URL structure - views and controllers

The index.php file in script root folder is the file which processes all the information. Both the backend and front end are loaded through that file but depending on the parameters passed different information is shown. The format of the URL gives you a lot of information about what the controller and views are used. For example when you are logged into the administration page and go to Users page the URL in your browser will be as shown below:



Analyzing the URL structure you can find that:

  • the controller file you should be looking at is /app/controllers/pjAdminUsers.controller.php
  • the PHP function which is called to generate all the content you see on that page is in the pjAdminUsers.controller.php file and is called pjActionIndex()
  • the web page template file is /app/views/pjAdminUsers/pjActionIndex.php


If you go to Edit user page the URL will change to:



and hence:

  • the controller file is still /app/controllers/pjAdminUsers.controller.php
  • however the PHP function is now pjActionUpdate()
  • and the web page template file is /app/views/pjAdminUsers/pjActionUpdate.php


I hope this article is a good starting point for you to study and use our MVC framework. You may also check this page for details about MVC. Thank you for reading!

Share on:

26 Comments to "PHP Framework Introduction"


Russ / November 10, 2015 at 22:00 pm

Looking at your PHP Login script. I was looking for information about what levels of PHP security you apply and whether you are progressive in keeping this updated. I know there alot of security holes in PHP login scripts and security these days. Also wondering if I can alter the MySQL db info with Oracle db info ??


Sasho Valkanov

Sasho Valkanov / November 11, 2015 at 12:35 pm

We keep offering updates to our framework and apply all possible security standards to it - XSS, SQL injection protections, etc..

Our scripts use MySQL database only.

Michael Alberga

Michael Alberga / September 6, 2015 at 02:08 am

Great job, I just purchased a couple scripts and I am amazed at the nice clean code and well documented install process. I'm now off to work with the vacation rental script.


Abdul / August 20, 2015 at 18:35 pm

Hi, why do you restrict editing of the framework
I have interest in one script but I have problem with the restriction on the framework

Sasho Valkanov

Sasho Valkanov / August 23, 2015 at 15:21 pm

This is part of our license policy and I am afraid we cannot change it. By the way, you should be able to make any functional changes to the applications even with these few files uneditable.


Dean / July 8, 2015 at 19:54 pm

is there a page on security anywhere? thanks

Sasho Valkanov

Sasho Valkanov / July 10, 2015 at 07:46 am

We do not have such page but will be happy to ask any specific questions you may have. You can do it either here or just contact our support team!

Bernald Kolonja

Bernald Kolonja / November 12, 2014 at 20:32 pm

how to find div id footer?
and where is the full souce code of index.php page?


Add your comment


    Please, be polite and helpful and do not spam or offend others! We promise you will be treated the same way!

    Log in to your account to post your comments. If you still haven't joined our community yet, you can create your FREE account now!

    Posting tip:
    If you use code in your comments, please put it in these tags [php], [sql], [css], [js] PHP code example: [php] echo date("Y-m-d"); [/php]

    Thank you,
    PHPJabbers Team