• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
tutorial fails when clicking "Create news item"

#1
Hi,
I followed the tutorial for CodeIgniter-3.1.6 exactly.  Everything seemed to work ok until the last step, creating a news item.  When I click the "Create news item" button after entering a Title and Text, the browser goes off to some CRM web site and I see the following error in the Chrome console:

Code:
Error parsing a meta element's content: ';' is not a valid key-value pair separator. Please use ',' instead.
2create:30 A parser-blocking, cross site (i.e. different eTLD+1) script, http://sedoparking.com/frmpark/www.tekknow.net/1und1parking4/park.js, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
(anonymous) @ create:30
2park.js:14 A parser-blocking, cross site (i.e. different eTLD+1) script, http://pagead2.googlesyndication.com/apps/domainpark/show_afd_ads.js, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.
(anonymous) @ park.js:14
2show_afd_ads.js:9 A parser-blocking, cross site (i.e. different eTLD+1) script, https://dp.g.doubleclick.net/apps/domainpark/domainpark.cgi?callback=_google_json_callback&output=js&client=ca-dp-sedo-token_xml&domain_name=www.tekknow.net&st=create&drid=as-drid-2654598893490736&dt=1512363996614&u_tz=-420&u_his=3&u_h=1080&u_w=1920&frm=0&ref=http%3A%2F%2Fwww.tekknow.net%2FRetirePlan%2Findex.php%2Fnews%2Fcreate, is invoked via document.write. The network request for this script MAY be blocked by the browser in this or a future page load due to poor network connectivity. If blocked in this page load, it will be confirmed in a subsequent console message. See https://www.chromestatus.com/feature/5718547946799104 for more details.

Here is my News.php

Code:
<?php
class News extends CI_Controller {

    public function __construct()
    {
        parent::__construct();
        $this->load->model('news_model');
        $this->load->helper('url_helper');
    }

public function index()
{
        $data['news'] = $this->news_model->get_news();
        $data['title'] = 'News archive';

        $this->load->view('templates/header', $data);
        $this->load->view('news/index', $data);
        $this->load->view('templates/footer');
}

    public function view($slug = NULL)
{
        $data['news_item'] = $this->news_model->get_news($slug);

        if (empty($data['news_item']))
        {
                show_404();
        }

        $data['title'] = $data['news_item']['title'];

        $this->load->view('templates/header', $data);
        $this->load->view('news/view', $data);
        $this->load->view('templates/footer');
}

public function create()
{
$this->load->helper('form');
$this->load->library('form_validation');

$data['title'] = 'Create a news item';

$this->form_validation->set_rules('title', 'Title', 'required');
$this->form_validation->set_rules('text', 'Text', 'required');

if ($this->form_validation->run() === FALSE)
{
$this->load->view('templates/header', $data);
$this->load->view('news/create');
$this->load->view('templates/footer');

}
else
{
$this->news_model->set_news();
$this->load->view('news/success');
}
}
}
Here is my create.php

Code:
<h2><?php echo $title; ?></h2>

<?php echo validation_errors(); ?>

<?php echo form_open('news/create'); ?>

    <label for="title">Title</label>
    <input type="input" name="title" /><br />

    <label for="text">Text</label>
    <textarea name="text"></textarea><br />

    <input type="submit" name="submit" value="Create news item" />

</form>
Here is my News_model.php

Code:
<?php
class News_model extends CI_Model {

    public function __construct()
    {
        $this->load->database();
    }

public function get_news($slug = FALSE)
{
        if ($slug === FALSE)
        {
                $query = $this->db->get('news');
                return $query->result_array();
        }

        $query = $this->db->get_where('news', array('slug' => $slug));
        return $query->row_array();
}

public function set_news()
{
$this->load->helper('url');

$slug = url_title($this->input->post('title'), 'dash', TRUE);

$data = array(
'title' => $this->input->post('title'),
'slug' => $slug,
'text' => $this->input->post('text')
);

return $this->db->insert('news', $data);
}
}
Here is my routes.php

Code:
$route['news/create'] = 'news/create';
$route['news/(:any)'] = 'news/view/$1';
$route['news'] = 'news';
$route['(:any)'] = 'pages/view/$1';
$route['default_controller'] = 'pages/view';

Dead in the water.  Any suggestions?
Reply

#2
I see nobody responds on this forum so am dumping codeigniter.
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
2 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2018 MyBB Group.