You can also test for the id value like so:
if (!isset($values['id'])) { $fields['customer_name']['type'] = 'hidden'; $fields['customer_address']['type'] = 'hidden'; $fields['refund_transaction_id']['type'] = 'hidden'; $fields['refund_transacti…
You are right in that to use fuel_model you need have it be a CMS module. You can set the "hidden" module property in the MY_fuel_modules which will hide in from the navigation. However, the module still is accessible through the URL. So, the better…
If a page is created in the CMS, the default main layout has a page_title field that you can use like so:
<?=$page_title?>
If you are using a static view file, you can use the the following from within the view file:
<?=fuel_set_var('page_t…
I'm not certain what may be going on but may provide some insight as to why it's being run twice which may help direct you where to look. The query gets run twice. The second time is to calculate the total number of items without the limits for pagi…
Are you using an on_after_save hook and doing a save_related call to save the information for the author similar to below?
// add books function on_after_save($values) { $data = (!empty($this->normalized_save_data['books'])) ? $this->norma…
You can add that to the home.php view file around line 17. And it's actually "get_recent_posts" (I changed it in my previous post too to avoid further confusion).
The blog_posts_model's _common_query is missing a call to it's parent model like so:
…
You could try something like this:
function form_fields($values = array(), $related = array()) { ... $this->load->model('authors_model'); // get the options using the author's model and a where condition $options = (!empty($values['id'])…
That is a bug in the demo. The blog_posts_model doesn't call the parent _common_query and so it doesn't filter out unpublished content. You can alternatively call $CI->fuel_blog->get_recent_posts(3). Or, if you add published = "yes" to the fue…
1. That is correct... you can add the variables to the variables file or use fuel_set_var in your view file to set the variable. It's essentially just a view variable.
2. If you have "Sponsor_item_model" as the name of your record class, you'll nee…
1. The $css refers to a variable that you can set on your pages or in a variables file so that additional CSS files can be added to your page. Examples:
// from within a view file fuel_set_var('css', array('my_css')); // from within your global var…
Most of the time we'll use fuel_model to get model data from within the block.
// from within views/_blocks/my_block.php $data = fuel_model('my_model'); foreach($data as $key => $val): echo $val->my_prop; endforeach;
You can create a field type of "custom" which you can pass it a "func" parameter that refers to a function or class/method:
$fields['shifts'] = array('type' => 'custom', 'func' => 'my_func'); // or using a class/method $fields['shifts'] = arr…
To flash an error you can use the add_error method on your model. The module controller will check that and if there are any errors, it will add that to the notification area. Otherwise, it will flash green stating that the data was saved.
Can you try implementing the second method with the show_archived property on the model and then adding the following near the end of your list_items method to see what the query is to provide some insight:
$this->debug_query();
Also, the method …
We normally will use the view itself to generate the data results and then pass it to the block (as in above). You could create a controller that performs that logic, then passes it to the view, then passes it to the block, but that is one of those …
There is a "vars" parameter you can use to pass variables to the block like so:
<?=fuel_block(array('view' => 'my_block', 'vars' => array('my_var1' => 'my_var_value1')))??
You could try removing it from the list_items method and then adding it in your controller methods like below:
function items(){ $this->model->db()->where(array('archived' => 'no')); $this->items(); } .... function archives…
That may be a good place to start. If you need to limit access to just the author, you will need to add some user specific query logic in your model in certain areas. For example, in the list_items method you may want to add the following user speci…
You can specify them in your MY_fuel_modules.php file for the particular module you are creating. As an example, look at the fuel/modules/fuel/config/fuel_modules.php
'default_col' => 'location', 'default_order' => 'asc',