The core

blaze has one main object which will hold all other components. It is your best friend when working with the framework. You have probably seen it already, it looks like this: $blaze.

The core object is available to you for usage in your scripts and it holds a lot of components and options. For example the asset compiler is accessible like this:

    $blaze->assets

It is recommended to read about the other components in their documentation pages.

Available functions of the core

The core itself is a kind of container for alle the other components. So there are only very few methods you can call directly on the core. Most of the public functions are only needed for the correct workflow, and not intended to be used by the website itself. That's why they are only documented in the sourcecode itself.

Example usage can be found at the bottom of this page.

Functions that are made to use them:

    $blaze->getVersion();

This function will return the version string of the currently installed blaze release. For the initial blaze release, this would be '1.0.0' (string).

    $blaze->getBuildnumber();

This function will return the current build number as numeric string. Could for example return '100'.

The output component

The output component is an internal component which blaze uses to either render the frontend or the backend. If used in the frontend, there are some system functions you may want to know about.

    $blaze->output->disableCaching();

This function prevents static output caching on the script it is used in. You can read more about this in the output caching section.

    $blaze->output->getOutputFile();

This method will return the absolute file path of the script that blaze decided to render out as a string.

    $blaze->output->allowFraming();

By default, your site will not work in iframes or frames that try to load your site from a remote site. This measure is taken to prevent clickjacking. To allow framing on a single page, call this method once in the page.

Helper functions

The output component also holds some methods to help you build your frontend faster.

All of the following helper functions support method chaining!

    $blaze->output->printDoctype($doctype);

This method will print out a properly formatted doctype string. It knows 'html5', 'html4' and 'xhtml'. The $doctype should be one of these three, but it is optional. If you do not provide $doctype, it will assume you meant to use 'html5'.

    $blaze->output->setDoctype($doctype);

If you intend to only set the doctype but not output it directly, you can set it with this method. It takes the same inputs as the printDoctype() method, but the $doctype is not omissible for this method.

    $blaze->output->printCharset($charset);

This method will print out a meta tag for the charset you give it. The $charset may be omitted and will default to 'utf-8'. The meta tag will be properly formatted to work with the doctype you setup.

$charset will take any string that would be a suitable charset to use in a meta tag.

    $blaze->output->setCharset($charset);

You can set the charset separately with this method. It will not output the meta tag but set the charset to put it out at a later time. $charset is mandatory.

$charset will take any string that would be a suitable charset to use in a meta tag.

    $blaze->output->printDescription($description);

Use this method to print the description meta tag, properly formatted for your doctype. $description should be a string, but it can also be set via setDescription() and maybe omitted here.

    $blaze->output->setDescription($description);

You may set the page description and print it out later. $description may of course hold a string, and it is mandatory for this method.

    $blaze->output->printMetaTag($name, $content);

This method will print out a meta tag properly formatted for the doctype you chose. Both values take strings and are mandatory.

    $blaze->output->printTitle($title);

For your convenience, there is this little helper function. It will just print out the title tag, which should be a string and is mandatory.

    $blaze->output->enableResponsiveDesign();

This method will basically enable responsive design by printing out a viewport meta tag. If you need anything fancy, you will have to set it up separately.

    $blaze->output->blockRobots();

Sometimes you need to tell robots not to index a page. Use this method within the head area of your html in order to make it printout a nofollow meta tag.

    $blaze->output->allowRobots();

If you wish to explicitly allow robots to index a page, this is your method. It will print out a follow meta tag.

    $blaze->output->printPiwikTrackingCode($piwikurl, $siteid);

blaze can directly print out a piwik tracking code for you, just provide the url where piwik is installed and the site id that is needed to identify your page.

Example usage

In order to give you an idea of how to use these helper functions, we put together a little example.

Your php script

    <?php
        $blaze->output->printDoctype(); // 'html5' is preset
    ?>
    <html>
        <head>
        <?php
            $blaze->output->printTitle('cool demo')
                          ->printDescription('This is a cool description')
                          ->enableResponsiveDesign()
                          ->printCharset()  // utf-8 is preset
                          ->blockRobots();
        ?>
        </head>
        <body>
            Cool page's content.
        </body>
    </html>

What blaze will render out with pretty printing enabled

    <!DOCTYPE html>
    <html>
        <head>
            <title>cool demo</title>
            <meta name="description" content="This is a cool description">
            <meta name="viewport" content="width=device-width">
            <meta charset="utf-8">
            <meta name="robots" content="nofollow,noindex">
        </head>
        <body>
            Cool page's content.
        </body>
    </html>

What blaze will render out with output compression enabled

    <!DOCTYPE html><html> <head> <title>cool demo</title><meta name="description" content="This is a cool description"><meta name="viewport" content="width=device-width"><meta charset="utf-8"><meta name="robots" content="nofollow,noindex"> </head> <body> Cool page's content. </body></html>