Check your image field name in register. I could see that your field name is just image, why do you use loop-thumb-1 in register?
You cannot simply copy my components and paste them into your project. The component parameter need to be adjusted first.
Here is a simple usage example:
I see that you are using 3 custom fields: description, image and sequence.
Your list_page_generator component could then look like this, for example (step by step):
Create controller instance:
Register category:
Define any number of elements per page:
This is the sort field, how items are displayed on the list page (1, 2, 3, ...):
You can put a slug for details page here, for example:
Your custom fields (description, image, sequence) are registered here:
The method returns the item data object. For example, you could use var_dump($items) PHP-function to display what it contains:
The method returns the page data array to generate your pages:
Next, you should create your templates HTML structure. There are two options: Either you create a template file and pass the path as parameter to register script, or script gets a template as a string. I use the second option for my example.
Template containing the HTML for the regular row items (image and title are placeholder for your custom fields):
Wrapper template containing your row template above and pagination:
Register your templates now:
You must loop through the items now and replace the template placeholders with the current item values:
If you want to split items across several pages, for instance, with 'Previous/Next' links:
(2014-07-12, 16:48:49)ak40u Wrote:PHP Code:$manager->runModelMethod('gen_register', array('loop-thumb-1', 'sequence'));
You cannot simply copy my components and paste them into your project. The component parameter need to be adjusted first.
Here is a simple usage example:
I see that you are using 3 custom fields: description, image and sequence.
Your list_page_generator component could then look like this, for example (step by step):
Create controller instance:
PHP Code:
$manager = new ImController();
Register category:
PHP Code:
ImCategory::setCategory('Stores');
Define any number of elements per page:
PHP Code:
ImModel::setPref('itemsperpage', 10);
This is the sort field, how items are displayed on the list page (1, 2, 3, ...):
PHP Code:
ImModel::setPref('sortby', 'sequence');
You can put a slug for details page here, for example:
PHP Code:
// ImModel::setPref('page', 'item-manager-details-page');
Your custom fields (description, image, sequence) are registered here:
PHP Code:
$manager->runModelMethod('gen_register', array('description', 'image', 'sequence'));
The method returns the item data object. For example, you could use var_dump($items) PHP-function to display what it contains:
PHP Code:
$items = $manager->getModelValue('items_ordered_struct');
The method returns the page data array to generate your pages:
PHP Code:
$pagedata = $manager->getModelValue('pagedata');
Next, you should create your templates HTML structure. There are two options: Either you create a template file and pass the path as parameter to register script, or script gets a template as a string. I use the second option for my example.
Template containing the HTML for the regular row items (image and title are placeholder for your custom fields):
PHP Code:
$rowTpl = '
<div class="itemrow">
<p><img alt="" class="mypic" src="[[ image ]]" /></p>
<p>[[ title ]]</p>
</div>
';
Wrapper template containing your row template above and pagination:
PHP Code:
$wrapperTpl = '<div id="my_wrapper">[[ row_tpl ]][[ paginator ]]</div>';
Register your templates now:
PHP Code:
$manager->tplRegister(array('row_tpl' => $rowTpl, 'wrapper_tpl' => $wrapperTpl));
You must loop through the items now and replace the template placeholders with the current item values:
PHP Code:
$rows = '';
foreach($pagedata['itemkeys'] as $key)
{
// Renders placeholders in row template
$rows .= $manager->paint('row_tpl',
array('image' => $items[$key]['image'],
'title' => $items[$key]['title']
)
);
}
If you want to split items across several pages, for instance, with 'Previous/Next' links:
PHP Code:
echo $manager->paint('wrapper_tpl', array('row_tpl' => $rows,
'paginator' => $manager->paginator(ImModel::getTplKit('paginator'))));