简体   繁体   English

php论坛建设,输入设置栏(粗体,……链接等),如何申请?

[英]php forum building, input settings bar (bold,… links.. etc), how to apply?

Ok , so I am creating a forum, I have successfuly installed the BBcodeParser PEAR package, everything works perfectly. 好的,所以我正在创建一个论坛,我已经成功安装了BBcodeParser PEAR软件包,一切正常。

Now when someone wants to write a new topic, he has a bar, to turn text into bold for example. 现在,当有人想写一个新主题时,他有一个酒吧,例如将文本变成粗体。

Now how can I apply the BBcode based on the user's request?. 现在如何根据用户请求应用BBcode? (for example , when he marks some text and clicks on the [B] button, how can I make that text bold?) (例如,当他标记一些文本并单击[B]按钮时,如何使该文本变为粗体?)

It sounds simple to me, I just add [b] before , and [/b] after that text he marked, but I realy need a hint on where to start , and do I need javascript? 对我来说,这听起来很简单,我只在他标记的文本之前添加[b],在其后添加[/ b],但我确实需要提示从何处开始,是否需要JavaScript? , should I do it with buttons or hyperlinks? ,我应该使用按钮或超链接吗?

And when he clicks the B button, I dont want to refresh the whole page... 当他单击B按钮时,我不想刷新整个页面...

thank you very much for your help in advance. 非常感谢您的提前帮助。

It's simple and clear. 简单明了。 When you want to do something depending upon some user action you need javascript. 如果您想根据某些用户操作来执行某项操作,则需要使用javascript。 And to make it much easier, you could use some javascript library (my fav jQuery). 为了使其更容易,您可以使用一些javascript库(我最喜欢的jQuery)。 It's good to write your own code if you really want to learn but there are plenty of plugins available for what you want to do. 如果您确实想学习,最好编写自己的代码,但是有很多插件可以满足您的需求。 Both in php and javascript. 无论是在PHP和JavaScript。 With javascript you can generate quick preview of what user is entering and with php you can parse the shortcodes (like [b]I'm bold[/b] into equivalent I'm bold and store it in database for future uses. I'd suggest you to google and start from there. Study the editor provided here on stackoverflow. Much lighter than other alternatives available but still rich in usability. 使用javascript,您可以生成用户输入内容的快速预览 ,而使用php,则可以解析短代码(例如[b]我是粗体[/ b]等价于我是粗体 ,并将其存储在数据库中以备将来使用。 d建议您使用google并从那里开始。研究此处提供的关于stackoverflow的编辑器,它比其他可用的替代方法轻得多,但仍具有丰富的可用性。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM