PHP Defines in ProdigyView

18
DEFINES Objective Learn how the defines are used to manipulate the system. Requirements Understanding of define() function. Estimated Time 5 minutes www.prodigyview.com

description

Learn how to use defines to manipulate the file structure in ProdigyView.

Transcript of PHP Defines in ProdigyView

Page 1: PHP Defines in ProdigyView

DEFINESObjective

Learn how the defines are used to manipulate the system.

Requirements

Understanding of define() function.

Estimated Time

5 minutes

www.prodigyview.com

Page 2: PHP Defines in ProdigyView

Follow Along With A Code Example

1. Download a copy of the example code at www.prodigyview.com/source.

2.Install the system in an environment you feel comfortable testing in.

3.Proceed to DEFINES.php

www.prodigyview.com

Page 3: PHP Defines in ProdigyView

What are DEFINESIn PHP defines are named constants that are global among the code being executed.

In ProdigyView the DEFINES have two functions.

1. Specify the location of the xml configuration file and the database configuration file

2. Structure the file system for applications, libraries and other features

On our next slide, we will view an example of the defines file.

www.prodigyview.com

Page 4: PHP Defines in ProdigyView

Example Of Defines File

Page 5: PHP Defines in ProdigyView

File StructureIn the previous slide when it was stated that Defines can “structure the file system”, what was being referenced was ProdigyView gives components of the system places where they belong.

IE: All images go in the image folder

IE: All videos go in the videos folder

Changing the defines allows you to change where you want these resources to exist. Libraries do not have to be in /resources/libraries/, they can be in another folder such as /system/libs/ if you change it in the defines.

So lets run through the defines if you are looking for clarification on any.

www.prodigyview.com

Page 6: PHP Defines in ProdigyView

PV_ROOTThe PV_ROOT is the root directory of the site. All files should in a location that can be referenced by the PV_ROOT.

The root location can be set multiple ways such as:

$_SERVER[‘DOCUMENT_ROOT’

dir(__FILE__)

‘/var/www/mysite/’.

www.prodigyview.com

Page 7: PHP Defines in ProdigyView

PV_COREPV_CORE is the core location of the classes that make up ProdigyView’s root system. All the folders and classes that begin with PV should be in this folder.

www.prodigyview.com

Page 8: PHP Defines in ProdigyView

PV_APPLICATIONS / PV_ADMIN_APPLICATIONS

PV_APPLICATIONS is the directory that all applications should exist that are called with PVApplications::execute function.

In an attempt to separate front-end from backend, the applications administrative section can be placed in a separate locations.

www.prodigyview.com

Page 9: PHP Defines in ProdigyView

PV_MODULESModules are components that interact with applications. Files that contain the modules have a folder they are assigned.

www.prodigyview.com

Page 10: PHP Defines in ProdigyView

PV_LIBRARIESPV_LIBRARIES is the location of the libraries that work with ProdigyView. Libraries are handled through the PVLibraries class.

www.prodigyview.com

Page 11: PHP Defines in ProdigyView

PV_PLUGINSPlugins are extensions in ProdigyView whose addition is controlled by the database. Plugins can be object oriented or procedural additions and are persistent once loaded.

www.prodigyview.com

Page 12: PHP Defines in ProdigyView

PV_MVC

ProdigyView is a framework that allows multiple MVCs. MVCs are defined by the developer. An example MVC that comes with ProdigyView is Helium.

www.prodigyview.com

Page 13: PHP Defines in ProdigyView

Configuration FilesThe configuration files are divided into two files. The php file contains the database connections. The xml file contains system configurations.

www.prodigyview.com

Page 14: PHP Defines in ProdigyView

PV_TEMPLATESIf the system being created allows templates, the template directory can set.

www.prodigyview.com

Page 15: PHP Defines in ProdigyView

Javascript LibrariesProdigyView distinguishes the JavaScript files from normal JavaScript, JQuery, Prototype and Mootools. Also it recognizes a difference between front-end js files vs admin files. The files do not contain the PV_ROOT because they are accessed in the browser and having PV_ROOT might make them inaccessible from the browser.

Page 16: PHP Defines in ProdigyView

Media FilesMedia files consist of images, video, audio and files. ProdigyView allows separation of each file type. Parts of the framework such as the CMS make use of these defines for placing the files. These files also do not contain PV_ROOT.

www.prodigyview.com

Page 17: PHP Defines in ProdigyView

Admin

The last define is the administrative define. If this define is set to true, applications will be allowed to access their administrative section. If set to false, the function PVApplication::pv_exec_admin() will not be accessible. This is done to separate the front end from backend.

www.prodigyview.com

Page 18: PHP Defines in ProdigyView

Review

As seen, there are numerous defines that can set. Those defines are changeable to change how your system is set up.

When you are comfortable with various aspects of the ProdigyView, take the time to change the defines to customize the system you build.

www.prodigyview.com