Jump to content

RockFrontend AJAX Endpoints


bernhard
 Share

Recommended Posts

Hello Bernhard,
extremely nice feature! I need just such a function 🙂 

I only noticed one small thing, in the documentation it says that it must be a PHP file in the AJAX directory, in the Rockfrontend Config it says the following:

Quote

To create a new endpoint simply add a LATTE or PHP file in /site/templates/ajax

I also tried it with a .latte file and that didn't work. Is this function still missing or is this just a wrong text?

Thank you for your great modules!

  • Thanks 1
Link to comment
Share on other sites

45 minutes ago, bernhard said:

What exactly do you mean by "didn't work"? Steps to reproduce please.

Okay, that's weird…

I tested it in my DDEV environment:

Created the following Folder/files:
templates/ajax/zeitbuchung/ajaxtest.php -> working
templates/ajax/test.php -> working
templates/ajax/test2.latte -> not working, Error 404

Content of the files is only "test"

Checked the URLs in the Rockfrontend Config:
1944271775_2024-10-0210_26_23-Modul_RockFrontend.png.cab64d7cfc9e124fa171a7335abdce91.png

Then testet the Endpoint /ajax/test2.l
Working -> Endpoint: /var/www/html/site/templates/ajax/test2.latte

 

/edit found the problem:

// RockFrontend.module.php

private function ajaxEndpoints(): array
[..]
// attach hook for every found endpoint
[..]
$url = $baseurl . substr($endpoint, strlen($folder), -4);

The -4 is the problem 🙂 
https://github.com/baumrock/RockFrontend/commit/064e37c0bfd4f9ae8377ae122e1b5426b18d52ee#diff-8223503ce304ec3ee54457dad412baf3a6f8701f67cd6fce3422de398e68907aR667

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...