How to customize the views of browse results
When I browse objects
, collections
, entities
or events
,from the browse menu, all the results are shown in one page along with images (object representations) of each item. How can I accomplish the following:
1] Restrict the number of results to a specific number per page.
2] Avoid showing of the images in listing certain categories (say, the entities
)
Comments
Hi Parasmoni,
1) In the file pawtucket/themes/YourTheme/conf/browse.conf, you'll find:
You can increase/decrease this number.
2) I'll search this later.
So, for 2), I found a trick that needs to customize the source code... (Maybe there is a better way but...)
If you want to remove representation only for entities in the image browse results. If fact, it is like the list browse result but without images. So you have to edit the file:
pawtucket/themes/YourTheme/views/Browse/browse_results_list_html.php)
Always make a backup of the original file!
So, open the file and find around line 143 the following code:
(As you see, this part has been already customized by me, by commenting the display of idno that I don't need to display in my case...)
The image is inserted at the instruction:
{$vs_rep_detail_link}
So if you need to remove it only for entities, you have to copy this whole part and past just after, include it in a
if
statement, and delete the{$vs_rep_detail_link}
So you will have this:
The lines just after that should be:
Save the file. Then flush the cache directory (pawtucket/app/tmp).
Try it now by choosing Browse, Entities and selecting the list display mode.
If it is as you expected, then you can disallow the image display mode, by editing the file:
pawtucket/themes/YourTheme/conf/browse.conf
and delete the line
which is inside the block
views = {...}
of entities block.Hi darrigan,
Thanks for your so kind and elaborate responses towards my queries. After attempting your suggested methods, I would like to say the following:
1] I indeed spotted the
defaultHitsPerBlock = 36
inTheme/conf/browse.conf
file, but it is actually not working. I tried with several numbers in addition to the default 36, but all my records are shown in one page, scrolling down too far below to accommodate all records.2] Regarding the removal of the images of entities in the list view, I pasted your codes exactly in the manner you described. The result indeed omitted the images, but the entire layout the page became very deformed. I have attached a screenshot of the result here.
However, your final advice is useful to me. I have deleted the "image view" option and kept only the "list view" for entities in the
theme/conf/browse.conf
file, and the result is pretty close to what I wanted.Once again, I am grateful to you for responding to my queries in such a kind and helping manner. Probably you have already realized that I do not have much knowledge of such kind of programming. But your continuous help has made it possible for a novice like me to learn Collective Access to a great extent.
By the way, I have few more queries for you and I will look for your replies.
π
Hi Parasmoni,
You're welcome! π 5 years ago when I started using CollectiveAccess, I asked a lot of questions like you. The questions of other people on this forum have helped me a lot. So it's normal to give back my help now! Also, by trying to help with some issues, I also learn a lot myself. π
@darrigan
What else can be looked into for my 1st problem (no. of items per page)? In my case, the
Browse>>Objects
page displays 100 records in one page, despitedefaultHitsPerBlock = 36
in thetheme/conf/brows.conf
. And the items beyond 100 are not shown by default, though I can find them through the search.Also, will it be possible to do the sorting of results one basis of the date of data entry (asc or desc)?
Cleared your cache? Empty the contents of /app/tmp
@brucek
Yes, I cleared the cache, emptied the app/tmp folder, rebuilt the search and hierarchical indices......but no result!
Hi Parasmoni,
Is there a public URL we can visit to see the problem?
For sorting option, yes it's possible, in
themes/YourTheme/conf/browse.conf
, you can specify which metadata are used to orderFor example, look at the block
sortBy = {...}
andsortDirection = {...}
here:If you want to order by date (coverageDates), by default, put it at first position:
Thank you @darrigan
Unfortunately my site is still running on the localhost on LAN without public URL. But I am going to make it public soon and I shall be happy to make you have a look on it.
The following codes did not work for me.
But one of your earlier suggestions in a different discussion (
https://collectiveaccess.org/support/index.php?p=/discussion/comment/325137#Comment_325137
) in this forum has worked nicely for me. So my working codes are:Thank you once again for your help.
Two more things I need to learn from you on this topic of discussion:
1] How can I do similar sorting for the galleries? I want to sort the list of galleries (by
coverageDates
) in the Featured Galleries section on the home page, and also on the Gallery link of the navigation menu? I tried in theTheme/conf/gallery.conf
but I was not able to do that.2] Secondly, I need your help on how to configure the Timeline view. When I click on the Timeline view for Browse>>Objects, it says ERROR: Timeline configuration has no events.
Thanks in advance.
Hi,
1) Galleries are populated with public sets of arbitrary items (object type only). You can order items in the set as you want, but as far as I knows, it is not possible to order objects automatically according to their date (coverageDates) or other metadata (name, etc.). You have to organize them "by hand" by sliding items in the order you want in the corresponding set.
2) For a browsing by Timeline, your objects must have a
coverageDates
specified. If not, they will not be displayed in the timeline. If you get "ERROR: Timeline configuration has no events", that's mean the timeline function is not able to get a valid date information from your objects. For example,coverageDates
are not specified for your objects, or you timeline is not configured to usecoverageDates
as the paramater to be considered. When you look at the piece of code I gave you on February 16, you see:By default, I think that the considered metadata was:
data = ca_objects.creation_date,
But in my case, as I was not using
creation_date
, butcoverageDates
, I changed it. So adapt it for your case!Thank you so much darrigan. I have got my timeline view working now, following your instructions. Also I am wiser now about the galleries.
I am deeply grateful to you for your continued support. πππ