cms数据库设计_使用Statamic CMS构建无数据库的网站

news/2024/5/20 2:06:47/文章来源:https://blog.csdn.net/culi3118/article/details/108382733

cms数据库设计

A content management system (CMS) is a package of code around which you build a dynamic website—with components that change, adapt and update automatically, in contrast to a hard-coded, static site.

内容管理系统(CMS)是一揽子代码,您可以围绕这些代码构建一个动态网站-与硬编码的静态网站相比,这些组件具有自动更改,适应和更新的组件。

In this article, Gareth Redfern presents a relatively new type of CMS that’s challenging the more established database-driven model.

在本文中,Gareth Redfern提出了一种相对新型的CMS,它正在挑战更成熟的数据库驱动模型。



Statamic is a flat-file CMS that has been in the wild since 2012.

Statamic是一种平面文件CMS,自2012年以来一直在流行 。

It's built in PHP, and cleverly combines static and dynamic functionality. While some coding skills (HTML and CSS) are required to create a Statamic site, it's very simple to work with—having its own, intuitive templating language, and not requiring any knowledge of PHP.

它内置于PHP中,巧妙地结合了静态和动态功能。 虽然创建Statamic网站需要一些编码技能(HTML和CSS),但是使用它非常简单-拥有自己的直观模板语言,不需要任何PHP知识。

All you need to get going is a code editor and an FTP program to connect with your server, and you can have your own site up and running quickly.

您只需要一个代码编辑器和一个FTP程序来连接服务器,就可以启动自己的站点并快速运行。

There's a handy 38 second video on the Statamic site that shows the CMS in action.

Statamic网站上有一个方便的38秒视频 ,显示CMS的运行情况。

Statamic is a commercial product—$29 for a personal license and $99 for a pro license. That may be off-putting people used to free options like WordPress, but benefits come with this modest price—not least prompt and direct support from the development team.

Statamic是一种商业产品,个人许可证为29美元,专业许可证为99美元。 那些习惯于免费使用诸如WordPress之类的选项的人可能会感到不满,但是这种适中的价格带来了好处-尤其是开发团队的Swift和直接支持。

Version 1 of Statamic doesn’t have a free demo, but version 2—due for beta release and built on top of Laravel—will offer this option.

Statamic的第1版没有免费的演示版,但第2版(应发布Beta版且基于Laravel构建)将提供此选项。

术语 (Terminology)

A flat-file CMS stores all your content in text files, rather than in a database—allowing you the freedom to write content directly in files using Markdown. (This is where the “static” part of the Statamic name comes from.)

平面文件 CMS将所有内容存储在文本文件中,而不是存储在数据库中,从而使您可以自由地使用Markdown在文件中写入内容。 (这是Statamic名称的“静态”部分的来源。)

Statamic is sometimes compared with static site generators such as Jekyll, which run your site through a converter that then produces HTML files for you to upload to your server. Although Statamic does have a static site generator, it requires PHP to run on your server, and is much more dynamic than the likes of Jekyll.

有时会将Statamic与静态网站生成器(例如Jekyll)进行比较 ,后者通过转换器运行您的网站,然后生成转换器供您上传到服务器HTML文件。 尽管Statamic 确实有一个静态网站生成器,但它需要PHP在您的服务器上运行,并且比Jekyll之类的更具动态性。

控制面板 (The Control Panel)

Because Statamic is dynamic, it offers a control panel for adding and editing your content—which means it's a viable CMS to hand off to clients, unlike Jekyll.

由于Statamic是动态的,因此它提供了用于添加和编辑内容的控制面板,这意味着与Jekyll不同,这是一个可行的CMS可以移交给客户。

The control panel is fully responsive, and offers a very clean, easy-to-use interface which both clients and fellow developers love.

控制面板React灵敏,并提供了客户和开发人员都喜欢的非常干净,易于使用的界面。

Statamic Control Panel

The Statamic Control Panel

Statamic控制面板

Although the control panel is available, you don't have to use it, as you can also work directly with text files and upload them as needed.

尽管控制面板可用,但您不必使用它,因为您也可以直接使用文本文件并根据需要上载它们。

版本控制您的完整网站 (Version Control Your Complete Site)

Having your whole site based on simple text files—including the content—carries the great advantage that everything can be version controlled, and even stored and edited in your favorite Git hosting service.

使整个站点都基于简单的文本文件(包括内容)具有很大的优势,即所有内容都可以进行版本控制,甚至可以在您喜欢的Git托管服务中进行存储和编辑。

This removes a lot of the headaches that traditional database-driven websites can give you when it comes to keeping content in sync from staging to production.

这消除了传统的数据库驱动网站在使内容从暂存到生产保持同步方面可能给您带来的许多麻烦。

适合统计的网站类型 (Types of Sites That Suit Statamic)

Statamic lends itself well to the majority of website builds, with some popular blogs and company sites running it as their preferred CMS.

Statamic非常适合大多数网站构建,一些受欢迎的博客和公司网站将其作为首选的CMS。

Of course, if you have a very large, content-heavy site with complex relationships, then a database-driven site may be more appropriate—though personally, I haven’t come across a site that Statamic can’t handle yet.

当然,如果您有一个庞大且内容繁多的网站,并且关系复杂,那么数据库驱动的网站可能更合适-尽管就我个人而言,我还没有遇到过Statamic无法处理的网站。

入门 (Getting Started)

Installing Statamic is very simple.

安装Statamic非常简单。

You can run it locally on a server environment like MAMP or WampServer. You can then transfer everything to your server as needed.

您可以在MAMP或WampServer之类的服务器环境中本地运行它。 然后,您可以根据需要将所有内容传输到服务器。

First you should run a quick server check to make sure your host meets the minimum requirements.

首先,您应该运行服务器快速检查 ,以确保您的主机满足最低要求。

After running the checks, just drop your files into the root of your site and enter some basic config settings in the settings.yaml file, enable the sample.htaccess by renaming it to .htaccess, and you're all set.

运行检查之后,只需将文件拖放到站点的根目录中,然后在settings.yaml文件中输入一些基本配置设置,将sample.htaccess重命名为.htaccess将其设置好。

Updating is even easier: you just need to swap out two folders, _app and admin.

更新更加容易:您只需_app出两个文件夹_appadmin

文件夹结构 (The Folder Structure)

Folder Structure

The standard install comes with two example themes, and content which can be used as a starting point for creating your own theme.

标准安装附带两个示例主题和内容,它们可以用作创建您自己的主题的起点。

All your written content is stored in the _content folder. In that folder, you have two “types”: pages and entries.

您所有的书面内容都存储在_content文件夹中。 在该文件夹中,您有两种“类型”:页面和条目。

Pages are for your more static content, which can still be edited via the control panel, but which tend to be single pages like an “about” page. Entries are more dynamic, being added or updated on a regular basis. Blog or news articles are a good example of this type of content.

页面是为您提供更多静态内容的页面 ,您仍然可以通过控制面板对其进行编辑,但是页面往往是单个页面,例如“关于”页面。 条目更具动态性,会定期添加或更新。 博客或新闻文章就是此类内容的一个很好的例子。

Each content page will have a YAML header—which is basically your template variables and content stored between 3 dashes.

每个内容页面都有一个YAML标头-基本上是您的模板变量,其内容存储在3个破折号之间。

If you haven’t heard of YAML before, it's a very human readable language used for storing data. One important point to remember when you're first starting is that YAML is very specific about indentation (use 2 spaces). Here's an example of a YAML file:

如果您以前从未听说过YAML ,那么它是一种非常易读的语言,用于存储数据。 首先要记住的重要一点是,YAML对于缩进非常具体(使用2个空格)。 这是一个YAML文件的示例:

Example YAML File

主题化 (Theming)

The _themes folder is where you can drop your theme. Statamic is very flexible in how you build it, but by following some conventions you can create themes that are easy to swap out on a site-by-site basis.

_themes文件夹是放置主题的位置。 Statamic的构建方式非常灵活,但是通过遵循一些约定,您可以创建易于在各个站点之间互换的主题。

I've created a simple theme on GitHub for you to refer to as an example following this convention.

我在GitHub上创建了一个简单的主题,供您参考该约定作为示例。

主题的基本解剖 (Basic Anatomy of a Theme)

The folder structure example can be explained as follows:

文件夹结构示例可以解释如下:

  • Layouts are the main structure of your page. Here you'll include partials and templates.

    布局是页面的主要结构。 在这里,您将包括局部和模板。

  • Partials are small reusable chunks of reusable code.

    部分是可重用代码的可重用小块。

  • Templates are content-specific, and usually house the logic for displaying your page content.

    模板是特定于内容的,通常包含用于显示页面内容的逻辑。

Statamic comes with its own templating language that's very straightforward to learn. As an example, I'll run through how you would list your blog entries on a page, linking through to the detailed post.

Statamic带有自己的模板语言,非常容易学习。 作为示例,我将介绍如何在页面上列出博客条目,并链接到详细的帖子。

Open up the _content folder and navigate to the blog folder. You should see the following structure:

打开_content文件夹,然后导航到blog文件夹。 您应该看到以下结构:

Blog Folder Contents

Blog Folder Contents

博客文件夹内容

The articles, which all start with the date 2015-01-01 etc., will be what we're going to list using the entries tag.

这些文章,所有的日期开始2015-01-01等,会是什么,我们正在使用的要列出entries标签。

清单条目 (Listing Entries)

Go to the default.html template in the theme’s template folder and have a look at the {{ entries:listing }} tag pair, which is wrapping the article HTML tags.

转到主题模板文件夹中的default.html模板,并查看{{ entries:listing }}标签对,该标签对包装了文章HTML标签。

Here we've told the entries tag to fetch the listings from the blog folder by using the folder="blog" parameter. We've also set a limit of 2 articles to be listed by using the limit="2" parameter. The entries tag is a tag pair, so you'll see that there has to be a closing tag {{ /entries:listing }} which closes the loop.

在这里,我们告诉了entries标记,可以使用folder="blog"参数从blog文件夹中获取列表。 我们还使用limit="2"参数设置了2条文章的limit="2"entries标签是一个标签对,因此您将看到必须有一个结束标签{{ /entries:listing }}来关闭循环。

The complete listing code looks like below, and inside there are two variables used—{{ url }} and {{ title }}:

完整的清单代码如下所示,并且内部使用了两个变量- {{ url }}{{ title }}

{{ entries:listing folder="blog" limit="2" }}
<article>
<h3><a href="{{ url }}">{{ title }}</a></h3>
</article>
{{ /entries:listing }}

The first tag will render the URL to the single article, and the second tag will render the title of the article. This is the simple listings page all set up: we have two articles listed, which link through to their post pages.

第一个标签将呈现单个文章的URL,第二个标签将呈现文章的标题。 这是所有设置的简单清单页面:我们列出了两篇文章,它们链接到他们的帖子页面。

分页 (Pagination)

The pagination tag is used in conjunction with the {{ entries:listing }} tag to render pagination when there are more articles than you have set within the limit parameter. There are two important points when using the pagination tag.

分页标记与{{ entries:listing }}标记结合使用,以在限制参数中设置的文章数量超过您设置的项目数时呈现分页。 使用分页标签时有两个要点。

1. Matching parameters The folder and limit parameters must match what you've set on the {{ entries:listing }} tag. So, for example, the folder is set to blog on both tags, and the limit is set to 2 on both tags.

1.匹配参数文件夹和限制参数必须与您在{{ entries:listing }}标签上设置的参数匹配。 因此,例如,该文件夹在两个标签上都设置为blog ,并且在两个标签上的限制都设置为2

2. Setting variables Next, we need to set the variables inside the pagination tag pair, which will render the required links depending on what page you're on. You'll see in the default.html template there's a couple of conditional statements used to set the page links. If you're unfamiliar with conditional statements, don't worry too much about what this code is doing. Just know that it'll render the correct links for your pagination to work.

2.设置变量接下来,我们需要在分页标签对中设置变量,这将根据您所在的页面来呈现所需的链接。 您将在default.html模板中看到一些用于设置页面链接的条件语句。 如果您不熟悉条件语句,则不必太担心此代码的作用。 只是知道它将为分页工作提供正确的链接。

{{ entries:pagination folder="blog" limit="2" }}
<div class="pagination">
{{ if previous_page }}
<a href="{{ previous_page }}">&laquo; Previous</a>
{{ endif }}
{{ if next_page }}
<a href="{{ next_page }}">Next &raquo;</a>
{{ endif }}
</div><!-- END .pagination -->
{{ /entries:pagination }}

帖子模板 (The Post Template)

We now have our main listing page rendering all our blog articles. When you click on a article listing link, you're taken through to a post page, and by default this will use the post.html template to render the content.

现在,我们的主列表页面呈现了所有博客文章。 当您单击文章列表链接时,您将转到文章页面,默认情况下,它将使用post.html模板呈现内容。

Open up the post.html template in your code editor, and you'll see that this page only has two template tags title and content. The {{ title }} tag displays the title for the post and the {{ content }} tag will render all the text in your entry file below the YAML header (three dashes at the top of your file).

在代码编辑器中打开post.html模板,您将看到此页面只有两个模板标签标题和内容。 {{ title }}标签显示帖子的标题,而{{ content }}标签将在YAML标头下方显示条目文件中的所有文本(文件顶部的三个破折号)。

How does Statamic know what content to render and which template to use? The secret is in the {{ entries:listing }} tag used in the previous template. With the URL variable set on the link in the default.html template, it dynamically links to the correct page and will always use the following required templates:

Statamic如何知道要呈现的内容和使用的模板? 秘密在先前模板中使用的{{ entries:listing }}标签中。 在default.html模板中的链接上设置了URL变量后,它将动态链接到正确的页面,并将始终使用以下必需的模板:

  • if present: post.html

    如果存在: post.html

  • otherwise, if present: default.html

    否则,如果存在: default.html

  • otherwise: 404.html.

    否则: 404.html

You can override this by setting a _template: my_template variable in your YAML header, but as we haven’t, the post.html template is chosen to render the content. For more information on this, have a look at the documentation.

您可以通过在YAML标头中设置_template: my_template变量来覆盖此设置,但由于我们尚未选择,因此选择了post.html模板来呈现内容。 有关更多信息,请参阅文档 。

社区与资源 (Community and Resources)

One of the great things about Statamic is the amazing community that surrounds it. Asking a question on Twitter using the #statamic hash tag, or on the recent Slack channel, usually gets you an answer straight away.

Statamic的一大优势是它周围的社区。 在Twitter上使用#statamic哈希标签或在最近的Slack频道上提问,通常会立即为您提供答案。

The main support area—called the Lodge—has a wealth of searchable questions and answers. It’s also a great place to ask questions—and again, either a member of the community or one of the Statamic Gentlemen is always on hand to help you.

主要的支持区域(称为“ 小屋”)具有大量可搜索的问题和答案。 这也是一个提出问题的好地方-而且,无论是社区成员还是Statamic绅士集团中的一员,都随时可以为您提供帮助。

There are lots of other resources for learning more about building Statamic sites. There's the add-on stash, featuring a range of add-ons for extending Statamic in all sorts of ways, and builtwithstatamic.com, a showcase of sites built on Statamic. There are also some great videos on Vimeo that show Statamic in action and explain how to do certain things with it. If you're looking for a starter theme, check out my Statarkers Theme. And finally, you can keep up with the latest news on the Statamic blog, and keep tabs on the next version on the version 2 blog.

还有许多其他资源可用于学习有关构建Statamic网站的更多信息。 有一个附加存储区 ,其中包含一系列用于以各种方式扩展Statamic的附加组件,以及buildwithstatamic.com (一个展示基于Statamic的网站的展示)。 在Vimeo上也有一些很棒的视频 ,它们展示了Statamic的实际效果,并说明了如何使用它进行某些操作。 如果您正在寻找入门主题,请查看我的Statarkers主题 。 最后,您可以在Statamic博客上关注最新消息,并在第二版博客上查看下一个版本的标签。

结语 (Wrap-up)

Statamic provides a great platform for building a range of websites. Once you pick up the basics of how to put a theme together, you’ll soon fall in love with its flexibility. The control panel is simple and a joy to use for content editing, but the flexibility is such that you can keep content up to date in simple Markdown files. There's a great flow when developing Statamic sites, as you quickly move from content modeling to content editing easily.

Statamic为构建各种网站提供了一个绝佳的平台。 一旦掌握了如何组合主题的基础知识,您很快就会爱上它的灵活性。 控制面板简单易用,可用于内容编辑,但灵活性使您可以将内容保持在最新的Markdown文件中。 开发Statamic网站时,流程非常顺畅,因为您可以轻松地从内容建模转移到内容编辑。

I hope you've enjoyed this introduction to Statamic. There are lots of CMSs available these days, but this one has emerged as one of the leaders in recent years, and is definitely worth considering on your next project. For many, its flat-file focus is a real winner in terms of version control, updating and ease of use.

希望您喜欢Statamic的介绍。 这些天有很多CMS,但是这已经成为近年来的领导者之一,绝对值得考虑下一个项目。 对于许多人来说,在版本控制,更新和易用性方面,它的平面文件焦点是真正的赢家。

If you have any questions, let me know in the comments. I'm keen to know if you've tried Statamic and how you found it.

如果您有任何疑问,请在评论中告诉我。 我很想知道您是否尝试过Statamic,以及如何找到它。

翻译自: https://www.sitepoint.com/building-database-free-websites-with-statamic-cms/

cms数据库设计

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.luyixian.cn/news_show_785180.aspx

如若内容造成侵权/违法违规/事实不符,请联系dt猫网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

编辑器生成静态网页_使用静态网站生成器的7个理由

编辑器生成静态网页Static site generators have become increasingly popular and, if my prediction is correct, usage will explode during 2016. Let’s establish what we mean by the term “static site generator” … 静态站点生成器已变得越来越流行&#xff0c;如果…

wordpress 自定义_为您的WordPress网站设计自定义主页

wordpress 自定义WordPress is used on a large portion of sites on the web. It allows us to create a variety of different types of sites, but one of the most important components of any website is always the home page. The perfect landing page will help you …

编辑器生成静态网页_不使用静态网站生成器的7个理由

编辑器生成静态网页Trending posts on SitePoint today: 今天在SitePoint上的热门帖子&#xff1a; 7 Ways to Make WordPress Simpler for Users 为用户简化WordPress的7种方法 I Need a Website. What Do I Need to Know About Hosting? 我需要一个网站。 关于托管我需要了…

wordpress插件_审查的顶级WordPress SEO插件

wordpress插件WordPress provides great native SEO features, so might your theme. However, by using a dedicated SEO plugin (and knowing how to use it) we can further optimize our site. In this article we compare the top SEO plugins for WordPress side-by-side…

如何安装和使用WP-CLI来管理WordPress网站

Speeding up your work process should be one of your top priorities. Simply put, if you do more work in less time, then you will have more time to work on more projects, study and rest. 加快工作流程应该是您的首要任务之一。 简而言之&#xff0c;如果您用更少的…

wordpress快速建站_快速提示:使用WordPress联络表7增强选择加入

wordpress快速建站You might have heard the saying, “the money is in the list”. Your email list, to be exact. Email marketing is widely considered to be the most powerful form of marketing today, and there are plenty of stats to back it up. 您可能已经听说过…

php网站功能块学习_学习PHP 7,了解新功能等

php网站功能块学习PHP 7, the next version of the world’s most popular programming language, has been released. We’d love to shoot fireworks and get drunk with our newfound power (seriously, the language is in the true big leagues now, functionality and pe…

wordpress网站迁移_如何将您的WordPress网站迁移到新的托管服务提供商

wordpress网站迁移This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible. 本文是与SiteGround合作创建的系列文章的一部分。 感谢您支持使SitePoint成为可能的合作伙伴。 We’ve be…

wordpress 静态化_地理定位WordPress内容以个性化您的网站

wordpress 静态化So what does that phrase mean, “Geo-Targeting WordPress Content”? First, let’s back up and look at an example of personalization. 那么&#xff0c;这句话是什么意思&#xff0c;“以地理定位的WordPress内容”&#xff1f; 首先&#xff0c;让我…

next主题seo优化_SEO可见性的5个最佳WordPress主题

next主题seo优化This article is part of a series created in partnership with SiteGround. Thank you for supporting the partners who make SitePoint possible. 本文是与SiteGround合作创建的系列文章的一部分。 感谢您支持使SitePoint成为可能的合作伙伴。 Theme selec…

cloudflare_使用Cloudflare使您的网站更快,更安全

cloudflareCloudflare is an industry leader in the content-delivery space, reducing load and speeding up millions of websites. Cloudflare是内容交付领域的行业领导者&#xff0c;可减轻负载并加快数百万个网站的速度。 What is peculiar about this provider is that…

六个最受欢迎的 CMS 建站系统,不容错过|Gitee项目推荐

CMS 是 Content Management System 的缩写&#xff0c;意为"内容管理系统"。 内容管理系统是企业信息化建设和电子政务的新宠&#xff0c;也是一个相对较新的市场。对于内容管理&#xff0c;业界还没有一个统一的定义&#xff0c;不同的机构有不同的理解。CMS 在各行…

html 相对路径 网站根目录,html中的绝对路径URL和相对路径URL及子目录、父目录、根目录...

绝对URL用于表示Internet中特定文件所需要的全部内容&#xff0c;Internet中的每一个文件都有一个唯一的URL&#xff0c;这就是在网页中搜索时需要输入到地址栏的连接。例如&#xff0c;要进入百度一下的网页&#xff0c;则在网页地址栏中输入&#xff1a;即可。一旦进入到某个…

php网站整合ck播放器,网页视频播放器-ckplayer 整合到wordpress

在这里我将教大家怎样将这款播放器整合到wordpress中来&#xff0c;并教大家怎么将优酷视频用到这款播放器上面!第一步&#xff1a;我们要下载一个播放器文件第二步&#xff1a;将下载文件解压出来&#xff0c;打开里面player文件夹下ckplayer.txt文本文档&#xff0c;将里面的…

【最新】某素材网站上的虎年高质量海报素材合集,附带源文件和预览图

原格式PSD提供给大家同时提供jpg预览图&#xff0c;马上过年了&#xff0c;这套素材用的上&#xff0c;红色喜庆 醉了&#xff0c;本来想整理的上传的&#xff0c;但是发现有水印&#xff0c;现在水印已经全部去除&#xff0c;放心食用&#xff0c;每个图都比较大&#xff0c;一…

使用SSM重新开发计科院网站

一、游览 在游览器地址栏输入&#xff1a;http://localhost:8080/index&#xff0c;即访问计科院首页&#xff0c;由于前期对数据库以及JavaBean的设计考虑不够充分&#xff0c;导致后期的代码臃肿&#xff0c;所以项目启动时对首页进行数据的填充难以实现&#xff0c;必须输入…

airpods固件更新方法_AirPods Pro 固件更新,空间音频来了丨 网站证书更新

09/15 网站证书更新 证书已上传,网站福利应用正在更新中…… 福利区已修复完毕,不知道能活多久! 证书已经上传(回复 证书 获取证书下载链接),证书使用教程查看历史文章 【福利升级】iOS苹果端免越狱 手机端签名神器教程来了! 删掉之前的APP再重新下载即可! 证书很不稳…

java程序员语录_「java程序员面试题」2018java程序员面试题整理 - seo实验室

java程序员面试题1.PathVariable注解和requestParam注解的区别。RequestParam注解是获取静态URL传入的参数PathVariable是获取请求路径中的变量作为参数/需要和RequestMAPPing("item/{itemId}") 配合使用2.Param注解和RequestParam注解的区别。Parm 指定request中必…

java webshell_网站漏洞测试 关于webshell木马后门检测

前段时间我们SINE安全收到客户的渗透测试服务委托,在这之前,客户网站受到攻击,数据被篡改,要求我们对网站进行全面的渗透测试,包括漏洞的检测与测试,逻辑漏洞.垂直水平越权漏洞,文件上传漏洞.等等服务项目,在进行安全测试之前,我们对客户的网站大体的了解了一下,整个平台网站,包…

java摄影网站源码_基于jsp的摄影网站-JavaEE实现摄影网站 - java项目源码

基于jspservletpojomysql实现一个javaee/javaweb的摄影网站, 该项目可用各类java课程设计大作业中, 摄影网站的系统架构分为前后台两部分, 最终实现在线上进行摄影网站各项功能,实现了诸如用户管理, 登录注册, 权限管理等功能, 并实现对各类摄影网站相关的实体进行管理。该摄影…