Toddish's Scripts

TF Assets Examples

The best way to see what TF Assets can do is to play around with the implementation provided in the source.

Basic Example

Place config.php in the config folder at application/config/ and tf_assets.php in the libraries folder at /application/libraries/.

Place this in your controller method.

$this->load->library('tf_assets');
$this->load->helper('url');
$this->tf_assets->set_layout('main');
$this->tf_assets->set_content('welcome');
$this->tf_assets->render_layout();

Create a layout at views/layouts/ called home.php. Add this code:

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <title>Welcome to CodeIgniter</title>
    </head>
    <body>
        <?php $this->tf_assets->render_content(); ?>
    </body>
</html>

Now create a content file at views/content called home.php.

<p>Hello World.</p>

Now, view your page. You should see your content loaded in.

Advanced Example

For a more advanced example, including usage of partials and data, see the implementation folder in the source.