从 SQLite 3 数据库导出 HTML 文件(Ruby on Rails 应用程序)
我是 Ruby on Rails 的新手,正在考虑将其用于我需要创建的应用程序。故事是:
我正在使用railsgeneratescaffoldPageurl:stringparent:stringcontent:text来创建Pagescaffold。因此,我们可以将页面的 URL (hello-there.htm
)、父文件夹 (my-folder
) 以及大量文本、图像等输入到 Web 中形成并保存。
一旦这一切都在 SQLite 数据库中,就需要将其导出到大量 HTML 文件中。因此,在磁盘上的某个地方,我需要创建每个父文件夹,并填充 HTML 文件,这些文件本身包含内容(加上静态页眉/页脚):
other-folder/index.htm
other-folder/another-file.htm
my-folder/hello-there.htm
抱歉,我知道这是一个非常模糊的问题。我的直觉说我可以/应该使用一个导出视图/控制器(localhost:3000/export
),它上面有一个大按钮?但如果你有什么东西,任何我能读到的东西,我将不胜感激。修改每个页面的视图 (localhost:3000/pages/12
) 很容易,但是当我需要加载实际的 .htm
文件时该怎么办?
我希望我可以发布一些代码,但显然还没有任何代码:(
干杯,
Alex
Maran 链接到下面的 Webby,它看起来非常适合我的需求!
I'm new to Ruby on Rails, looking at using it for an app that I need to create. The story is:
I'm using rails generate scaffold Page url:string parent:string content:text
to create a Page scaffold. So we can then input a URL (hello-there.htm
), a parent (my-folder
) and lots of text, images, etc for the page into a web form, and have it stored.
Once this is all in the SQLite database, it needs to be exported to lots of HTML files. So, on disk somewhere, I need each parent folder to be created, filled with HTML files which themselves contain the content (plus a static header/footer):
other-folder/index.htm
other-folder/another-file.htm
my-folder/hello-there.htm
Sorry, I know this is a really vague, hand-wavy question. My gut says I could/should use an Export view/controller (localhost:3000/export
) which has a big button on it? But if you have something, anything I could read, it would be appreciated. Modifying the view for each page (localhost:3000/pages/12
) is easy, but what do I do when I need loads of actual .htm
files?
I wish I could post some code, but obviously there isn't any yet :(
Cheers,
Alex
Maran links to Webby below, which looks perfect for my needs!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
(我自己回答这个问题,只是为了让它显示为答案)
Maran 链接到 Webby,一个静态站点生成器,在评论中。这实际上就是我一直在寻找的东西。
(Answering this myself, just so that it shows up as answered)
Maran linked to Webby, a static site generator, in the comments. This was actually what I was looking for.