Add zrl parameter support #41

Merged
MrPetovan merged 8 commits from task/24-add-zrl-parameter-support into master 2020-06-14 09:37:06 +02:00
MrPetovan commented 2020-06-13 19:32:03 +02:00 (Migrated from github.com)

Closes #24

I've long wondered how to best support the zrl parameter within the Slim framework context. I was stuck for a while because I needed to find the intersection of the Request object that contains the query parameter, the Router to generate URLs for routes including the parameter, and the Renderer to append the parameter to external URLs (not handled by the internal router).

The solution was to use a midlleware class to extract the query string parameter from the request and store it as an attribute of the Renderer, then have the Router be a dependency of the Renderer, then write two Renderer helper methods to append automatically the zrl parameter to route URLs and external URLs repsectively.

Then I had to replace all the hard-coded URLs in the templates with either method calls.

In the end, it was easier than I initially expected, but it took me a while to wrap my head around the dependency injection philosophy I'm trying to use through Slim.

Closes #24 I've long wondered how to best support the `zrl` parameter within the Slim framework context. I was stuck for a while because I needed to find the intersection of the Request object that contains the query parameter, the Router to generate URLs for routes including the parameter, and the Renderer to append the parameter to external URLs (not handled by the internal router). The solution was to use a midlleware class to extract the query string parameter from the request and store it as an attribute of the Renderer, then have the Router be a dependency of the Renderer, then write two Renderer helper methods to append automatically the zrl parameter to route URLs and external URLs repsectively. Then I had to replace all the hard-coded URLs in the templates with either method calls. In the end, it was easier than I initially expected, but it took me a while to wrap my head around the dependency injection philosophy I'm trying to use through Slim.
annando commented 2020-06-13 19:59:15 +02:00 (Migrated from github.com)

91 files? Uff

91 files? Uff
AlfredSK commented 2020-06-13 20:04:36 +02:00 (Migrated from github.com)

It's mostly the email change. :-)

It's mostly the email change. :-)
MrPetovan commented 2020-06-13 23:03:35 +02:00 (Migrated from github.com)

Yeah, going commit by commit is recommended.

Yeah, going commit by commit is recommended.
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: friendica/friendica-directory#41
No description provided.