Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: improve route_to() and url_to() #6233

Merged
merged 5 commits into from
Jul 8, 2022

Conversation

kenjis
Copy link
Member

@kenjis kenjis commented Jul 5, 2022

Description
Fixes #6223

Checklist:

  • Securely signed commits
  • [] Component(s) with PHPDoc blocks, only if necessary or adds value
  • [] Unit testing, with >80% coverage
  • User guide updated
  • Conforms to style guide

@kenjis kenjis added the documentation Pull requests for documentation only label Jul 5, 2022
Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

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

I know the examples are trying to demonstrate how to use route_to() but I would prefer we remain strict about routes vs. URIs. I can't think of a scenario where route_to() would ever be output to HTML - it is an internal tool.

@@ -5,6 +5,6 @@

?>

<!-- Generate the relative URL to link to user ID 15, gallery 12: -->
<!-- Generate the URI path (route) to link to user ID 15, gallery 12: -->
<a href="<?= route_to('Galleries::showUserGallery', 15, 12) ?>">View Gallery</a>
Copy link
Member

Choose a reason for hiding this comment

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

We should never use a route I place of a URL, bad practice.

Copy link
Member Author

Choose a reason for hiding this comment

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

Replaced route_to() with url_to().

@@ -5,6 +5,6 @@

?>

<!-- Generate the relative URL to link to user ID 15, gallery 12: -->
<!-- Generate the URI path (route) to link to user ID 15, gallery 12: -->
<a href="<?= route_to('user_gallery', 15, 12) ?>">View Gallery</a>
Copy link
Member

Choose a reason for hiding this comment

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

Same.

Copy link
Member Author

Choose a reason for hiding this comment

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

Replaced route_to() with url_to().

@kenjis
Copy link
Member Author

kenjis commented Jul 5, 2022

I can't think of a scenario where route_to() would ever be output to HTML - it is an internal tool.

You are correct!
We have less use cases for route_to().

@kenjis kenjis requested a review from MGatner July 6, 2022 00:22
Copy link
Member

@MGatner MGatner left a comment

Choose a reason for hiding this comment

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

The URL Structure section is a very nice addition.

@kenjis kenjis merged commit 6b077b7 into codeigniter4:develop Jul 8, 2022
@kenjis kenjis deleted the fix-docs-route-to branch July 8, 2022 01:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Pull requests for documentation only
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Docs: route_to() logic
2 participants