I have tried PHP_SELF, REQUEST_URI, and SCRIPT_NAME. All of them return slightly different references to the Server Action file, not the page it’s running on.
This is what is returned when using a set value in Server Action, but I would hope this would show the page it’s on, not the Server action file name.
/dmxConnect/api/Security/userDetails.php?
Here’s my action
Here is my code in my header.php server include to display the page/file name
<p dmx-text="userDetails.data.currentPage"></p>
Here’s is what shows on my home page and all of pages that use the header include.
Taking this a step further. If I add the Server variables directly to the header include file then these
<p dmx-text="userDetails.data.currentPage"></p>
<p><?php echo $_SERVER['PHP_SELF'] ?></p>
<p><?php echo $_SERVER['SCRIPT_NAME'] ?></p>
<p><?php echo $_SERVER['REQUEST_URI'] ?></p>
Produce these. This was taken from the ‘projects.php’ page with route ‘projects’
/dmxConnect/api/Security/userDetails.php?
/projects.php
/projects.php
/projects
So REQUEST_URI is what I want to use, but using it in the Server Action is pointless.