Forum
Get album by id
I come up with some questions from a recent project, hope someone can help me with these.
Is there a way to use
perch_gallery_image()
by image slug instead of ID?I can get image's parent album's ID by
perch_gallery_image()
, can I get an album's detail usingperch_gallery_album_images()
by it's ID? If not how can I get album's slug in this case?- I have created a image upload box to upload cover for an album on the master template
<perch:gallery id="cover" type="image" label="Cover" key="small" width="320" height="320" crop="true" />
How can I refer to this image? If I use
<perch:gallery id="cover" />
it refers to the original image; if I use
<perch:gallery id="small" />
it refers to the small version of the first image in albums. How can I refer to the small version of the cover?
On the sidebar I want to have a gallery navigation dynamically. Level 1 is album name, level is image name. If it is on a specific image or album page, this album opens and other album close(not having level 2)
Can I have category for multiple items region? Just that I can go into each category to add new items. If not, how to implement thing like this?
How to output file size, file type, and upload date of a file uploaded by a
<perch:content id="download" type="file" label="File" />
Thanks,
No, you need an ID, which you can get when displaying the album.
It should be
albumID
on the image.Use
Ok. Where are you having problems?
You can add a field for a category, yes.
output="size"
https://docs.grabaperch.com/docs/templates/attributes/type/file/
In future it's better to stick to one question per thread. As soon as you have further feedback on any of these six points, this thread is going to become very hard to manage and thus it'll be hard for me to help you.
Sorry if I didn't describe it clearly.
perch_gallery_album_images()
requires album slug, but I can only get albumID fromperch_gallery_image()
, in this case how to useperch_gallery_album_images()
?Problem is how to achieve this? Can you show it with example?
I have just added this
Then how to filter them by categories in the CMS? Just want to make it easy to use for admins, they can target and go in a specific category to add record.
~output="size"~ works for me, what about file type, and upload date of a file
Ok, how do you want me to continue this if I still have future feedback on these 4? Thanks
Can you advice on this as well
I used this before without problem, but on this project using 'contains' doesn't give me results I want, it returns nothing. If I use 'eq' it works for me, not sure if syntax/keyword are changed on this version of perch, 2.5.4
Also how to filter multiple fields? like php and / or?
Can you turn debug on and show me the query it outputs for the filter?
Any answer to my first reply?
We don't have an upload date for a file unless you've added a field to capture that.
You'd use a filter to filter for the category
Found this syntax error
This is the only question left in this post, other unsolved issues have been raised in different posts.
Yes, that looks like a bug. I'll get it fixed.
Hi Drew,
When can this be done? Can you notify me on this post when you finish?
It will be in the next release of Blog.
Hi Drew,
When will the next release be released?
In addition to this, I found something weird. I use filter to implement a search function like this
It works perfectly when I type in the full word without space. But if I put part of the word in the search box, it doesn't work. Say my target string is "Test File 1",
"test" works
"test " no
"tes" no
"test file" works
"test file " no
"test fi" no
Following is sample debug code
We test against word boundaries.
Is there anyway to filter this like what we can do in mysql?
How would you do it in MySQL? If you give me an idea what you're looking to do I can point you in the right direction.
Something like this
?s are parameters to be bound
I think the closest we have to a LIKE is the
regexp
match option, which enables you to give a regular expression as the value.https://dev.mysql.com/doc/refman/5.0/en/regexp.html
Thank you, it works for me, and also using regex can bypass the blog's bug. Here come another issue: why doen't this multiple filters work for blog?
It returns no error. The debug code indicates that it completely ignores the multiple filters
Similar code works on perch_content_custom()
Multiple filters are coming in the next update.