Hi there,
I’ve started using Kirby quite recently and I’m very new to all of this.
Here is a simplified example of the situation i’m in:
I’m able to use informations like <?= $image->title()?>"> quite simply in my html.
But now, i’m making a script that will react when you hover an image.
So I’d like the user to be able to hover any image and be alerted of that image title.
but it’s not working the way i’d like, obviously. the output is : <?= $image->title()?>
I might be missing something but I’m asking for help since I don’t know what.
thanks for the help.
Unfortunately, I’m not sure this is working since the console is giving me this error : Uncaught SyntaxError: expected expression, got '<'
as I add the new const.
I think it would make more sense to store this information in a data attribute in your HTML you can then reference in your script. That way, your JS can live in a script file. If you need more data, calling a route or content representation could be options
It looks like you’re trying to run PHP in a javascript or an HTML file. That won’t work unless you explicitly tell apache to execute .js / .html files as PHP (but you really shouldn’t).
Hi rasteiner,
Seems pretty clear now. I’ll investigate and dig around that.
It’s working and doing what I wanted it to do.
Any documentation I could read to try to understand that better?
And there’s the general concept about “when what is executed where and by whom”. I wouldn’t know a specific authoritative source online for that.
Maybe we can help you better with more specific questions.