Click to See Complete Forum and Search --> : Dreamweaver templates help


tehashman
07-06-2008, 02:32 PM
hey im using a DW template to create my website and when i create a new page from the template, the new page seems to contain 2 instances of the template. and i dont mean one after the other. it inserts the second instance about half way through the first.

WTF is going?
i have used templates before and this has NEVER happened to me.

anyone have any idea why this is happening?

eCat
07-06-2008, 04:03 PM
That's really odd! Would you mind posting the HTML from one of the pages? You can remove any info you're worried about sharing...

donatello
07-06-2008, 05:27 PM
Show us the page.

tehashman
07-07-2008, 06:04 AM
well this is my template page:
<?php
//Included files
include "includes/misc.php";
include "includes/opendb.php";
include "includes/functions.php";

//start session
session_start();

//breadcrumb
$page_title = "";

?>
<!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">
<head>
<!-- TemplateInfo codeOutsideHTMLIsLocked="false" -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
</head>

<body>
<div id="wrapper">
<div id="header"><img src="../images/logo.png" alt="Random Website" /></div>
<div id="content-wrapper">
<div id="content">
<div class="in">
<h2><?php echo $page_title ?></h2>
<!-- TemplateBeginEditable name="content" -->
<p></p>
<!-- TemplateEndEditable -->
</div>
</div>
</div>
<div id="left">
<div class="in">
<h2>Navigation</h2>
<ul class="navi">
<li>» <a href="../index.php">Home</a></li>
<li>» <a href="../about.php">About Us</a></li>
<li>» <a href="../gallery.php">Gallery</a></li>
<li>» <a href="../contact.php">Contact Us</a></li>
<li>» <a href="../blogs.php">Blogs</a></li>
</ul>
<br />
<?php
if ($_SESSION['loggedin'] == "yes") {
//display members nav
?>
<h4>Members Section</h4>
<p>Welcome, <?php echo $_SESSION['username']; ?>!</p>
<ul>
<li>» <a href="../members/galleryadmin.php">Gallery Admin</a></li>
<li>» <a href="../members/forum.php">Forum</a></li>
<li>» <a href="../members/details.php">Change Details</a></li>
<li>» <a href="../members/password.php">Change Password</a></li>
<li>» <a href="../members/announce.php">Announcements</a></li>
<li>» <a href="../members/blogadmin.php">Blogging</a></li>
<li>» <a href="../functions/userfunctions.php?func=logout">Log Out</a></li>
<?php
if ($_SESSION['level'] == 1) {
?>
<li>» <a href="../admin/index.php">Admin</a></li>
<?php
}
?>
</ul>
<?php
}else{
//display login form
?>
<form action="../functions/userfunctions.php?func=login" method="post" id="login">
Username:<br />
<input type="text" name="username" />
<br />
Password:<br />
<input type="password" name="password" />
<br />
<input type="submit" name="login" value="Login" />
» <a href="../register.php">Register</a>
</form>
<?php
}
?>
</div>
</div>
<div id="right">
<?php
//get recent/site statistics

//members
$mQuery = "SELECT * FROM ls12_users";
$mResult = query($mQuery);
$mNumRows = numRows($mResult);

//recent topics
$tQuery = "SELECT topic_id, topic_title FROM ls12_topic ORDER BY topic_lastpost DESC LIMIT 2";
$tResult = query($tQuery);

//forum posts
$pQuery = "SELECT * FROM ls12_post ORDER BY post_id DESC";
$pResult = query($pQuery);
$pNumRows = numRows($pResult);

//galleries
$gQuery = "SELECT * FROM ls12_album ORDER BY album_id DESC LIMIT 2";
$gResult = query($gQuery);
$gNumRows = numRows($gResult);

//pictures
$iQuery = "SELECT * FROM ls12_image ORDER BY image_id DESC";
$iResult = query($iQuery);
$iNumRows = numRows($iResult);

//blogs
$bQuery = "SELECT * FROM ls12_blog ORDER BY blog_id DESC";
$bResult = query($bQuery);
$bNumRows = numRows($bResult);

?>
<div class="in">
<h2>Recent Updates</h2>
<h4>Galleries</h4>
<?php

while ($gRow = mysql_fetch_array($gResult)) {

$alId = $gRow['album_id'];
$alName = $gRow['album_name'];
$alImg = $gRow['album_image'];
$alUid = $gRow['album_ownerid'];

?>
<p>» <a href="../gallery.php?func=viewal&amp;alid=<?php echo $alId; ?>"><?php echo $alName; ?><br />
<img src="../images/album/<?php echo $alImg; ?>"></a><br />
<?php
$oName = getUsername($alUid);
echo 'By '.$oName.'</p>';
}

?>
<h4>Forum Posts</h4>
<ul>
<?php
while ($tRow = mysql_fetch_array($tResult)) {
$topicId = $tRow['topic_id'];
$topicTitle = $tRow['topic_title'];
?>
<li>» <a href="../members/forum.php?func=viewtopic&topicid=<?php echo $topicId; ?>"><?php echo $topicTitle; ?></a></li>
<?php
}
?>
</ul>
<h4>Blogs</h4>
<?php
//list last 5 blogs
if ($bNumRows != 0) {
echo "<ul>";
while ($bRow = mysql_fetch_array($bResult)) {
$blogId = $bRow['blog_id'];
$blogTitle = $bRow['blog_title'];
$blogAuth = $bRow['blog_authorid'];

//get username
$bUserName = getUsername($blogAuth);

?>
<li>» <a href="../blogs.php?blogid=<?php echo $blogId; ?>"><?php echo $blogTitle; ?></a>
<ul>
<li class="nested">by '.$bUserName.'</li>
</ul>
</li>
<?php
}
echo "</ul>";
}else{
echo "No blogs yet";
}

?>
<h4>Statistics</h4>
<p>Members: <?php echo $mNumRows; ?><br />
Albums: <?php echo $gNumRows; ?><br />
Pictures: <?php echo $iNumRows; ?><br />
Forum Posts: <?php echo $pNumRows; ?><br />
Blogs: <?php echo $bNumRows; ?></p>
</div>
</div>
<div id="footer">Copyright &copy; 2008 <a href="http://members.ls12style.co.uk">Members.LS12Style.co.uk</a> Web design by <a href="http://www.ls12style.co.uk">Ashley Broadley</a></div>
</div>
</body>
</html>
<?php

include "includes/close.php";

?>

the main thing i noticed was that it is 201 lines long.

tehashman
07-07-2008, 06:05 AM
sorry about second post. i went over the character limit for one post.

and this is the code of a page created from that template:
<?php
//Included files
include "includes/misc.php";
include "includes/opendb.php";
include "includes/functions.php";

//start session
session_start();

//breadcrumb
$page_title = "";

?>
<!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"><!-- InstanceBegin template="/Templates/random.dwt.php" codeOutsideHTMLIsLocked="false" -->
<head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- InstanceBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- InstanceEndEditable -->
<!-- InstanceBeginEditable name="head" -->
<!-- InstanceEndEditable -->
</head>

<body>
<div id="wrapper">
<div id="header"><img src="images/logo.png" alt="Random Website" /></div>
<div id="content-wrapper">
<div id="content">
<div class="in">
<h2><?php echo $page_title ?></h2>
<!-- InstanceBeginEditable name="content" -->
<p></p>
<!-- InstanceEndEditable -->
</div>
</div>
</div>
<div id="left">
<div class="in">
<h2>Navigation</h2>
<ul class="navi">
<li>» <a href="index.php">Home</a></li>
<li>» <a href="about.php">About Us</a></li>
<li>» <a href="gallery.php">Gallery</a></li>
<li>» <a href="contact.php">Contact Us</a></li>
<li>» <a href="blogs.php">Blogs</a></li>
</ul>
<br />
<?php
if ($_SESSION['loggedin'] == "yes") {
//display members nav
?>
<h4>Members Section</h4>
<p>Welcome, <?php echo $_SESSION['username']; ?>!</p>
<ul>
<li>» <a href="members/galleryadmin.php">Gallery Admin</a></li>
<li>» <a href="members/forum.php">Forum</a></li>
<li>» <a href="members/details.php">Change Details</a></li>
<li>» <a href="members/password.php">Change Password</a></li>
<li>» <a href="members/announce.php">Announcements</a></li>
<li>» <a href="members/blogadmin.php">Blogging</a></li>
<li>» <a href="functions/userfunctions.php?func=logout">Log Out</a></li>
<?php
if ($_SESSION['level'] == 1) {
?>
<li>» <a href="admin/index.php">Admin</a></li>
<?php
}
?>
</ul>
<?php
}else{
//display login form
?>
<form action="file:///C|/wamp/www/random/functions/userfunctions.php?func=login" method="post" id="login">
Username:<br />
<input type="text" name="username" />
<br />
Password:<br />
<input type="password" name="password" />
<br />
<input type="submit" name="login" value="Login" />
» <a href="file:///C|/wamp/www/random/register.php<?php
//Incluuded files
include "includes/misc.php";
include "includes/opendb.php";
include "includes/functions.php";

//start session
session_start();

//breadcrumb
$page_title = "";

?>
<!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">
<head>
<!-- TemplateInfo codeOutsideHTMLIsLocked="false" -->
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Untitled Document</title>
<!-- TemplateEndEditable -->
<!-- TemplateBeginEditable name="head" -->
<!-- TemplateEndEditable -->
</head>

<body>
<div id="wrapper">
<div id="header"><img src="../images/logo.png" alt="Random Website" /></div>
<div id="content-wrapper">
<div id="content">
<div class="in">
<h2><?php echo $page_title ?></h2>
<!-- TemplateBeginEditable name="content" -->
<p></p>
<!-- TemplateEndEditable -->
</div>
</div>
</div>
<div id="left">
<div class="in">
<h2>Navigation</h2>
<ul class="navi">
<li>» <a href="../index.php">Home</a></li>
<li>» <a href="../about.php">About Us</a></li>
<li>» <a href="../gallery.php">Gallery</a></li>
<li>» <a href="../contact.php">Contact Us</a></li>
<li>» <a href="../blogs.php">Blogs</a></li>
</ul>
<br />
<?php
if ($_SESSION['loggedin'] == "yes") {
//display members nav
?>
<h4>Members Section</h4>
<p>Welcome, <?php echo $_SESSION['username']; ?>!</p>
<ul>
<li>» <a href="../members/galleryadmin.php">Gallery Admin</a></li>
<li>» <a href="../members/forum.php">Forum</a></li>
<li>» <a href="../members/details.php">Change Details</a></li>
<li>» <a href="../members/password.php">Change Password</a></li>
<li>» <a href="../members/announce.php">Announcements</a></li>
<li>» <a href="../members/blogadmin.php">Blogging</a></li>
<li>» <a href="../functions/userfunctions.php?func=logout">Log Out</a></li>
<?php
if ($_SESSION['level'] == 1) {
?>
<li>» <a href="../admin/index.php">Admin</a></li>
<?php
}
?>
</ul>
<?php
}else{
//display login form
?>
<form action="../functions/userfunctions.php?func=login" method="post" id="login">
Username:<br />
<input type="text" name="username" />
<br />
Password:<br />
<input type="password" name="password" />
<br />
<input type="submit" name="login" value="Login" />
» <a href="../register.php">Register</a>
</form>
<?php
}
?>
</div>
</div>
<div id="right">
<?php
//get recent/site statistics

//members
$mQuery = "SELECT * FROM ls12_users";
$mResult = query($mQuery);
$mNumRows = numRows($mResult);

//recent topics
$tQuery = "SELECT topic_id, topic_title FROM ls12_topic ORDER BY topic_lastpost DESC LIMIT 2";
$tResult = query($tQuery);

//forum posts
$pQuery = "SELECT * FROM ls12_post ORDER BY post_id DESC";
$pResult = query($pQuery);
$pNumRows = numRows($pResult);

//galleries
$gQuery = "SELECT * FROM ls12_album ORDER BY album_id DESC LIMIT 2";
$gResult = query($gQuery);
$gNumRows = numRows($gResult);

//pictures
$iQuery = "SELECT * FROM ls12_image ORDER BY image_id DESC";
$iResult = query($iQuery);
$iNumRows = numRows($iResult);

//blogs
$bQuery = "SELECT * FROM ls12_blog ORDER BY blog_id DESC";
$bResult = query($bQuery);
$bNumRows = numRows($bResult);

?>
<div class="in">
<h2>Recent Updates</h2>
<h4>Galleries</h4>
<?php

while ($gRow = mysql_fetch_array($gResult)) {

$alId = $gRow['album_id'];
$alName = $gRow['album_name'];
$alImg = $gRow['album_image'];
$alUid = $gRow['album_ownerid'];

?>
<p>» <a href="../gallery.php?func=viewal&amp;alid=<?php echo $alId; ?>"><?php echo $alName; ?><br />
<img src="file:///C|/wamp/www/random/images/album/<?php echo $alImg; ?>"></a><br />
<?php
$oName = getUsername($alUid);
echo 'By '.$oName.'</p>';
}

?>
<h4>Forum Posts</h4>
<ul>
<?php
while ($tRow = mysql_fetch_array($tResult)) {
$topicId = $tRow['topic_id'];
$topicTitle = $tRow['topic_title'];
?>
<li>» <a href="members/forum.php?func=viewtopic&amp;topicid=<?php echo $topicId; ?>"><?php echo $topicTitle; ?></a></li>
<?php
}
?>
</ul>
<h4>Blogs</h4>
<?php
//list last 5 blogs
if ($bNumRows != 0) {
echo "<ul>";
while ($bRow = mysql_fetch_array($bResult)) {
$blogId = $bRow['blog_id'];
$blogTitle = $bRow['blog_title'];
$blogAuth = $bRow['blog_authorid'];

//get username
$bUserName = getUsername($blogAuth);

?>
<li>» <a href="blogs.php?blogid=<?php echo $blogId; ?>"><?php echo $blogTitle; ?></a>
<ul>
<li class="nested">by '.$bUserName.'</li>
</ul>
</li>
<?php
}
echo "</ul>";
}else{
echo "No blogs yet";
}

?>
<h4>Statistics</h4>
<p>Members: <?php echo $mNumRows; ?><br />
Albums: <?php echo $gNumRows; ?><br />
Pictures: <?php echo $iNumRows; ?><br />
Forum Posts: <?php echo $pNumRows; ?><br />
Blogs: <?php echo $bNumRows; ?></p>
</div>
</div>
<div id="footer">Copyright &copy; 2008 <a href="http://members.ls12style.co.uk">Members.LS12Style.co.uk</a> Web design by <a href="http://www.ls12style.co.uk">Ashley Broadley</a></div>
</div>
</body>
<!-- InstanceEnd --></html>
<?php

include "includes/close.php";

?>

this is 284 lines long. the template seems to 'start' again on line 84.

you can tell by it including my the php files and starting the sesion again...

:(

thanks for trying to help!

eCat
07-07-2008, 01:52 PM
Hmmm... when I take your code and save it as a DW template, then create a new page from that template, it looks just fine.

I don't know if this matters or not, but which version of DW are you using?

tehashman
07-07-2008, 03:02 PM
DW 8. also when i try and save the new page it tries to save it as a template.

eCat
07-07-2008, 03:13 PM
I'm using MX 2004.

I'll attach the page I created with the template I made with your code. See how it looks for you in DW8.