A simple module will have a controller called "products". That URL is pointing to a function in your controller called "slug". What is the URL behind the view button?
Thank you for answering me. I don't have a controller for this module (From the documentation: Simple modules don't require additional views and controllers to be created), it is a simple module. The url behind the button is: mysite/products/slug (the product's slug), so if the product's slug is: xxx it will be mysite/products/xxx
For the preview_path, you need to set the {placeholder} of the field (most of the time, it is slug)
And to use the generated post pages as described here: http://docs.getfuelcms.com/modules/simple => Generate Post Pages you need to setup the pages config array. Unfortunately, it's not really straight forward in the docs, because it assumes too much.
here is what I got working without setting up any new views or controller:
I assume your Products_model is extending the Base_posts_model like this (Replace all "Tests" with "Products", also keep in mind, Base_posts_model assumes fields like publish_date etc.
require_once(FUEL_PATH.'models/Base_posts_model.php');
class Tests_model extends Base_posts_model { // Fuel Way
public $foreign_keys = array(
'category_id' => array(
FUEL_FOLDER => 'fuel_categories_model',
)
);
function __construct()
{
parent::__construct('tests');
}
function list_items($limit = NULL, $offset = NULL, $col = 'name', $order = 'asc', $just_count = FALSE)
{
$this->db->select('tests.id, tests.title, tests.dec');
$this->db->order_by('tests.id');
$data = parent::list_items($limit, $offset, $col, $order, $just_count);
return $data;
}
}
// don't forget this, else a lot of things won't work
class Tests_item_model extends Base_post_item_model {
}
and this is the module config: take a look at the pages key:
I haven't figured it out completely, but that's what I came up with reading the docs (http://docs.getfuelcms.com/modules/simple) and jumping through the code with the debugger.
Comments
A simple module will have a controller called "products". That URL is pointing to a function in your controller called "slug". What is the URL behind the view button?
Thank you for answering me. I don't have a controller for this module (From the documentation: Simple modules don't require additional views and controllers to be created), it is a simple module. The url behind the button is: mysite/products/slug (the product's slug), so if the product's slug is: xxx it will be mysite/products/xxx
@Sigal - do you mean the "View" button from the Fuel backend listing?
What's the content of your MY_fuel_modules.php file look like?
Is it something like that?
For the
preview_path
, you need to set the {placeholder} of the field (most of the time, it is slug)And to use the generated post pages as described here: http://docs.getfuelcms.com/modules/simple => Generate Post Pages you need to setup the
pages
config array. Unfortunately, it's not really straight forward in the docs, because it assumes too much.here is what I got working without setting up any new views or controller:
I assume your Products_model is extending the Base_posts_model like this (Replace all "Tests" with "Products", also keep in mind, Base_posts_model assumes fields like
publish_date
etc.and this is the module config: take a look at the
pages
key:I haven't figured it out completely, but that's what I came up with reading the docs (http://docs.getfuelcms.com/modules/simple) and jumping through the code with the debugger.
If I got something wrong, please correct me.