如何路由到 CakePHP 中的元素?

发布于 2025-01-03 07:36:22 字数 237 浏览 5 评论 0原文

是否接受(并且可能)路由到 CakePHP 中的元素?我有一个侧边栏,我通过一些 ajax 选项卡动态加载内容,但在初始页面加载时,我不想通过 ajax 调用第一个选项卡,我只想用 PHP 显示元素本身。

我认为通过将其移动到一个元素中,我可以只加载我想要的内容,而不是其余的视图元素。

这是一个好的做法吗?我认为 Google 尝试索引特定元素可能存在一些问题,它只会显示内容,而不会显示视图,所以我想我也必须限制该特定元素。

Is it accepted (and possible) to route to an element in CakePHP? I have a sidebar which I'm loading content into dynamically through some ajax tabs, but upon initial pageload, I don't want to have to call the first tab through ajax, I'd just like to display the element itself with PHP.

I figured by moving it into an element, I can load just the content I want, and not the rest of the view elements.

Is this an ok practice? I figure that there may be some issues with Google trying to index the specific element, which would just show the content, and no view, so I guess I'd have to restrict that for this specific element as well.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

爱给你人给你 2025-01-10 07:36:22

路由元素不是好方法。
你必须创建新的动作并将你的元素称为他们的。这样做你仍然可以缓存 cakePHP。

Routing element is not the good way.
You have to create new action and call the your element their. doing this you can still you the caching of cakePHP.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文