I’m trying to make my own small portfolio with kirby. For the moment everything works really good, except one issue with my slider.
I have my slider images in a separate folder called “slider” and something with my code seems to be wrong. I only know php a little bit, so I#m not sure about what is wrong. I already tried some different variations of this snippet, with brackets and with etc. but I didn’t get it working for 2 days, so I thought I have to ask the experts.
Yes, I want to link to a specific project, that’s why I have this extra meta information… I happened, that I couldn’t see anything from the content under the slider. The slider folder is located in the normal content folder.
But I solved this issue 2 minutes ago. I just forgot to close the img-tag in the end. The snippet works perfect now But thank you anyway! When you think about it for too long you oversee the basic mistakes -.-
Looks like you have to pass some variables to the snippet call:
snippet('plg-carousel', array(
'currentPage'=>$page,
'preNormal'=>'optional html to add before carousel',
'preAlt'=>'html if snippet is not displayed (for other styles)'
))
My snippet must know the page it has been called from to search for the carousel folder, so you pass the $page object to the snippet.
It’s common in kirby to pass all the arguments to a snippet in an array and currentPage is only the name of the argument, so that I can access the passed information in my snippet.
PS: I think, it would be better, if you had opened a new thread, because your question was not directly associated with this thread.
Or even better: simply write me an email or open an issue on the github page of the plugin directly.