我有一个模板,可以生成指向我网站中其他网页的链接,但这些生成的链接不正确。
例如,主页链接为http://127.0.0.1:8080/silverstripe/"/silverstripe/"
应为http://127.0.0.1:8080/silverstripe/
为什么我的链接错了?
这是我的模板代码:
<!DOCTYPE html>
<!--[if lt IE 7 ]><html class="ie ie6" lang="en"> <![endif]-->
<!--[if IE 7 ]><html class="ie ie7" lang="en"> <![endif]-->
<!--[if IE 8 ]><html class="ie ie8" lang="en"> <![endif]-->
<!--[if (gte IE 9)|!(IE)]><!--><html lang="en"> <!--<![endif]-->
<head>
<% base_tag %>
$MetaTags
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
<!-- IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<!-- Google Web Font -->
<link href="http://fonts.googleapis.com/css?family=Raleway:300,500,900%7COpen+Sans:400,700,400italic" rel="stylesheet" type="text/css" />
<!-- Bootstrap CSS -->
<link href="$ThemeDir/css/bootstrap.min.css" rel="stylesheet" />
<!-- Template CSS -->
<link href="$ThemeDir/css/style.css" rel="stylesheet" />
<!-- Modernizr -->
<script src="$ThemeDir/js/common/modernizr.js"></script>
</head>
<body>
<!-- BEGIN WRAPPER -->
<div id="wrapper">
<!-- BEGIN HEADER -->
<header id="header">
<div id="top-bar">
<div class="container">
<div class="row">
<div class="col-sm-12">
<ul id="top-buttons">
<li><a href="#"><i class="fa fa-sign-in"></i> Login</a></li>
<li><a href="#"><i class="fa fa-pencil-square-o"></i> Register</a></li>
<li class="divider"></li>
<li>
<div class="language-switcher">
<span><i class="fa fa-globe"></i> English</span>
<ul>
<li><a href="#">Deutsch</a></li>
<li><a href="#">Español</a></li>
<li><a href="#">Français</a></li>
<li><a href="#">Português</a></li>
</ul>
</div>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="nav-section">
<div class="container">
<div class="row">
<div class="col-sm-12">
<a href="index.html" class="nav-logo"><img src="$ThemeDir/images/logo.png" alt="One Ring Rentals" /></a>
<!-- BEGIN MAIN MENU -->
<nav class="navbar">
<button id="nav-mobile-btn"><i class="fa fa-bars"></i></button>
<ul class="nav navbar-nav">
<% loop $Menu(1) %>
<li><a class=”$LinkingMode” href=”$Link” title=”Go to the $Title page”>$MenuTitle</a></li>
<% end_loop %>
</ul>
</nav>
<!-- END MAIN MENU -->
</div>
</div>
</div>
</div>
</header>
<!-- END HEADER -->
<!-- BEGIN PAGE TITLE/BREADCRUMB -->
<div class="parallax colored-bg pattern-bg">
<div class="container">
<div class="row">
<div class="col-sm-12">
<h1 class="page-title">$Title</h1>
<div class="breadcrumb">
$Breadcrumbs
</div>
</div>
</div>
</div>
</div>
<!-- END PAGE TITLE/BREADCRUMB -->
<!-- BEGIN CONTENT -->
<div class="content">
<div class="container">
<div class="row">
<div class="main col-sm-8">
<h1 class="section-title">Nunc enim nulla</h1>
<p class="darker-text">Donec magna justo, laoreet sed consectetur non, malesuada non neque. Aenean vehicula vitae dui eu convallis. Cras a venenatis urna, ac congue nulla.</p>
<p>Donec ex sapien, semper sit amet sodales suscipit, imperdiet in metus. Aliquam maximus mi eget finibus cursus. Duis a nisi tempus, porta eros sit amet, placerat urna. Vivamus varius enim ut sem imperdiet lacinia. Cras sed mauris ac felis rhoncus sodales sit amet eget ante. In metus purus, tristique a porttitor ac, sollicitudin vitae arcu. Quisque ac vehicula nulla. Morbi finibus facilisis cursus. Praesent sollicitudin sem id fermentum dignissim. Donec dictum dui a accumsan finibus. Quisque velit purus, lobortis et aliquam sit amet, sagittis eget lorem. Integer ut elit nisi.</p>
<p>Ut vel facilisis leo. Cras feugiat dolor faucibus, porttitor nisl euismod, tempus tellus. Donec varius cursus velit eu aliquam. Nulla facilisi. Pellentesque sit amet nunc nisl. Suspendisse tortor dolor, sagittis vel mattis vel, commodo eu metus. Proin a hendrerit mi. Sed blandit ante mi, nec elementum lacus elementum in. Quisque at risus nunc. Vestibulum quis diam id massa sodales viverra sit amet et nulla. Quisque commodo faucibus dignissim. Ut eros neque, tristique tincidunt sapien non, fermentum elementum metus. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus.</p>
<p>Phasellus pellentesque metus neque, quis consequat neque hendrerit eget. Vestibulum nunc mauris, venenatis id mi et, ornare consectetur nisl. Nunc molestie sem tempor ante mattis, et consectetur dolor ornare. In congue elit gravida nisi semper gravida. Maecenas posuere mollis ligula, quis malesuada elit pretium vitae. Nulla aliquam eget justo sollicitudin fermentum. Nunc ac justo at arcu aliquet iaculis non non lacus. In nisi tellus, mollis nec volutpat nec, sagittis ac neque. Sed in aliquam risus. Sed in tristique nisl. Ut in tellus non neque pellentesque venenatis eget sed risus. Nulla facilisi. Duis efficitur velit nunc, et mattis enim dictum vitae. Integer tincidunt quam quis vulputate tempor. Donec sagittis tortor vitae consectetur sodales. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas.</p>
</div>
<div class="sidebar gray col-sm-4">
<h2 class="section-title">In this section</h2>
<ul class="categories subnav">
<li><a href="#">Company</a></li>
<li><a href="#">FAQ</a></li>
<li><a href="#">Careers</a></li>
<li><a href="#">Contact Us</a></li>
<li><a href="#">Terms of Use</a></li>
<li><a href="#">Privacy Policy</a></li>
</ul>
</div>
</div>
</div>
</div>
<!-- END CONTENT -->
<!-- BEGIN FOOTER -->
<footer id="footer">
<div id="footer-top" class="container">
<div class="row">
<div class="block col-sm-3">
<a href="#"><img src="$ThemeDir/images/logo.png" alt="One Ring Rentals" /></a>
<br><br>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam commodo eros nibh, et dictum elit tincidunt eget. Pellentesque volutpat quam dignissim, convallis elit id, efficitur sem. Vivamus ac scelerisque sem. Aliquam sed enim rutrum nibh gravida pellentesque nec at metus. In hac habitasse platea dictumst. Etiam in rhoncus mi. In hac habitasse platea dictumst. Mauris congue blandit venenatis.</p>
</div>
<div class="block col-sm-3">
<h3>Helpful Links</h3>
<ul class="footer-links">
<li><a href="#">All rentals</a></li>
<li><a href="#">List your rental</a></li>
<li><a href="#">Read our FAQs</a></li>
</ul>
</div>
<div class="block col-sm-6">
<h3>Popular regions</h3>
<div class="row">
<div class="col-sm-6">
<ul class="footer-listings">
<li>
<div class="image">
<a href="properties-detail.html"><img src="http://placehold.it/760x670" alt="" /></a>
</div>
<p><a href="properties-detail.html">Rhovanion</a></p>
</li>
<li>
<div class="image">
<a href="properties-detail.html"><img src="http://placehold.it/760x670" alt="" /></a>
</div>
<p><a href="properties-detail.html">Eriador</a></p>
</li>
<li>
<div class="image">
<a href="properties-detail.html"><img src="http://placehold.it/760x670" alt="" /></a>
</div>
<p><a href="properties-detail.html">Bay of Belfalas</a></p>
</li>
</ul>
</div>
<div class="col-sm-6">
<ul class="footer-listings">
<li>
<div class="image">
<a href="properties-detail.html"><img src="http://placehold.it/760x670" alt="" /></a>
</div>
<p><a href="properties-detail.html">Mordor</a></p>
</li>
<li>
<div class="image">
<a href="properties-detail.html"><img src="http://placehold.it/760x670" alt="" /></a>
</div>
<p><a href="properties-detail.html">Arnor</a></p>
</li>
<li>
<div class="image">
<a href="properties-detail.html"><img src="http://placehold.it/760x670" alt="" /></a>
</div>
<p><a href="properties-detail.html">Forlindon</a></p>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
<!-- BEGIN COPYRIGHT -->
<div id="copyright">
<div class="container">
<div class="row">
<div class="col-sm-12">
© 2014 One Ring Rentals
<!-- BEGIN SOCIAL NETWORKS -->
<ul class="social-networks">
<li><a href="#"><i class="fa fa-facebook"></i></a></li>
<li><a href="#"><i class="fa fa-twitter"></i></a></li>
<li><a href="#"><i class="fa fa-google"></i></a></li>
<li><a href="#"><i class="fa fa-pinterest"></i></a></li>
<li><a href="#"><i class="fa fa-youtube"></i></a></li>
<li><a href="#"><i class="fa fa-rss"></i></a></li>
</ul>
<!-- END SOCIAL NETWORKS -->
</div>
</div>
</div>
</div>
<!-- END COPYRIGHT -->
</footer>
<!-- END FOOTER -->
</div>
<!-- END WRAPPER -->
<script type="text/javascript" src="$ThemeDir/js/common/jquery-1.11.1.min.js"></script>
<script type="text/javascript" src="$ThemeDir/js/common/bootstrap.min.js"></script>
<script type="text/javascript" src="$ThemeDir/js/common/bootstrap-datepicker.js"></script>
<script type="text/javascript" src="$ThemeDir/js/common/chosen.min.js"></script>
<script type="text/javascript" src="$ThemeDir/js/common/bootstrap-checkbox.js"></script>
<script type="text/javascript" src="$ThemeDir/js/common/nice-scroll.js"></script>
<script type="text/javascript" src="$ThemeDir/js/common/jquery-browser.js"></script>
<script type="text/javascript" src="$ThemeDir/js/scripts.js"></script>
</body>
</html>
答案 0 :(得分:6)
问题是这些链接中使用的双引号字符的类型:
<ul class="nav navbar-nav">
<% loop $Menu(1) %>
<li><a class=”$LinkingMode” href=”$Link” title=”Go to the $Title page”>$MenuTitle</a></li>
<% end_loop %>
</ul>
您会注意到您的链接属性包含”
引号而非"
引号。
双引号字符必须为"
。
试试这个:
<ul class="nav navbar-nav">
<% loop $Menu(1) %>
<li><a class="$LinkingMode" href="$Link" title="Go to the $Title page">$MenuTitle</a></li>
<% end_loop %>
</ul>