PHP平面文件评论引擎 - 设计 [英] PHP flat file comment engine -- Design

查看:63
本文介绍了PHP平面文件评论引擎 - 设计的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问候所有,


我使用的主机不让我拥有mysql所以我需要编写一个使用平面文件的注释引擎。当然除非有可用的评论解决方案不使用mysql。


所以现在让我们谈谈这是如何工作的......(您的意见很赞赏)。我想我们需要一些东西,一个管理面板和UI。用户将需要一个UI,因此我们将有一些字段,可能是名称,电子邮件地址,评论区域和验证码。需要使用验证码来防止垃圾邮件。用户将填写表格,(需要姓名,评论和验证码),评论将存储在某个地方的文件中。现在这是一个有点棘手的地方,因为我不是一个网络程序员,评论存储在一个文件中,该文件需要有某种标识符,将其映射到正在评论的页面。然后渲染php将获取文件中的注释信息并重新加载页面,并在底部呈现注释。


如何获得初步想法。有没有人考虑过没有考虑的重要案件?我们还没有看过这方面的管理方面,但是我希望在开始之前让一方工作。

Greetings all,

The host I use does not let me have mysql so I am going to need to write a comment engine that uses flat files. Unless of course there are commenting solutions already available that do not use mysql.

So now lets talk about how this is going to work... (your input is appreciated). I think we are going to need a couple things, an admin panel and the UI. The user is going to need a UI, so we will have a few fields, probably name, email address, comment area, and a captcha. Captcha is needed to prevent spam. The user will fill out the form, (name, comment and captcha will be required) and the comment will be stored in a file somewhere. Now this is where it gets a little tricky because I''m not a web programmer, the comment gets stored in a file, the file will need to have some kind of identifier that maps it to the page that is being commented on. Then the rendering php will grab the comment information in the file and reload the page with the comments rendered at the bottom.

How is that for a preliminary idea. Anyone have any thoughts on important cases that have not been considered? We haven''t looked at the admin side of this yet but I want to get one side working before I start in on the other.

推荐答案

Heya,RedSon。


你有几个选择。您可以为每个页面创建单独的注释文件。或者,您可以在每个评论前面加上页面名称。


每种方法都有优点和缺点。


使用单独的文件非常适合在每页上查看评论,但是查看多个页面的评论并不是很好(例如,向我显示最近的5条评论)。


使用一个大文件会让每页查看评论变得更加困难,但聚合的东西要容易得多。


我想你可以创建''index''文件通过为每个注释分配一个唯一标识符,然后创建一个大文件来保存所有注释,然后索引每页列出id号的文件....


这当然取决于你是按每个项目还是每小时获得报酬:P
Heya, RedSon.

You have a couple of options. You could create a separate comments file for each page. Alternatively, you could prefix each comment with the name of the page.

There''s advantages and disadvantages to each method.

Using separate files is great for viewing comments on a per-page basis, but it isn''t quite so good at viewing comments for more than one page (such as, "show me the 5 most recent comments").

Using one big file makes it more of a pain to view comments per-page, but aggregate stuff is much easier.

I suppose you could create ''index'' files by assigning each comment a unique identifier and then creating one big file to hold all of the comments, and then index files that list id numbers per page....

This all depends, of course, on whether you''re getting paid per project or per hour :P



Heya,RedSon 。


你有几个选择。您可以为每个页面创建单独的注释文件。或者,您可以在每个评论前面加上页面名称。


每种方法都有优点和缺点。


使用单独的文件非常适合在每页上查看评论,但是查看多个页面的评论并不是很好(例如,向我显示最近的5条评论)。


使用一个大文件会让每页查看评论变得更加困难,但聚合的东西要容易得多。


我想你可以创建''index''文件通过为每个注释分配一个唯一标识符,然后创建一个大文件来保存所有注释,然后索引每页列出id号的文件....


这当然取决于你是按每个项目还是每小时获得报酬:P
Heya, RedSon.

You have a couple of options. You could create a separate comments file for each page. Alternatively, you could prefix each comment with the name of the page.

There''s advantages and disadvantages to each method.

Using separate files is great for viewing comments on a per-page basis, but it isn''t quite so good at viewing comments for more than one page (such as, "show me the 5 most recent comments").

Using one big file makes it more of a pain to view comments per-page, but aggregate stuff is much easier.

I suppose you could create ''index'' files by assigning each comment a unique identifier and then creating one big file to hold all of the comments, and then index files that list id numbers per page....

This all depends, of course, on whether you''re getting paid per project or per hour :P



嘿,这完全是为了好玩,但是我喜欢你把它们放在一个文件中的想法。也许我可以有一个排序的树然后它会慢慢增长,很容易索引,并有简单的方法来聚合数据。不确定如何工作......

Heh, this is strictly for fun, but I like your idea about putting them in one file. Maybe I can have a sorted tree then it would grow slowly be easiy to index and have easy ways to aggregate data. Not sure how to work that...


假设你在评论中使''|''字符非法,你可以这样做:
Assuming that you make ''|'' characters illegal in comments, you could do something like this:
展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号


这篇关于PHP平面文件评论引擎 - 设计的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆