用于编辑新闻帖子的简单 CakePHP 文本标记解决方案

发布于 2024-08-01 13:00:16 字数 458 浏览 6 评论 0原文

当第一次在网络上搜索简单的 CakePHP 方法来转换小新闻帖子(由非技术人员编写)时,我在 TextHelper 中找到了 flay 方法。 然而事实证明它已被弃用,引用带有 SmartyPants 的 TextileHelper

Textile 似乎确实是一种非常有能力的标记语言。 尽管如此,恐怕对于非技术作家来说这还是太复杂了。 他想要的只是能够编写由双换行符分隔的段落,并按原样插入超链接。

有没有一种简单且不臃肿的方法来使用 CakePHP 实现这一目标?

When first searching the web for a simple CakePHP way to convert small news posts (written by a non-technician) I found the flay method in TextHelper. However it turned out that it has been deprecated, referencing to TextileHelper w/ SmartyPants.

Textile indeed seems to be a very competent markup language. Nevertheless, I'm afraid it is to complicated for the non-technical writer. All he want is to be able to write paragraphs separated by double new-line and hyperlinks inserted just as they are.

Is there a simple and non-bloated way to achieve that with CakePHP?

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

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

发布评论

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

评论(2

三生池水覆流年 2024-08-08 13:00:16

像 Textile 或 Markdown 这样的语言(例如在 stackoverflow 上使用) 我认为,对于习惯于在“普通模式”下编辑文本并且具有一定技术背景的人来说非常有用...

但对于不理解的“真正的普通人”关于计算机就这么多,它们并不是真正的用户友好型,也不具有容错能力 :-( - 而且与 MS Word 相差太远了 ^^

即使是我,了解为什么使用这些语言以及它们是如何工作的,也经常不得不编辑我在 SO 上的帖子,因为出现诸如“没有在正确的位置插入空行来识别这个或那个”之类的错误:-(

对于用户来说,一个很好的解决方案是使用某种所见即所得编辑器,这样他们就可以输入文本,使用一些看起来像 MS Word 的小图标来格式化它,等等。

常见的例子这些是

  • TinyMCE (此链接指向“简单演示”页面,该页面可能是正是您的用户所需要的)
  • FCKeditor

它们并不难集成到现有应用程序中,并且确实可以让您的后台更加人性化!

并且,根据编辑文本的用途,您可能会激活更多或更少的选项,以最适合他们的需求。

但还有很多其他;-)

这意味着您将 HTML 文本存储在数据库中; 并且,出于安全原因,您可能需要使用 HTMLPurifier 之类的工具对其进行清理。

Languages like Textile or Markdown (used on stackoverflow, for instance) are great for people that are used to editing text in "plain mode", and have a bit of technical-background, I think...

But for "real normal people" that don't understand that much about computers, those are not really user-friendly, nor fault-tolerant :-( -- and are too far away from MS Word ^^

Even I, who understand why those languages are used, and how they work, often have to edit my posts on SO because of errors like "not inserting an empty line at the right place to get this or that recognized :-(

A nice solution for your users would be to use some kind of WYSIWYG editor, so they could type in their text, use some little MS Word-looking icons to format it, and all that.

Common examples of those are

  • TinyMCE (this link points to the "simple demo" page, which might be just what your users need)
  • FCKeditor

They are not that hard to integrate in an existing application, and can really make your backoffice more user-friendly !

And, depending on the use editing text, you might activate more or less options, to best fit their needs.

But there are lots of others ;-)

It would imply that you store HTML text in your DB ; and, for security reasons, you might want to sanitize it using something like HTMLPurifier.

满栀 2024-08-08 13:00:16

我认为如果只有几个成员,您可以创建自己的标记集。 处理这些标记很容易,您只需在提交后使用正则表达式替换它们即可。

另一个解决方案是将 JavaSctipt WYSIWYG 添加到您的站点。 像 TinyMCE 这样的东西可以让编辑变得更加轻松。

I think you could create your own markup set if it will only have several members. Handling those marks is easily, you just need to replace them using regular expressions after submit.

Another solution is to add a JavaSctipt WYSIWYG to your site. Something like TinyMCE could make editing even less painful.

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