- Seme Framework
- version 4.0.3
- Requirements
- Download & Install
- Configuration
- Tutorials
- URI Routing
- Constants
- Global Variables
- Model
- View
- Controller
- cdn_url
- config
- constructor
- getAdditional
- getAdditionalBefore
- getAdditionalAfter
- getAuthor
- getCanonical
- getContentLanguage
- getDescription
- getIcon
- getJsContent
- getJsFooter
- getJsReady
- getKey
- getKeyword
- getLang
- getRobots
- getShortcutIcon
- getThemeElement
- getTitle
- input
- lib
- load
- loadCss
- loadLayout
- putThemeContent
- putJsContent
- putJsFooter
- putJsReady
- putThemeContent
- render
- resetThemeContent
- session
- setAuthor
- setCanonical
- setContentLanguage
- setDescription
- setIcon
- setKey
- setKeyword
- setLang
- setShortcutIcon
- setTheme
- setTitle
- Library
- CLI (command line interface)
- Core
- Issue
- Deployment
putThemeContent Method
The putThemeContent
method used for load a view component file in current theme.
This method support stack for loading another view component.
Basic Usage
Here is the basic usage of putThemeContent
method from SENE_Controller class.
$this->putThemeContent(string $content_location[, array $data]): $this
Parameters
This method has required 1 parameter that is $content_location.
$content_location
The $content_location
value can be a string that indicates view component location related to current theme.
This value does not need .php
suffix.
$data
The $data
values contain array of array
that will be passed to view as a variable.
The array key
from this value will be parsed as name of a variable.
Example
Here is the example implementation of putThemeContent method.
File and Directory structures
Before implementing the codes, we have to understand the file and directory structure that will used in example.
app/
└── view/
└── front/
├── home/
| ├── slider.php
| └── three_values.php
└── page
└── col-1.php
The Controller
On this code example shows implementation of putThemeContent method and how to passing variable to it.
class Home extends SENE_Controller
{
public function __construct()
{
parent::__construct();
$this->setTheme('homepage');
}
public function index()
{
$data = array();
$data['example'] = 'this is example';
$this->putThemeContent('home/slider',$data);
$this->putThemeContent('home/three_values',$data);
$this->loadLayout('col-1',$data);
}
}
View component
From this example, how view called $data
as a variable on home/slider.php
view component source codes.
<div>
<h1>This is parsed value from data <?=$example?></h1>
</div>