Blog Layout for Site View / Less Items shown #655
-
Hello, I made a component which shows preview images of all entries from the Admin View in the frontend. Therefor I would like to create a blog layout like it's done in the com_content component. Is this possible within JCB or is it possible to override the default list limit for the pagination somehow? The goal is to show less entries per page then inherited from the default list limit from Joomlas global config in the end. Thanks already ^^ |
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 1 reply
-
The dynamic get has a method to load all, or use pagination. When you have a getListQuery get... so turn it off... You will see that JCB adds this code to the model inside the // Make sure all records load, since no pagination allowed.
$this->setState('list.limit', 0); This means if you set pagination to yes... this line will not be added. But you can in the custom code area, under the Custom Script tab add this line with your own numbers, like this: // Make sure only three records are loaded
$this->setState('list.limit', 3); Pagination is only applicable to getListQuery option though as you can understand the whole class must know about what is happening, and so managing that per method in the class is too tricky. So if you want to work with pagination... look at this issue as it helps you see the placeholder options you will have in the site view to place stuff where you want them. |
Beta Was this translation helpful? Give feedback.
-
Thanks a lot already, so lets see: Since I use "Custom" within the Main Source of my DynamicGet (getListQuery), I deactivated the pagination and added the line below: It worked so far and limited the shown entries. Now I simply added the given placeholders in the Site View but they're only converted if I turn on the pagination in the DynamicGet again. I guess I got something wrong, I'm not that much into the Joomla code yet. Thanks for your help already BTW: I had to use "Custom" since I saw the Filter Type "tags" is not ready yet. Can you tell me about the prio of this feature and when it might be done? |
Beta Was this translation helpful? Give feedback.
-
I had a further look to substantiate my question: I see that the View Class has no pagination object if I turn off the Pagination in the dynamicGet. Therefor I guess the pagination placeholders are not converted since this probably happens in the Pagination object. But I couldn't find how exactly the setCustomViewBody() from the linked thread is used. So I still wonder: If I reduce the number of called entries, is it even possible to add a valid pagination? I also couldnt find the example in Sermon Distributor, nor in the JCB nor in the component. Could you tell me where to find it? |
Beta Was this translation helpful? Give feedback.
-
In my last respond I stated very clearly that you can only do this with the getListQuery option. Not sure why you even trying a custom get... it will not work.
The custom get option, can be limited with the next ID but building that will require lots of custom PHP write. I would probably use Ajax to load that part of the page, with my own buttons to load more and page the data set. JCB's Ajax functionality is very powerful and simple if you understand how it works. For that watch this tutorial. |
Beta Was this translation helpful? Give feedback.
-
Thanks for your response. Sorry for the missunderstanding: I'm no native english speaker and even if my english is good, it's possible that I miss some details sometimes, even if I've read the answer multiple times. Indeed I got it to work now, even without Ajax, I just wonder: I see that the limitbox (which is not needed anymore) is set automatically outside the template code and placed inside the template code if I use the [[[Limitbox]]] placeholder. Is there a way to fully hide it, too? |
Beta Was this translation helpful? Give feedback.
-
Hi, thanks again ^^ This would be indeed excellent!
Edit: I recognized it would be indeed very useful to have such "negative" placeholders for all pagination placeholders. why? I had to change the div-class inside the pagination to another one (wanted to use the K2-Pagination style since I use K2, too). This way only possible by directly adding the pagination php with another div-class inside the site template and then submitting all the placeholders inside a html-comment to avoid the automated generation of the pagination oursite the site template. Beside this: You mentioned a high PHP effort if I still do a custom pagination with PHP and recommended Ajax. My solution is just adding this method to the model methods of a custom button (was the easiest way I found to add a method to the model):
..more or less a part of the populateState method from the com_content. This method in addition with this snippet But now I worry a bit: Did I overlook something which I now accidently broke? |
Beta Was this translation helpful? Give feedback.
The dynamic get has a method to load all, or use pagination.
When you have a getListQuery get... so turn it off...
You will see that JCB adds this code to the model inside the
getListQuery
method.This means if you set pagination to yes... this line will not be added. But you can in the custom code area, under the Custom Script tab add this line with your own numbers, like this:
Pagination is only applicable to getListQuery option though as you can understand the whole class must know about what is happening, and so m…