Global Variables and Functions

Like the other framework, Seme Framework has several global Variables and Functions that you can use for your web app.

base_url()

This global function return full path url. Please make sure your $base_url are set properly for each configurations.

base_url_admin()

This global function return full path url for admin secret url. Please make sure your $base_url_admin are set properly for each configurations.

Controller::debug()

This global function will echo pre formatted text for debugging purpose.

dd()

Same as Controller::debug() this global function will echo pre formatted text for debugging purpose.

$__forward

This global variable used by view for forwarding variable between view.

Example

Lets say we have view structure like below:

app/
└── view/
 └── front/
  ├── page/
  │ └── html/
  │   ├── header.php
  │   ├── navbar.php
  │   └── foter.php
  └── col-1.php

On col-1.php we will call html/header.php and from then will called html/navbar.php.

// ilustration
header.php <----- navbar.php

So that all the contents of the variables are passed inside html/header.php can be pass through into html/header.php by using $__forward variable.

And here is the impementation.

<?php
$this->getThemeElement('page/html/navbar', $__forward);
?>

Redir Method (Redirect)

redir method purpose for redirecting current page in a controller to another url. This method has 3 parameters:

  • target_url *mandatory, contains string of target URL.
  • waiting_time default: 0, wait time before redirect in second(s).
  • redirect_method default: 0, if 1 redirect method using HTML otherwise using PHP header.

Example

Here is the example for redir method:

...
redir(base_url('login'));
...
...
redir(base_url('login'), 5, 1);
...