Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion application/libraries/Dialog.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ class Dialog {

private $_ci;
protected $data;
private $layoutPathPartial;

function __construct()
{
$this->_ci =& get_instance();

// add pathLayout
$this->_ci->load->library('template');
$this->layoutPathPartial = $this->_ci->template->layoutPathPartial;
}

/**
Expand Down Expand Up @@ -140,7 +145,7 @@ public function html()
{
$this->data['id'] = 'dialog-' . mt_rand(1000000, 9999999);
}
return $this->_ci->load->view('dialog', $this->data, TRUE);
return $this->_ci->load->view($this->layoutPathPartial .'dialog', $this->data, TRUE);
}
}

Expand Down
24 changes: 19 additions & 5 deletions application/libraries/Template.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ class Template {
protected $ga_id = FALSE; // UA-XXXXX-X

protected $layout = 'default';
public $layoutPath = 'layout/default/';
public $layoutPathPartial = 'layout/default/partial/';

protected $title = FALSE;
protected $description = FALSE;
Expand All @@ -28,6 +30,18 @@ function __construct()
$this->_ci =& get_instance();
}

/**
* Set directories layout
* @param string $layoutPath path in folder views/
*
* @return void
*/
public function set_layoutPath($layoutPath)
{
$this->layoutPath = $layoutPath;

}

/**
* Set page layout view (1 column, 2 column...)
*
Expand Down Expand Up @@ -165,18 +179,18 @@ public function load_view($view, $data = array(), $return = FALSE)
$css[] = '<link rel="stylesheet" href="' . assets_url('css/' . $css_file) . '">';
}
$css = implode('', $css);

$header = $this->_ci->load->view('header', array(), TRUE);
$footer = $this->_ci->load->view('footer', array(), TRUE);
$header = $this->_ci->load->view($this->layoutPathPartial . 'header', array(), TRUE);
$footer = $this->_ci->load->view($this->layoutPathPartial . 'footer', array(), TRUE);
$main_content = $this->_ci->load->view($view, $data, TRUE);

$body = $this->_ci->load->view('layout/' . $this->layout, array(
$body = $this->_ci->load->view($this->layoutPath . $this->layout, array(
'header' => $header,
'footer' => $footer,
'main_content' => $main_content,
), TRUE);

return $this->_ci->load->view('base_view', array(
return $this->_ci->load->view($this->layoutPathPartial . 'base_view', array(
'title' => $title,
'description' => $description,
'metadata' => $metadata,
Expand Down
10 changes: 10 additions & 0 deletions application/views/layout/default/partial/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<html>
<head>
<title>403 Forbidden</title>
</head>
<body>

<p>Directory access is forbidden.</p>

</body>
</html>