本文介绍了Symfony 作为 Wordpress 插件开发的帮手的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经看到了 wordpress 和 symfony 之间的几个集成,但它们的目标是在 wordpress 和 symfony 中管理静态页面内容作为控制器.

I have seen several integrations between wordpress and symfony, but they are made with the goal of managins static pages content inside wordpress and symfony acting as the controller.

Wordpress 插件开发 api 看起来非常基本和原始,您无法使用开箱即用的 MVC 模式编写代码.所以最大的问题是,在 wordpress 中创建插件并在其中创建管理部分的起点是什么,但是使用 Symfony 的力量来管理数据库访问、表单创建和验证等......

Wordpress plugin development api seems really basic and primitive and you have no way o code with the MVC pattern out of the box. So the big question is, what would be an starting point to create plugins in wordpress, and create admin sections in it, but using Symfony power to manage database access, form creation and validation, etc .....

推荐答案

我曾简要考虑过将 Lithium 与 WordPress 集成的类似方法,但遇到了很多障碍,使另一种方法看起来更有价值:创建一个 MVC 框架这是专门为在 WordPress 内部工作而设计的.

I had briefly considered a similar approach for integrating Lithium with WordPress, but ran into a great deal of hurdles that made another approach seem more worthwhile: create an MVC framework that was specifically designed to work inside of WordPress.

它还没有像 Symfony、Rails 等那样功能齐全,但是 WP MVC 具有与主要的架构相似的架构MVC 框架,如果您熟悉它们,应该很容易上手.它与现有的 WordPress 功能直接相关.例如,当您为资源创建脚手架时,创建的代码包括管理控制器和管理视图(看起来类似于 WordPress 的原生索引/添加/编辑帖子视图),以及适当的 WordPress 路由和公共控制器和公共索引/显示视图,以在活动主题内在公共端显示资源.

It's not yet as full-featured as Symfony, Rails, etc, but WP MVC has similar architecture to the major MVC frameworks and should be easy to pick up if you're familiar with them. It ties in directly with existing WordPress functionality. When you create scaffolding for a resource, for example, the code that's created includes an admin controller and admin views (which look similar to WordPress's native index/add/edit views for posts), as well as the appropriate WordPress routing and a public controller and public index/show views to display the resource on the public side, within the active theme.

在它的 WordPress 插件页面 和它的 简要教程 可能会使它看起来不那么抽象.

There's more info on it on its WordPress Plugins page, and its brief tutorial may make it seem less abstract.

这篇关于Symfony 作为 Wordpress 插件开发的帮手的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-05 04:59