我一直在开发我的第一个Modex项目,现在我已将下载的模板复制到“assets / templates / site”并修复了所有链接+将base_url添加到标题中,结果代码:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN" dir="ltr">
<head profile="http://gmpg.org/xfn/11">
<base href="[(site_url)]" />
<title>PlusBusiness</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="imagetoolbar" content="no" />
<link rel="stylesheet" href="/assets/templates/site/styles/layout.css" type="text/css" />
<script type="text/javascript" src="/assets/templates/site/scripts/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="/assets/templates/site/scripts/jquery.jcarousel.pack.js"></script>
<script type="text/javascript" src="/assets/templates/site/scripts/jquery.jcarousel.setup.js"></script>
</head>
<body id="top">
<!-- ####################################################################################################### -->
<div class="wrapper col1">
<div id="header">
<div id="logo">
<h1><a href="#">+Business</a></h1>
<p>Free Open Source CSS Website Template</p>
</div>
<div id="topnav">
<ul>
<li class="active"><a href="index.html">Home</a></li>
<li><a href="style-demo.html">Style Demo</a></li>
<li><a href="full-width.html">Full Width</a></li>
<li><a href="#">DropDown</a>
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>
</li>
<li class="last"><a href="#">A Long Link Text</a></li>
</ul>
</div>
<br class="clear" />
</div>
</div>
<!-- ####################################################################################################### -->
<div class="wrapper col2">
<div id="featured_slide">
<div id="featured_content">
<ul>
<li><img src="/assets/templates/site/images/demo/1.gif" alt="" />
<div class="floater">
<h2>About This Template !</h2>
<p>This is a W3C standards compliant Open Source free CSS template from <a href="http://www.os-templates.com/" title="Open Source Templates">OS Templates</a>. This template is distributed under a <a target="_blank" rel="nofollow" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 Unported License</a>, which allows you to use and modify the template for both personal and commercial use when you keep the provided credit links in the footer. For more free css templates visit <a href="http://www.os-templates.com/">Open Source Templates</a>.</p>
<p class="readmore"><a href="#">Continue Reading »</a></p>
</div>
</li>
<li><img src="/assets/templates/site/images/demo/2.gif" alt="" />
<div class="floater">
<h2>Cursus penati saccum ut curabitur nulla.</h2>
<p>Temperinte interdum sempus odio urna eget curabitur semper convallis nunc laoreet. Nullain convallis ris elis vest liberos nis diculis feugiat in rutrum. Suspendreristibulumfaucibulum lobortor quis tortortor ris sapien sce enim et volutpat sus. Urnaretiumorci orci fauctor leo justo nulla cras ridiculum…</p>
<p class="readmore"><a href="#">Continue Reading »</a></p>
</div>
</li>
<li><img src="/assets/templates/site/images/demo/3.gif" alt="" />
<div class="floater">
<h2>Cursus penati saccum ut curabitur nulla.</h2>
<p>Temperinte interdum sempus odio urna eget curabitur semper convallis nunc laoreet. Nullain convallis ris elis vest liberos nis diculis feugiat in rutrum. Suspendreristibulumfaucibulum lobortor quis tortortor ris sapien sce enim et volutpat sus. Urnaretiumorci orci fauctor leo justo nulla cras ridiculum…</p>
<p class="readmore"><a href="#">Continue Reading »</a></p>
</div>
</li>
</ul>
</div>
<a href="javascript:void(0);" id="featured-item-prev"><img src="/assets/templates/site/images/prev.png" alt="" /></a> <a href="javascript:void(0);" id="featured-item-next"><img src="/assets/templates/site/images/next.png" alt="" /></a> </div>
</div>
<!-- ####################################################################################################### -->
<div class="wrapper col3">
<div id="container">
<div class="homepage">
<ul>
<li>
<h2><img src="/assets/templates/site/images/demo/60x60.gif" alt="" />Nullamlacus dui ipsum conseque loborttis</h2>
<p>Nullamlacus dui ipsum conseque loborttis non euisque morbi penas dapibulum orna. Urnaultrices quis curabitur phasellentesque congue magnis vestibulum quismodo nulla et feugiat. Adipisciniapellentum leo ut consequam ris felit elit id nibh sociis malesuada.</p>
<p class="readmore"><a href="#">Continue Reading »</a></p>
</li>
<li>
<h2><img src="/assets/templates/site/images/demo/60x60.gif" alt="" />Nullamlacus dui ipsum conseque loborttis</h2>
<p>Nullamlacus dui ipsum conseque loborttis non euisque morbi penas dapibulum orna. Urnaultrices quis curabitur phasellentesque congue magnis vestibulum quismodo nulla et feugiat. Adipisciniapellentum leo ut consequam ris felit elit id nibh sociis malesuada.</p>
<p class="readmore"><a href="#">Continue Reading »</a></p>
</li>
<li class="last">
<h2><img src="/assets/templates/site/images/demo/60x60.gif" alt="" />Nullamlacus dui ipsum conseque loborttis</h2>
<p>Nullamlacus dui ipsum conseque loborttis non euisque morbi penas dapibulum orna. Urnaultrices quis curabitur phasellentesque congue magnis vestibulum quismodo nulla et feugiat. Adipisciniapellentum leo ut consequam ris felit elit id nibh sociis malesuada.</p>
<p class="readmore"><a href="#">Continue Reading »</a></p>
</li>
</ul>
<br class="clear" />
</div>
</div>
</div>
<!-- ####################################################################################################### -->
<div class="wrapper col4">
<div id="footer">
<div class="box1">
<h2>A Little Company Information !</h2>
<img class="imgl" src="/assets/templates/site/images/demo/imgl.gif" alt="" />
<p>Morbitincidunt maurisque eros molest nunc anteget sed vel lacus mus semper. Anterdumnullam interdum eros dui urna consequam ac nisl nullam ligula vestassa. Condimentumfelis et amet tellent quisquet a leo lacus nec augue</p>
<p>Portortornec condimenterdum eget consectetuer condis.</p>
</div>
<div class="box contactdetails">
<h2>Our Contact Details !</h2>
<ul>
<li>Company Name</li>
<li>Street Name & Number</li>
<li>Town</li>
<li>Postcode/Zip</li>
<li>Tel: xxxxx xxxxxxxxxx</li>
<li>Fax: xxxxx xxxxxxxxxx</li>
<li>Email: info@domain.com</li>
<li class="last">LinkedIn: <a href="#">Company Profile</a></li>
</ul>
</div>
<div class="box flickrbox">
<h2>Latest Flickr Images !</h2>
<div class="wrap">
<div class="fix"></div>
<div class="flickr_badge_image" id="flickr_badge_image1"><a href="#"><img src="/assets/templates/site/images/demo/80x80.gif" alt="" /></a></div>
<div class="flickr_badge_image" id="flickr_badge_image2"><a href="#"><img src="/assets/templates/site/images/demo/80x80.gif" alt="" /></a></div>
<div class="flickr_badge_image" id="flickr_badge_image3"><a href="#"><img src="/assets/templates/site/images/demo/80x80.gif" alt="" /></a></div>
<div class="flickr_badge_image" id="flickr_badge_image4"><a href="#"><img src="/assets/templates/site/images/demo/80x80.gif" alt="" /></a></div>
<div class="flickr_badge_image" id="flickr_badge_image5"><a href="#"><img src="/assets/templates/site/images/demo/80x80.gif" alt="" /></a></div>
<div class="flickr_badge_image" id="flickr_badge_image6"><a href="#"><img src="/assets/templates/site/images/demo/80x80.gif" alt="" /></a></div>
<div class="fix"></div>
</div>
</div>
<br class="clear" />
</div>
</div>
<!-- ####################################################################################################### -->
<div class="wrapper col5">
<div id="copyright">
<p class="fl_left">Copyright © 2010 - All Rights Reserved - <a href="#">Domain Name</a></p>
<p class="fl_right">Template by <a href="http://www.os-templates.com/" title="Open Source Templates">OS Templates</a></p>
<br class="clear" />
</div>
</div>
</body>
</html>
As you can see all links are correct. But when I execute it I will see the page without images and other elements, and the code of page:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="EN" lang="EN" dir="ltr">
<head profile="http://gmpg.org/xfn/11">
<base href="http://localhost/ModexProject/" />
<title>PlusBusiness</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="imagetoolbar" content="no" />
<link rel="stylesheet" href="/assets/templates/site/styles/layout.css" type="text/css" />
<script type="text/javascript" src="/assets/templates/site/scripts/jquery-1.4.1.min.js"></script>
<script type="text/javascript" src="/assets/templates/site/scripts/jquery.jcarousel.pack.js"></script>
<script type="text/javascript" src="/assets/templates/site/scripts/jquery.jcarousel.setup.js"></script>
<script src="http://localhost/ModexProject/assets/js/jquery-1.4.4.min.js" type="text/javascript"></script>
<link type="text/css" media="screen" rel="stylesheet" href="http://localhost/ModexProject/assets/plugins/qm/css/colorbox.css" />
<style type="text/css">
.cboxIE #cboxTopLeft{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=http://localhost/ModexProject/assets/plugins/qm/css/images/internet_explorer/borderTopLeft.png, sizingMethod='scale');}
.cboxIE #cboxTopCenter{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=http://localhost/ModexProject/assets/plugins/qm/css/images/internet_explorer/borderTopCenter.png, sizingMethod='scale');}
.cboxIE #cboxTopRight{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=http://localhost/ModexProject/assets/plugins/qm/css/images/internet_explorer/borderTopRight.png, sizingMethod='scale');}
.cboxIE #cboxBottomLeft{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=http://localhost/ModexProject/assets/plugins/qm/css/images/internet_explorer/borderBottomLeft.png, sizingMethod='scale');}
.cboxIE #cboxBottomCenter{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=http://localhost/ModexProject/assets/plugins/qm/css/images/internet_explorer/borderBottomCenter.png, sizingMethod='scale');}
.cboxIE #cboxBottomRight{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=http://localhost/ModexProject/assets/plugins/qm/css/images/internet_explorer/borderBottomRight.png, sizingMethod='scale');}
.cboxIE #cboxMiddleLeft{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=http://localhost/ModexProject/assets/plugins/qm/css/images/internet_explorer/borderMiddleLeft.png, sizingMethod='scale');}
.cboxIE #cboxMiddleRight{background:transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src=http://localhost/ModexProject/assets/plugins/qm/css/images/internet_explorer/borderMiddleRight.png, sizingMethod='scale');}
</style>
<script type="text/javascript" src="http://localhost/ModexProject/assets/plugins/qm/js/jquery.colorbox-min.js"></script>
<script type="text/javascript">
var $j = jQuery.noConflict();
$j(document).ready(function($)
{
$j("a.colorbox").colorbox({width:"80%", height:"90%", iframe:true, overlayClose:false, opacity:0.5, transition:"fade", speed:150});
// Bindings
$j(document).bind("cbox_open", function(){
$j("body").css({"overflow":"hidden"});
$j("html").css({"overflow":"hidden"});
$j("#qmEditor").css({"display":"none"});
});
$j(document).bind("cbox_closed", function(){
$j("body").css({"overflow":"auto"});
$j("html").css({"overflow":"auto"});
$j("#qmEditor").css({"display":"block"});
// Remove manager lock by going to home page
$j.ajax({ type: "GET", url: "http://localhost/ModexProject/manager/index.php?a=2" });
});
// Hide QM+ if cookie found
if (getCookie("hideQM") == 1)
{
$j("#qmEditor").css({"display":"none"});
$j("#qmEditorClosed").css({"display":"block"});
}
// Hide QM+
$j(".qmClose").click(function () {
$j("#qmEditor").hide("normal");
$j("#qmEditorClosed").show("normal");
document.cookie = "hideQM=1; path=/;";
});
// Show QM+
$j("#qmEditorClosed").click(function () {
{
$j("#qmEditorClosed").hide("normal");
$j("#qmEditor").show("normal");
document.cookie = "hideQM=0; path=/;";
}
});
});
function getCookie(cookieName)
{
var results = document.cookie.match ( "(^|;) ?" + cookieName + "=([^;]*)(;|$)" );
if (results) return (unescape(results[2]));
else return null;
}
</script>
<link rel="stylesheet" type="text/css" href="http://localhost/ModexProject/assets/plugins/qm/css/style.css" />
<!--[if IE]><link rel="stylesheet" type="text/css" href="http://localhost/ModexProject/assets/plugins/qm/css/ie.css" /><![endif]-->
<!--[if lte IE 7]><link rel="stylesheet" type="text/css" href="http://localhost/ModexProject/assets/plugins/qm/css/ie7.css" /><![endif]-->
</head>
<body id="top">
<div id="qmEditorClosed"></div>
<div id="qmEditor">
<ul>
<li id="qmClose"><a class="qmButton qmClose" href="#" onclick="javascript: return false;">X</a></li>
<li><a id="qmLogoClose" class="qmClose" href="#" onclick="javascript: return false;"></a></li>
<li class="qmEdit">
<a class="qmButton qmEdit colorbox" href="http://localhost/ModexProject/manager/index.php?a=27&id=1&quickmanager=1"><span> �������������</span></a>
</li>
<li class="qmAdd">
<a class="qmButton qmAdd colorbox" href="http://localhost/ModexProject/manager/index.php?a=4&pid=1&quickmanager=1"><span>�������� ������</span></a>
</li>
<li class="qmManager">
<a class="qmButton qmManager" title="��������" href="http://localhost/ModexProject/manager/" ><span>��������</span></a>
</li>
<li class="qmLogout">
<a id="qmLogout" class="qmButton qmLogout" title="�����" href="http://localhost/ModexProject/manager/index.php?a=8&quickmanager=logout&logoutid=1" ><span>�����</span></a>
</li>
</ul>
</div>
<!-- ####################################################################################################### -->
<div class="wrapper col1">
<div id="header">
<div id="logo">
<h1><a href="#">+Business</a></h1>
<p>Free Open Source CSS Website Template</p>
</div>
<div id="topnav">
<ul>
<li class="active"><a href="index.html">Home</a></li>
<li><a href="style-demo.html">Style Demo</a></li>
<li><a href="full-width.html">Full Width</a></li>
<li><a href="#">DropDown</a>
<ul>
<li><a href="#">Link 1</a></li>
<li><a href="#">Link 2</a></li>
<li><a href="#">Link 3</a></li>
</ul>
</li>
<li class="last"><a href="#">A Long Link Text</a></li>
</ul>
</div>
<br class="clear" />
</div>
</div>
<!-- ####################################################################################################### -->
<div class="wrapper col2">
<div id="featured_slide">
<div id="featured_content">
<ul>
<li><img src="/assets/templates/site/images/demo/1.gif" alt="" />
<div class="floater">
<h2>About This Template !</h2>
<p>This is a W3C standards compliant Open Source free CSS template from <a href="http://www.os-templates.com/" title="Open Source Templates">OS Templates</a>. This template is distributed under a <a target="_blank" rel="nofollow" href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0 Unported License</a>, which allows you to use and modify the template for both personal and commercial use when you keep the provided credit links in the footer. For more free css templates visit <a href="http://www.os-templates.com/">Open Source Templates</a>.</p>
<p class="readmore"><a href="#">Continue Reading »</a></p>
</div>
</li>
<li><img src="/assets/templates/site/images/demo/2.gif" alt="" />
<div class="floater">
<h2>Cursus penati saccum ut curabitur nulla.</h2>
<p>Temperinte interdum sempus odio urna eget curabitur semper convallis nunc laoreet. Nullain convallis ris elis vest liberos nis diculis feugiat in rutrum. Suspendreristibulumfaucibulum lobortor quis tortortor ris sapien sce enim et volutpat sus. Urnaretiumorci orci fauctor leo justo nulla cras ridiculum…</p>
<p class="readmore"><a href="#">Continue Reading »</a></p>
</div>
</li>
<li><img src="/assets/templates/site/images/demo/3.gif" alt="" />
<div class="floater">
<h2>Cursus penati saccum ut curabitur nulla.</h2>
<p>Temperinte interdum sempus odio urna eget curabitur semper convallis nunc laoreet. Nullain convallis ris elis vest liberos nis diculis feugiat in rutrum. Suspendreristibulumfaucibulum lobortor quis tortortor ris sapien sce enim et volutpat sus. Urnaretiumorci orci fauctor leo justo nulla cras ridiculum…</p>
<p class="readmore"><a href="#">Continue Reading »</a></p>
</div>
</li>
</ul>
</div>
<a href="javascript:void(0);" id="featured-item-prev"><img src="/assets/templates/site/images/prev.png" alt="" /></a> <a href="javascript:void(0);" id="featured-item-next"><img src="/assets/templates/site/images/next.png" alt="" /></a> </div>
</div>
<!-- ####################################################################################################### -->
<div class="wrapper col3">
<div id="container">
<div class="homepage">
<ul>
<li>
<h2><img src="/assets/templates/site/images/demo/60x60.gif" alt="" />Nullamlacus dui ipsum conseque loborttis</h2>
<p>Nullamlacus dui ipsum conseque loborttis non euisque morbi penas dapibulum orna. Urnaultrices quis curabitur phasellentesque congue magnis vestibulum quismodo nulla et feugiat. Adipisciniapellentum leo ut consequam ris felit elit id nibh sociis malesuada.</p>
<p class="readmore"><a href="#">Continue Reading »</a></p>
</li>
<li>
<h2><img src="/assets/templates/site/images/demo/60x60.gif" alt="" />Nullamlacus dui ipsum conseque loborttis</h2>
<p>Nullamlacus dui ipsum conseque loborttis non euisque morbi penas dapibulum orna. Urnaultrices quis curabitur phasellentesque congue magnis vestibulum quismodo nulla et feugiat. Adipisciniapellentum leo ut consequam ris felit elit id nibh sociis malesuada.</p>
<p class="readmore"><a href="#">Continue Reading »</a></p>
</li>
<li class="last">
<h2><img src="/assets/templates/site/images/demo/60x60.gif" alt="" />Nullamlacus dui ipsum conseque loborttis</h2>
<p>Nullamlacus dui ipsum conseque loborttis non euisque morbi penas dapibulum orna. Urnaultrices quis curabitur phasellentesque congue magnis vestibulum quismodo nulla et feugiat. Adipisciniapellentum leo ut consequam ris felit elit id nibh sociis malesuada.</p>
<p class="readmore"><a href="#">Continue Reading »</a></p>
</li>
</ul>
<br class="clear" />
</div>
</div>
</div>
<!-- ####################################################################################################### -->
<div class="wrapper col4">
<div id="footer">
<div class="box1">
<h2>A Little Company Information !</h2>
<img class="imgl" src="/assets/templates/site/images/demo/imgl.gif" alt="" />
<p>Morbitincidunt maurisque eros molest nunc anteget sed vel lacus mus semper. Anterdumnullam interdum eros dui urna consequam ac nisl nullam ligula vestassa. Condimentumfelis et amet tellent quisquet a leo lacus nec augue</p>
<p>Portortornec condimenterdum eget consectetuer condis.</p>
</div>
<div class="box contactdetails">
<h2>Our Contact Details !</h2>
<ul>
<li>Company Name</li>
<li>Street Name & Number</li>
<li>Town</li>
<li>Postcode/Zip</li>
<li>Tel: xxxxx xxxxxxxxxx</li>
<li>Fax: xxxxx xxxxxxxxxx</li>
<li>Email: info@domain.com</li>
<li class="last">LinkedIn: <a href="#">Company Profile</a></li>
</ul>
</div>
<div class="box flickrbox">
<h2>Latest Flickr Images !</h2>
<div class="wrap">
<div class="fix"></div>
<div class="flickr_badge_image" id="flickr_badge_image1"><a href="#"><img src="/assets/templates/site/images/demo/80x80.gif" alt="" /></a></div>
<div class="flickr_badge_image" id="flickr_badge_image2"><a href="#"><img src="/assets/templates/site/images/demo/80x80.gif" alt="" /></a></div>
<div class="flickr_badge_image" id="flickr_badge_image3"><a href="#"><img src="/assets/templates/site/images/demo/80x80.gif" alt="" /></a></div>
<div class="flickr_badge_image" id="flickr_badge_image4"><a href="#"><img src="/assets/templates/site/images/demo/80x80.gif" alt="" /></a></div>
<div class="flickr_badge_image" id="flickr_badge_image5"><a href="#"><img src="/assets/templates/site/images/demo/80x80.gif" alt="" /></a></div>
<div class="flickr_badge_image" id="flickr_badge_image6"><a href="#"><img src="/assets/templates/site/images/demo/80x80.gif" alt="" /></a></div>
<div class="fix"></div>
</div>
</div>
<br class="clear" />
</div>
</div>
<!-- ####################################################################################################### -->
<div class="wrapper col5">
<div id="copyright">
<p class="fl_left">Copyright © 2010 - All Rights Reserved - <a href="#">Domain Name</a></p>
<p class="fl_right">Template by <a href="http://www.os-templates.com/" title="Open Source Templates">OS Templates</a></p>
<br class="clear" />
</div>
</div>
</body>
</html>
我看到并非所有链接都是正确的;有正确的链接,并且没有使用基本网址的链接。我该如何解决?
答案 0 :(得分:1)
我首先要对您的基本网址进行硬编码,而不是使用网站网址模板变量。这样你就可以控制格式和尾部斜杠;因此,如果您在基本网址中包含前瞻性斜杠,请确保将其排除在链接中。
因此,如果您的基本网址为<base href="http://www.yoursite.com/" />
,则所有链接都应为src="images/example.jpg
此时,modx应该为所有URL使用该基本路径,除非您使用HTTP之类的协议作为前缀。这就是它的全部内容。另外,请确保经常清除缓存以获得准确的结果。
答案 1 :(得分:1)
不要对基本网址进行硬编码,如果您移动网站会导致问题。基本url变量取自系统站点url设置。你可以控制那里的所有网址格式。