It looks like you're new here. If you want to get involved, click one of these buttons!
I would like to have the functionality so that I can use the same kind of blogging for different purposes, like creating news, projects and achievements kind of thing? One way I was thinking was to reinstalling the blog module and rename its configuration to the module I like, like for news a news blog with everywhere in code it is using blog I could rename it to news, but it seemed like a lot of work.
Comments
I would look at creating Post pages based on simple modules:
http://docs.getfuelcms.com/modules/simple#post_pages
Hey again, I have followed your link and I could made some simple modules through which I can create dynamic pages, but I can't view them through cms view button neither through going to url directly. I have two modules for news and projects and I would like to have a details page for both of them of their individual items, like projects/{slug} but I can't get it to work and keep getting 404.
One more thing, I can't get the results back in object form, I get it in array of array. How can I get it in object form for which I have a class extending from
Base_post_item_model
?What does your module configuration look like for the pages?
If you are getting an array of arrays instead of an array of objects, that's usually because you don't have a record items class setup or it is not setup correctly from the table class model (e.g.
public $record_class = 'Example_record';
).http://docs.getfuelcms.com/general/models#table_result_record_field
Custom Record Objects
This is how MY_fuel_modules.php defines modules
I tried following your example and this is how I have defined in my News class extending from Base_posts_model
public $record_class = 'New_model';
And this is my data record class
class New_model extends Base_post_item_model {}
But I'm still getting array
Okay I have solved the array issue, I changed the value of
$record_class
fromNew_model
toNew
I am still stuck on the post page part. How can I view the post on a separate page from list of posts?
Did you set up a view to point it to in the configuration:
Can you tell me if I point to my own layout in configuration like you have to posts, I have done it to nt_basic, it should use that layout, right? And what about the list and post keys? I have marked them to use _posts/list and _posts/post, also I am using my record model classes in place of post key
Does your news model have a slug field? Also, what appears if you go to /news/{slug} where {slug} is a record's slug value?
Yes, I do have it as I followed the simple module approach. When I go to news/{slug} it gives 404
Can you go to the Fuel_posts.php file and find all the
$this->show_404()
and determine if it's hitting any of those and if so which one?Its breaking on the first find of
show_404()
The is_allowed is checked for an associated "view" to map to and it appears as though it's not finding one. If you look at the Fuel_posts::page_config() method, it appears to be returning NULL and isn't finding a key for "view" for the specified $this->page_type(). What is the value of
$this->page_type()
in that method?Yes you are right, it is returning null and the value is
slug
which I think should find the slug value from database but themodule_config
method does not return anythingInstead of
"new" => "_posts/post"
use"slug" => "_posts/post"
Okay, does this matter if I am doing all this in cms page? I mean my main pages are made in cms and I have configured them in
My_fuel_modules.php
? I will try your solution ASAP!A module's post pages are meant to be a way to dynamically create pages that use data from simple module and not necessarily a page created in the Pages module.
Okay, I understand now and I have got it working, but one thing why slug is working but not my record class object? like new or project?
There are predefined page routes that automatically get setup and slug is one of them. You were specifying a key that didn't have a route associated with it. These are the default keys and their associated routes (code lifted from Fuel_posts line 200).