- Seme Framework
- versi 4.0.3 (ID)
- Persyaratan
- Download & Install
- Pengaturan
- Tutorial
- Perutean URI
- Konstanta
- Variabel Global
- Model
- View
- Controller
- Library
- CLI (command line interface)
- Core
Metode getThemeElement
Metode getThemeElement
digunakan untuk menaggil html elemen atau komponen html yang sudah kita buat sebelumnya kedalam suatu file yang ada didalam view.
Bentuk Umum
Berikut ini bentuk umum penggunaan metode getThemeElement
dari kelas SENE_Controller .
getThemeElement(string $view_location [,array $__forward=array() [, int $cacheable=0]]): $this
Parameter
Metode ini terdiri 2 parameter wajib dan 1 parameter opsional.
$view_location
Lokasi file html berekstensi php yang sudah kita definisikan. File ini relatif terhadap tema yang di definisikan pada controller.
$__forward
Variable global yang sudah terdefinisi dan bisa diteruskan ke html view yang akan dipanggil.
$cacheable
Parameter opsional untuk menentukan bahwa komponen html yang dipanggil sudah dalam kondisi tercache.
Contoh Penggunaan
Metode ini dapat digunakan di dalam layout file seperti didalam file page/col-1.php
.
<!DOCTYPE html>
<html>
<?php $this->getThemeElement("page/html/head",$__forward); ?>
<body>
...
</body>
</html>
Ini adalah struktur file dan direktori untuk page/html/head
.
seme-framework/
├── app/ # Application directory
│ └── view/ # View files
│ └── front/ # Front-end views, based on loaded theme
│ └── page/ # Page-specific views
│ ├── col-1.php
│ └── html/
│ └── head.php
Kemudian ini adalah contoh kode dari page/html/head.php
<head>
<!-- Basic page needs -->
<meta charset="utf-8">
<!-- Mobile specific metas -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<!--[if IE]>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<![endif]-->
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title><?php echo $this->getTitle(); ?></title>
<meta name="language" content="id" />
<meta name="description" content="<?php echo $this->getDescription(); ?>"/>
<meta name="keyword" content="<?php echo $this->getKeyword(); ?>"/>
<meta name="author" content="<?php echo $this->getAuthor(); ?>">
<link rel="icon" href="<?php echo $this->getIcon(); ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo $this->getShortcutIcon(); ?>" type="image/x-icon" />
<meta name="robots" content="<?php echo $this->getRobots(); ?>" />
<?php $this->getAdditionalBefore(); ?>
<?php $this->getAdditional(); ?>
<?php $this->getAdditionalAfter(); ?>
</head>