Reputation: 13
What must be the problem with this code:
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title><?php echo $title; ?></title>
<?php
echo link_tag('assets/css/jquery.mobile-1.3.2.min.css', 'stylesheet');
echo script_tag('assets/js/jquery-1.10.2.min.js');
echo script_tag('assets/js/jquery.mobile-1.3.2.min.js');
?>
</head>
<body>
<div data-role="page">
<header data-role="header">
<a href="#navigation" data-role="button">Show</a>
<h3><?php echo $title; ?></h3>
<div data-role="controlgroup" data-type="horizontal" class="ui-btn-right">
<a href="#" data-role="button">My Account</a>
<a href="<?php echo site_url();?>login" data-role="button">Logout</a>
</div>
</header>
I'am using jquery mobile for my client-side script and PHP(codeigniter) for server-side script. When I refresh the page after including the in anchor the page now doesn't display the page anymore.
Can anyone tell what's wrong with the code or I'am just missing something.
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Event_management_c extends CI_Controller {
public function __construct() {
parent::__construct();
$this->load->helper('html', 'url', 'form');
}
public function index() {
$data['title'] = 'Events';
$data['reply_title'] = 'Reply Message';
$this->load->view('fragments/header', $data);
$this->load->view('fragments/nav', $data);
$this->load->view('events/index', $data);
$this->load->view('fragments/footer', $data);
}
}
?>
Upvotes: 1
Views: 1682
Reputation: 10996
Based on your extra answers from the comments; the problem is most likely that the function site_url()
isn't defined. The result of this is a fatal error, which isn't shown to you due to settings in php concerning error_report
.
To solve this, run $this->load->helper('url')
in relevant controller, or simply add url
to the helper array in application/config/autoload.php
. Since this function is so common, I recommend to autoload it.
Upvotes: 0
Reputation: 808
Problem here
<a href="<?php echo site_url();?>login" data-role="button">Logout</a>
to
<a href="<?php echo site_url();?>/login" data-role="button">Logout</a>
you can use template library for codeigniter like TEMPLATE LIBRARY
and reload the script and style files.
Upvotes: 1