Skip to content

Dynamic page loading#3732

Draft
partydragen wants to merge 1 commit into
developfrom
dynamic-page-routes
Draft

Dynamic page loading#3732
partydragen wants to merge 1 commit into
developfrom
dynamic-page-routes

Conversation

@partydragen

Copy link
Copy Markdown
Member

Add dynamic page loading, Allows to eaiser create friendly urls and having ids in path
such as

/community/{id}
/community/{id}/edit
/community/{id}/edit/members

current old behavior does not allow this ^^ other than smashing it all into same page, now we can properly split it all into own files

Comment thread index.php
Comment on lines +112 to +117
foreach ($all_pages as $page_route => $page) {
$regex = preg_replace(
'/\{([a-zA-Z0-9_]+)\}/',
'(?P<$1>[^/]+)',
$page_route
);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe explain through a comment here what this code does instead of letting users guess

Comment thread index.php
Comment on lines +124 to +126
if (!is_int($key)) {
$route_params[$key] = $value;
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mention why this is_int is needed, this is a side effect of the regex constructed earlier and the named parameters

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants