http://docs.django-cms.org/en/release-3.4.x/introduction/templates_placeholders.html
https://docs.djangoproject.com/en/dev/topics/templates/
#django CMS requires at least one template for its pages.
#The first template in the CMS_TEMPLATES list will be the project’s default template模版,不是首页.
#http://www.cnblogs.com/my_life/articles/8465794.html
CMS_TEMPLATES = (
('base.html', 'Base template'), #http://www.cnblogs.com/my_life/articles/8464588.html
('home.html', 'Home page template'),
## Customize this
('fullwidth.html', 'Fullwidth'),
('full-width.html', 'Fullwidth-S'),
('sidebar_left.html', 'Sidebar Left'),
('sidebar_right.html', 'Sidebar Right')
)
因此当你新建一个page,而没有指定其template的话,会默认使用第一个的作为其模板
通过下面的页面操作可以修改当前页面的模板
或者通过编辑页面,advanced 高级设置修改页面的模板
对应于settings.py中的
placeholder: 每个页面各不相同
static_placeholder: 多个页面共享, such as a footer block.
例如:
- base.html
{% load cms_tags menu_tags sekizai_tags %}
<!doctype html>
<html>
<head>
<title>{% block title %}This is my new project home page{% endblock title %}</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<style type="text/css">
.nav {
padding-left: 0;
}
.nav li {
display: inline;
list-style-type: none;
padding-right: 20px;
}
.container {
width: 940px;
margin: 0 auto
}
.content {
float: left;
width: 80%;
}
.sidebar {
float: left;
width: 20%;
}
</style>
{% render_block "css" %}
</head>
<body>
{% cms_toolbar %}
<div class="container">
<ul class="nav">
{% show_menu 0 100 100 100 %}
</ul>
{% block content %}{% endblock content %}
</div>
{% render_block "js" %}
</body>
<footer>
{% static_placeholder 'footer' %}
</footer>
</html>
- fullwidth.html
{% extends "base.html" %}
{% load cms_tags %}
{% block title %}{% page_attribute "page_title" %}{% endblock title %}
{% block content %}
{% placeholder "feature" %}
{% placeholder "content" %}
{% placeholder "splashbox" %}
{% endblock content %}
页面结构如下:
编辑
选择页面想要使用的模版
查看效果:
切换到模式,可以显示所有的placeholder
可以看到作为全局的static_placeholder出现在了所有的页面中。
静态的placeholder