所以我试图让我的Expression Engine博客上的类别过滤器在单击某个类别时保持在相同的布局中...但每次我点击一个类别它会跳转到一个空白的白页(所以看起来似乎没有因任何原因从任何地方获得任何风格)。这很奇怪,因为我的标题包含了我所有的风格等等。
我得到了我的初始模板组:“PAGE-COMPS”(带两个模板):
(1)索引
(2)博客 - 如下
{embed="embeds/header-inner" my_body_class="blog" my_page_title="Blog"}
<div class="mid-wrapper">
<div class="row blog">
<div class="span9">
{embed="posts/index"}
</div>
<div class="span2">
{snp_blog_sidebar}
</div>
</div><!-- end of row -->
</div> <!-- end of mid-wrapper -->
{snp_footer}
然后我得到了我的第二个模板组:“EMBEDS”
我得到了我的头文件:“HEADER-INNER”在上面的代码中看到如下:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>{site_name} | {embed:my_page_title}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<meta name="author" content="">
<!-- Le styles -->
<link href="../assets/css/bootstrap.css" rel="stylesheet">
<link href="../assets/css/bootstrap-responsive.css" rel="stylesheet">
<!-- Carousel jscrollpane Styles -->
<link rel="stylesheet" type="text/css" href="../assets/css/jquery.jscrollpane.css" media="all" />
<!-- Le HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Load jQuery -->
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.0/jquery.min.js"></script>
<!-- Load ScrollTo -->
<script type="text/javascript" src="http://flesler-plugins.googlecode.com/files/jquery.scrollTo-1.4.3.1-min.js"></script>
<!-- Load LocalScroll -->
<script type="text/javascript" src="http://flesler-plugins.googlecode.com/files/jquery.localscroll-1.2.7-min.js"></script>
<script type="text/javascript">// <![CDATA[
// When the document is loaded...
$(document).ready(function()
{
// Scroll the whole document
$('#section-links').localScroll({
target:'body'
});
});
// ]]>
</script>
</head>
<body class="{embed:my_body_class}">
<header>
</header>
<div class="container">
<div class="hero-unit">
<img class="the" src="../assets/img/the.png">
<p><a class="logo" href="{site_url}">Site Name<span> More Name</span><img class="image" src="{site_url}assets/img/image.png" alt="{site_name}"></a></p>
<nav id="section-links">
<a href="{site_url}">Return to the Home Page</a>
</nav>
</div>
<!-- Main hero unit for a primary marketing message or call to action -->
<div class="hero-unit">
<div class="slogan">
<h1>blog name</h1>
<p>more description...</p>
</div>
</div>
然后我为博客项目制作了一个最后的模板组:调用“帖子”
POSTS有一个模板:
“索引”如下:
<!-- posts list -->
<div id="posts-list" class="cf">
<!-- THIS ONLY KICKS IN WHEN CATEGORY IS SELECTED (CATEGORY MODE) -->
{exp:channel:category_heading}
<h1>{category_name}</h1>
{if category_description}
<p>{category_description}</p>
{/if}
{/exp:channel:category_heading}
{exp:channel:entries channel="blog_audio|blog_video|blog_link|blog_quote|blog_post|blog_image" limit="10"}
{!-- Choose appropriate snippet based on source channel --}
{if channel_short_name == "blog_audio"}
{snp_blog_audio}
{/if}
{if channel_short_name == "blog_video"}
{snp_blog_video}
{/if}
{if channel_short_name == "blog_link"}
{snp_blog_link}
{/if}
{if channel_short_name == "blog_quote"}
{snp_blog_quote}
{/if}
{if channel_short_name == "blog_post"}
{snp_blog_post}
{/if}
{if channel_short_name == "blog_image"}
{snp_blog_image}
{/if}
{!-- Commenting out for now, we'll come back to it
<!-- page-navigation -->
<div class="page-navigation cf">
<div class="nav-next"><a href="#">← Older Entries </a></div>
<div class="nav-previous"><a href="#">Newer Entries →</a></div>
</div>
<!--ENDS page-navigation -->
--}
{/exp:channel:entries}
</div>
<!-- ENDS posts list -->
最后我会为我的SIDEBAR W / THE CATEGORIES制作一个SNIPPET,如下所示:
SNP_BLOG_SIDEBAR
<!-- sidebar -->
<aside id="sidebar">
<ul>
<li class="block">
<h4>Our Blog</h4>
Description of our blog goes here
</li>
<li class="block">
<h4>Categories</h4>
<ul>
{exp:channel:categories channel="blog_audio|blog_video|blog_link|blog_quote|blog_post|blog_image" style="linear" show_empty="no"}
<li class="cat-item"><a href="{path='blog/index'}" title="{category_name}">{category_name}</a></li>
{/exp:channel:categories}
</ul>
</li>
<li class="block">
<h4>Archives</h4>
<ul>
{exp:channel:month_links channel="blog_audio|blog_video|blog_link|blog_quote|blog_post|blog_image" limit="50"}
<li class="cat-item"><a href="{path='blog/index'}" title="title"> {month}, {year}</a></li>
{/exp:channel:month_links}
</ul>
</li>
</ul>
</aside>
<!-- ENDS sidebar -->
我非常感谢任何有关可能出现错误的帮助...再次点击类别时我会把我带到一个空白的白页列出这个类别的博客,而不是让我保持当前的博客设计...
感谢TON!
答案 0 :(得分:1)
这是../assets/[...]
中与您的样式相关的embeds/header-inner
相对链接。这可以从http://localhost/index.php/whatever/you-want/
或http://localhost/blog
开始,但不会从浏览器看起来像更深层次的文件夹结构(http://localhost/blog/categories/[something]
)那些不起作用。
如果可以,请尝试使用网站根目录中的内容,例如<link rel="stylesheet" href="/assets/css/file.css">
。