Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

Access to personalized scripts

Started by Muut Archive 11 years ago · 1 replies · 219 views
11 years ago

Hello. Awesome tool! Loving it.

Question: I have some home made PHP scripts (contact form, sign up, questionaire,...) that I have already coded in the past. As I am migrating to GRAV, my AJAX calls can't seem to reach the scripts that I placed in my themes directory.

Ex: I have a script

TXT
/user/themes/myTheme/scripts/contactForm.php

But my AJAX request gets a 404. I tried adding a custom Redirect/Route, like so

TXT

Custom Routes
/script/contact    |    /user/themes/myTheme/scripts/contactForm.php
--
Still no luck. 

Thanks in advance for your help.
11 years ago

I would strongly advise you to convert your php scripts into Grav plugins. Ajax is natively supported by Grav by returning data as json. You can see an example of this in the simplesearch plugin, and we're using it actively in the learn2 theme for example.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1346 9 years ago
Archive · by Muut Archive, 9 years ago
2 933 9 years ago
Archive · by Muut Archive, 9 years ago
2 4060 9 years ago
Archive · by Muut Archive, 9 years ago
1 2945 9 years ago
Archive · by Muut Archive, 9 years ago
3 1117 9 years ago