2011-08-14 35 views
1

好与我的CMS我建立我能够从主题森林购买了一个非常好的管理模板,我试图找出如何完成更换主题皮肤/模板。模板和更换主题皮肤与CI

登录页面在这里:http://www.kansasoutlawwrestling.com/admintemp/login.html

控制面板:http://www.kansasoutlawwrestling.com/admintemp/index.html

现在大多数文件都是一样的,但是我将要使用的坦克验证库,我的用户登录和认证,其中包括了注册和忘记密码表格等 我希望能够使用相同的布局,模板,主题任何这些认证表单的适当术语,因为如果您注意到登录页面上有一个身体类别的登录,这会使事情变得复杂小。

还是有更好的方式来做到这一点没有一个模板库,甚至是有,我应该用更好的图书馆吗?

有人有什么想法吗?

最新代码:

<?php if (! defined('BASEPATH')) exit('No direct script access allowed'); 

class Welcome extends CI_Controller { 

/** 
* Index Page for this controller. 
* 
* Maps to the following URL 
*  http://example.com/index.php/welcome 
* - or - 
*  http://example.com/index.php/welcome/index 
* - or - 
* Since this controller is set as the default controller in 
* config/routes.php, it's displayed at http://example.com/ 
* 
* So any other public methods not prefixed with an underscore will 
* map to /index.php/welcome/<method_name> 
* @see http://codeigniter.com/user_guide/general/urls.html 
*/ 

public function __construct() 
{ 
    parent::__construct(); 
    $this->load->helper('url'); 
    $this->load->library('tank_auth'); 
} 


public function index() 
{ 
    // Set up the template. 
    $this->template->set_layout('default')->enable_parser(false); 

    if (!$this->tank_auth->is_logged_in()) { 
     redirect('/auth/login/'); 
    } else { 
     $data['user_id'] = $this->tank_auth->get_user_id(); 
     $data['username'] = $this->tank_auth->get_username(); 
     $this->load->view('welcome', $data); 
    } 


} 
} 

/* End of file welcome.php */ 
/* Location: ./application/controllers/welcome.php */ 

修复了这个问题

+3

虽然我很想帮助你,我不知道自己在什么将被视为**正确**的方式。您应该编辑您购买的模板,并将HTML和CSS更改为更符合您需要的语义。无论如何,这个问题不涉及CI或PHP;它是一个纯粹的HTML/CSS语义问题。你应该改变你的标签,也许以下这些标签的人可以帮助你更多... –

+0

我认为这样做,因为我仍然需要,因为我仍然想使用这个模板库。至少我相信这是我需要的。 http://getsparks.org/packages/template/show –

+0

我道歉我的事情是我几乎已经敲定了。我想弄清楚如何让我的默认布局显示在控制器加载时。我的代码在编辑上方。 –

回答

2

一个模板化中的CodeIgniter站点的最基本的方法是创建一个动态加载另一个视图文件的模板或“布局” PHP文件。

尝试这样的事情,看看它是否适合你:

的意见/ layout.php中

<html><body> 
<?php $this->load->view('header.php'); ?> 
<?php $this->load->view($component); ?> 
<?php $this->load->view('footer.php'); ?> 
</body></html> 

的意见/ header.php文件

<h1>Header</h1> 

意见/footer.php

<h6>Footer</h6> 

的意见/ login.php中

<p>Login here!</p> 

控制器/的welcome.php

public function index() { 
    $data['component'] = "login"; 
    $this->load->view("layout", $data); 
} 
+0

我有一个类似于此的模板文件。我的默认模板或页眉/页脚文件是否会导致与div登录页脚错位? –