1. How does Frameplicity work?

Below is a high-level explanation of how the framework processes a page. Note that is explanation is far from comprehensive, and purposefully so-- You will gain a better and deeper understanding by exploring it yourself and completing the activities.

When a user makes a URL request to a web site running Frameplicity, the framework constructs the result page by applying the header, body and footer templates. These templates are explained below.

  • First, render the header template. This is template is shown on all pages. The header template usually contains the main menu.
  • Next, determine the body template to use to render the page. This template is either a detail or master template. A detail template displays one page at a time- for example a blog post. A master template displays a collection of related detail pages. It's up to the master template as to what information from each detail page to display. For example, a blog master template may display the title and date for each blog post and also provide a link to the full content for the blog post. The full content would be displayed by the detail template.
  • Render the body template. A body template may contain widgets, which are helper components that the body template calls. (Header and footer templates may call widgets also).
  • Last, render the footer template. This is template is shown on all pages. For example, this template could contain links to the site's terms of use and privacy policy.

    As noted above, the above explanation is far from complete. You should read the framework's logs and source code to get a deep understanding how the framework works. This is discussed in the next two sections.

    2. Use the Framework's Logs to Ease Your Learning

    Frameplicity does extensive logging during the page request/response lifecycle. Viewing this log will help you to understand what is going on "under-the-hood". The log is viewable in two ways:

  • The log for the most recent page request/response is appended to the beginning of the log file logs.txt located in the folder _Global.
  • If a page request results in an error (for example, page doesn't exist), the log is written as the page response to the web browser.

  • You will start looking at the logs when you complete the first activity.

    3. Look at the Framework's Source Code

    While looking at the logs will provide insight into how the framework processes web requests, you will also want to look deeper. The framework's source code is the ultimate source of "truth". When a web request is made, the index.php file in the framework's root folder is the starting point for handling the request. Looking there, you will see it imports all of the .PHP files in the _Source folder and calls Engine::run() which is the main module that calls all of the other modules in the framework.

    You don't need to look at the framework's source code right now. As you progress through the activities, you will refer to the relevant parts of the source code to deepen your understanding.

    4. Work on the Primer Activity

    The primer activity highlights specific PHP language elements that are used in the framework. While Frameplicity's goal is not to teach you PHP, you'll need to understand whats covered in the primer so your learning curve will be smoother later.

    The following reference materials regarding object-oriented programming (OOP) will help you as you work through the primer activity. If you are new to OOP, you should read through all of these materials.

    Basic concepts
    Constructors and Destructors
    Scope Resolution

    In this primer activity, you will be reading and running code but not writing any code. The code is located in these files in your training environment:


    After looking at the code for each file in the Activity-LanguagePrimer folder, and reading the commentary at the bottom of the file, run the code by accessing the page from the web browser in your training environment. The first file, for example, is accessed by going to http://<localhost>/Activity-LanguagePrimer/Part1.php where<localhost> is the server name of training environment. You don't need to run Part1Helper separately, since its accessed from Part1.

    After you've completed the primer activity, click the button below to proceed to all of the other activities.

    Go to Activities

    Terms of Use   Privacy Policy

    Copyright 2017 Scott Schwarz. All Rights Reserved.