Hi, I’m using Kirby for one year and my love to this peace of software is infinite. Today I was trying to get a PDF URL from a folder. The site is multilanguage, and I have the PDF in English and Spanish. Then I do this to get the PDF I want:
<?php echo $page->parent()->documents()->filterBy('filename', '*=', '.'.$site->language())->first()->url() ?>
And it’s extremely slow, I’m doing it right? there’s a better(automated) way to get that document?
Thanks!
It’s really difficult to say what makes this call slow here. Does your parent directory contain lots of files? Maybe I can have a look at it directly? If so, just send me an email support@getkirby.com
1 Like
Thanks Bastian,
email sent!
I don’t know what the cause is in this case - but if you have many many files in your parent directory this ought to be slow.
@bastianallgeier I just wondered: Is there a reason findBy
doesn’t accept an operator like filterBy
does?
Ok, it seems it was my local server. Thanks for your support!