Lieutenant Dan
Lieutenant Dan

Reputation: 8264

How to create 'blog' and new page in Fuel CMS with CI

I am just starting out with fuel CMS and Codeignitor. I'm looking for easy to read suggestions, references, tutorials, code snippets, ANSWERS etc for the 2 following questions below. (2-part Question)

1.) How do I access 'blog' functionality; I've read it is built in as a /view/blog.php but I don't see it; I've tried to create my own (in same directory) but it simply resolves as a static page (I created it from the dashboard) but it lacks any blog > post > get post functionality; like 'blogs' do. I've read time over, like Wordpress and Drupal; Fuel has a 'blog' template. There is none under 'layouts' as well.

So, at this point, I wouldn't mind creating my own 'blog' page - Which leads to:

2.) How do I create a new page manually in Fuel CMS, without the dashboard.

I've created an empty .php file in this directory per documentation:

C:\xampp\htdocs\FUEL-CMS-master\fuel\application\views

I don't really need a custom _variables/ with this -- so what am I missing. I've read I don't need to add / set a new controller with this type of page nor static pages. I also don't want to have to do anything with the controller if I don't need to.

Upvotes: 1

Views: 985

Answers (1)

uelei
uelei

Reputation: 36

Codeigniter works on CMV Controller - Model - View so to create a simple page you need to create at least 2 files 1 controller and 1 view

if you are using CI 2.2 http://www.codeigniter.com/userguide2/overview/at_a_glance.html

if you are using CI 3 http://www.codeigniter.com/user_guide/overview/at_a_glance.html

  • first you need to create controller
  • second create your view

create a file in application/controllhers/blog.php

<?php

class Blog extends CI_Controller {

    public function view($page = 'home')
    {
      //you can acesse this http://example.com/blog/view/  
    }

    public function new($page = 'home')
    {
      //you can acesse this http://example.com/blog/new/   
    }


}

Upvotes: 1

Related Questions