newspaper articles link href
-
22-09-2019 - |
Question
How do I change the link href to css, js code for each article without manually doing it? Each article I write is seperated into different folders and I start each article with one template that links to css/reset.css etc.
This is my sample article template code: Sample Article Page
<link href="css/slider.css" rel="stylesheet" type="text/css" media="screen" />
<!-- jquery -->
<script type="text/javascript" src="http://jqueryjs.googlecode.com/files/jquery-1.3.1.js"></script>
<!-- superfish -->
<link href="css/superfish.css" rel="stylesheet" type="text/css" media="screen" />
<script type="text/javascript" src="js/hoverIntent.js"></script>
<script type="text/javascript" src="js/superfish.js"></script>
<!-- initialize jquery superfish plugins -->
<script type="text/javascript" src="js/init.js"></script>
<!-- tabs -->
<script src="js/ui.core.js" type="text/javascript"></script>
<script src="js/ui.tabs.js" type="text/javascript"></script>
<link rel="stylesheet" href="css/ui.tabs.css" type="text/css" media="screen" />
<!-- initialize tabs -->
<script type="text/javascript">
$(document).ready(function(){
$('#container-1 > ul').tabs(); /* news and events */
$('#container-2 > ul').tabs(); /* pre-footer tab */
$('#container-4 > ul').tabs(); /* popular items */
Solution
It sounds like you're asking how you can use the same URL for each external file, regardless of where your page is placed.
If so, all you would need is to use absolute URLs instead of relative URLs. That is, "/foo/bar/reset.css
" (note the initial slash) instead of "bar/reset.css
"
Absolute URLs trace from the site root, rather than the file's current location, and so the links will be the same regardless of where you place the file.
Edit:
You would put this URL in the same place where you already put the relative URLs: That is:
<link type="text/css" rel="stylesheet" media="all" href="/foo/bar/style.css" />
instead of the
<link type="text/css" rel="stylesheet" media="all" href="bar/style.css" />
that you are using now.
OTHER TIPS
Kevin, correct me if I'm wrong; you have a series of html files in different folders and you want to update all of the CSS and javascript links in them to point to a new location.
Your scenario:
wwwroot/
|
-- CSS/
|
-- reset.css
|
-- Javascript/
|
-- 20090112/
|
-- file1.html
|
-- 20090207/
|
-- file2.html
-- file3.html
|
-- etc.
Dreamweaver is placing everything in your CSS
folder. If you want to keep the CSS files there then you need to specify correct relative paths, or else use absolute paths.
An absolute path is one that specifies the exact location of the file http://www.somedomain.com/css/reset.css
is an absolute path.
A relative path defines the path from the location of the current file. So if you wanted to add reset.css
to file1.html you would specify its location in this manner ../css/reset.css
Broken down this path specifies:
.. up one folder [we're now in wwwroot]
/css the path from wwwroot
/reset.css the filename
Does this help?