I have been pondering a better way to insert a few head tags into one page of a template, without creating a duplicate template just for these head tags of this one page. And without these head tags showing on every page of the site (where they are not needed).
I have been reading about CSS and adding a ID tag to the body for improved styling. This is great because it would allow for one template to be created, but the ID tag on this one page would serve up the proper code. I am looking for a similar type solution for MODx.
My template looks like this:
<!DOCTYPE GOES HERE">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="keywords" content="Some Keywords in Here" />
<meta name="description" content="Description Goes Here" />
<title>MY WEBSITE - [[*pagetitle]]</title>
<link href="css/pstyle.css" rel="stylesheet" type="text/css" media="all" />
<!--[if IE]>
<link rel="stylesheet" type="text/css" href="css/style.css" />
<![endif]-->
</head>
<body>
<div id="main">
<!-- HEADER & NAV -->
[[$Nav]]
<!-- END HEADER & NAV -->
<!-- BODY -->
<div id="body">
<div id="body_content">[[*content]] </div>
</div>
<div id="footer">
<div class="floatleft">[[$footer]] </div>
</div>
</div>
</body>
</html>
As you can see in my template has several includes. I have a Nav and Footer chunk which serves up HTML for my site. The problem is on a few websites I have an image gallery. In the header of this one template page I have to have 3 lines of javascript code to server this gallery. The way I currently solve this i;s I have a duplicate template with these 3 lines of code added, and I only apply this template to this one page. While this works well it is not ideal as far changing template in the future. This is the type of reason CSS was created for in the first place.
I am sure this is a simpler way of including this code into the header of just one page, without having to have a duplicate template. Anyone have any solutions?
[ed. note: wbbuilder last edited this post 14 years ago.]