douyi7055 2010-02-22 01:27
浏览 35

建议:在PHP中构建一个非数据库驱动的简单CMS [关闭]

I'm working on a site which requires a very simple CMS - basically there's a block of text on the homepage that needs to be editable by the client. Their current hosting plan doesn't allow for a database, and including one will cost an extra $X a month which I think is unnecessary for such a basic system.

The site is currently built using Codeignitor. I'm planning to write the CMS part of it using either flat PHP or TXT files, are there alternative methods worth considering, and what are the pros/cons?

  • 写回答

5条回答 默认 最新

  • douliaodun9153 2010-02-22 01:36
    关注

    I once solved this problem by simply putting markers in an HTML file, as HTML comments, and then had my PHP script parse the file and insert the desired text in between the markers. Done this way, you need no other files other than the PHP that handles the form submission from the CMS and a static HTML page.

    In words, read the file into a string, explode() the string using the marker as the delimiter, modify the second (if you have a single editable section enclosed by the markers) array element to contain the new text submitted by the user, then implode the array back into the string, then write the string back as the complete file.

    评论

报告相同问题?

悬赏问题

  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 AT89C51控制8位八段数码管显示时钟。
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测