.asp template to .php template

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
jmcphie
Forum Newbie
Posts: 4
Joined: Tue Jun 01, 2010 1:21 pm

.asp template to .php template

Post by jmcphie »

Hello,

I am a complete noob at this website programing thing. But after my boss decided to switch web hosts it became apparent that the new host did not support .asp. Needless to say fixing the problem was put on me. I have managed to convert almost all of the files over, but I am having much difficulty getting the template files (I am using dreamweaver) to work. Could someone please help me out. This is the code for one of the templates in .asp:

Code: Select all

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Estill Energy Inc.</title>
<!-- TemplateEndEditable -->

<meta name="keywords" content="Estill Energy Inc., renewable, products, " />
<meta name="description" content="Estill Energy Inc. provides renewable energy products ...." />
<script language="JavaScript">
var gAutoPrint = true; // Tells whether to automatically call the print function

function printSpecial()
{
if (document.getElementById != null)
{
var html = '<HTML>\n<HEAD>\n';

if (document.getElementsByTagName != null)
{
var headTags = document.getElementsByTagName("head");
if (headTags.length > 0)
html += headTags[0].innerHTML;
}

html += '\n</HE>\n<BODY>\n';

var printReadyElem = document.getElementById("printReady");

if (printReadyElem != null)
{
html += printReadyElem.innerHTML;
}
else
{
alert("Could not find the printReady function");
return;
}

html += '\n</BO>\n</HT>';

var printWin = window.open("","printSpecial");
printWin.document.open();
printWin.document.write(html);
printWin.document.close();
if (gAutoPrint)
printWin.print();
}
else
{
alert("The print ready feature is only available if you are using an browser. Please update your browswer.");
}
}

</script>
<script language="JavaScript">
var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 
</script>

<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
<link href="../Stylesheet/Estill-Stylesheet.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style></head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td bgcolor="#666666"><table width="998" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
      <tr>
        <td width="10" background="../Includes/Images/left-bkgr-image.jpg">&nbsp;</td>
        <td bgcolor="#FFFFFF"><table width="974" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td height="20"><!--#include file="../Includes/Banner-Index.asp" --></td>
              </tr>
            
            <tr>
              <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><div id="printReady">
                        <table width="974" border="0" cellspacing="0" cellpadding="15">
                          <tr>
                            <td align="left" valign="top">
                              <!-- TemplateBeginEditable name="Main Page Editable Region" --> Home Page   Editable Region<!-- TemplateEndEditable --></td>
                          </tr>
                        </table>
                    </div></td>
                  </tr>
              </table>
                <p>&nbsp;</p>
                <p>&nbsp;</p>                <p>&nbsp;</p></td>
              </tr>
          </table>
          <div align="center"></div></td>
        <td width="10" background="../Includes/Images/right-bkgr-image.jpg">&nbsp;</td>
      </tr>
    </table>
      <!--#include file="../Includes/Footer.asp" -->
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p></td>
  </tr>
</table>
<p>
</p>
</body>

</html>
Last edited by Benjamin on Wed Jun 02, 2010 3:44 pm, edited 1 time in total.
Reason: Added [syntax=php] tags.
jmcphie
Forum Newbie
Posts: 4
Joined: Tue Jun 01, 2010 1:21 pm

Re: .asp template to .php template

Post by jmcphie »

Ok so I have switched the file name to template.dwt.php and changed the code to the following:

Code: Select all

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<!-- TemplateBeginEditable name="doctitle" -->
<title>Estill Energy Inc.</title>
<!-- TemplateEndEditable -->

<meta name="keywords" content="Estill Energy Inc., renewable, products, " />
<meta name="description" content="Estill Energy Inc. provides renewable energy products ...." />
<script language="JavaScript">
var gAutoPrint = true; // Tells whether to automatically call the print function

function printSpecial()
{
if (document.getElementById != null)
{
var html = '<HTML>\n<HEAD>\n';

if (document.getElementsByTagName != null)
{
var headTags = document.getElementsByTagName("head");
if (headTags.length > 0)
html += headTags[0].innerHTML;
}

html += '\n</HE>\n<BODY>\n';

var printReadyElem = document.getElementById("printReady");

if (printReadyElem != null)
{
html += printReadyElem.innerHTML;
}
else
{
alert("Could not find the printReady function");
return;
}

html += '\n</BO>\n</HT>';

var printWin = window.open("","printSpecial");
printWin.document.open();
printWin.document.write(html);
printWin.document.close();
if (gAutoPrint)
printWin.print();
}
else
{
alert("The print ready feature is only available if you are using an browser. Please update your browswer.");
}
}

</script>
<script language="JavaScript">
var timeout	= 500;
var closetimer	= 0;
var ddmenuitem	= 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose; 
</script>

<!-- TemplateBeginEditable name="head" --><!-- TemplateEndEditable -->
<link href="../stylesheet/estill-stylesheet.css" rel="stylesheet" type="text/css" />
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
-->
</style></head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td bgcolor="#666666"><table width="998" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
      <tr>
        <td width="10" background="../includes/images/left-bkgr-image.jpg">&nbsp;</td>
        <td bgcolor="#FFFFFF"><table width="974" border="0" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td height="20"><? include "../includes/banner-Index.php"; ?></td>
              </tr>
            
            <tr>
              <td align="left" valign="top"><table width="100%" border="0" cellspacing="0" cellpadding="0">
                  <tr>
                    <td><div id="printReady">
                        <table width="974" border="0" cellspacing="0" cellpadding="15">
                          <tr>
                            <td align="left" valign="top">
                              <!-- TemplateBeginEditable name="Main Page Editable Region" --> Home Page   Editable Region<!-- TemplateEndEditable --></td>
                          </tr>
                        </table>
                    </div></td>
                  </tr>
              </table>
                <p>&nbsp;</p>
                <p>&nbsp;</p>                <p>&nbsp;</p></td>
              </tr>
          </table>
          <div align="center"></div></td>
        <td width="10" background="../includes/mages/right-bkgr-image.jpg">&nbsp;</td>
      </tr>
    </table>
      <? include "../includes/footer.php"; ?>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p></td>
  </tr>
</table>
<p>
</p>
</body>

</html>

This almost works, but I have a nested include file that is not calling the nested images. Any ideas?
Last edited by Benjamin on Wed Jun 02, 2010 3:45 pm, edited 1 time in total.
Reason: Added [syntax=php] tags.
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: .asp template to .php template

Post by mikosiko »

you meant the ones like this?

Code: Select all

<td height="20"><? include "../includes/banner-Index.php"; ?></td>
use this:

Code: Select all

<td height="20"><?php include "../includes/banner-Index.php"; ?></td>
jmcphie
Forum Newbie
Posts: 4
Joined: Tue Jun 01, 2010 1:21 pm

Re: .asp template to .php template

Post by jmcphie »

It is still having a hard time taking the images from the nested includes. The images from the initial include show up fine. But not the other ones.

Here is what that code looks like:

banner-index.php:

Code: Select all

<link href="../stylesheet/estill-stylesheet.css" rel="stylesheet" type="text/css" />
<table width="974" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><?php include "q-banner-comp-1.php"; ?></td>
  </tr>

  <tr>
    <td><a href="index.php"><img src="../images/Banner-Home-Page.jpg" alt="Estill Energy Logo Banner" width="974" height="150" border="0" longdesc="http://index.php" /></a><br />
</td>
  </tr>
  
  <tr>
    <td height="22" valign="bottom" bgcolor="#000000"><?php include "q-banner-comp-2.php"; ?></td>
  </tr>

  <tr>
    <td><?php include "printer-icon-link.php"; ?></td>
  </tr>
</table>

q-banner-comp-2.php:

<link href="../stylesheet/estill-stylesheet.css" rel="stylesheet" type="text/css">

<table width="974" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="1" bgcolor="#000000"><img src="../images/1-pixel-transparent.gif" alt="Transparent Pixel" width="1" height="1" /></td>
    <td><table width="972" border="0" align="left" cellpadding="0" cellspacing="0" bgcolor="#B4C8EC">
  <tr>
    <td width="368" align="center" valign="middle" bgcolor="#FFFFFF" class="Menu-text-white"><table width="368" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td height="22" bgcolor="#49739E">&nbsp;</td>
      </tr>
    </table></td>
    <td height="22" align="center" valign="middle" bgcolor="#49739E" class="Menu-text-white"><div align="right"><span class="Menu-text-black">
      <ul id="sddm">
    <li><a href="About.php">About Estill Energy</a></li>
    <li><a href="Products.php">Products</a></li> 
    <li><a href="News.php">News</a></li>
    <li><a href="Careers.php">Careers</a></li> 
    <li><a href="Contact.php">Contact Us</a></li>
</ul>
<div style="clear:both">
  <div align="center"></div>
</div>
    </span></div></td>
  </tr>
</table></td>
  </tr>
</table>

printer-icon-link.php

<link href="../stylesheet/estill-stylesheet.css" rel="stylesheet" type="text/css" />

<table width="974" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td width="960" height="20" align="right" valign="middle"><table width="60" border="0" align="right" cellpadding="0" cellspacing="0">
      <tr>
        <td><div align="center"> <span class="Menu-text-green"><a href="javascript:void(printSpecial())"><img src="images/printer-icon-sm.jpg" alt="Print Page" width="16" height="16" border="0" /><br />
        </a></span></div></td>
      </tr>
    </table></td>
    <td width="2" height="20" align="right" valign="middle"><div align="right"></div></td>
  </tr>
</table>
Last edited by Benjamin on Wed Jun 02, 2010 3:45 pm, edited 1 time in total.
Reason: Added [syntax=php] tags.
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: .asp template to .php template

Post by mikosiko »

just check that you are using consistently the paths to your include files and your images.... looks like that you have some errors there...
jmcphie wrote:<td width="1" bgcolor="#000000"><img src="../images/1-pixel-transparent.gif" alt="Transparent Pixel" width="1" height="1" /></td>
jmcphie wrote:<td><div align="center"> <span class="Menu-text-green"><a href="javascript:void(printSpecial())"><img src="images/printer-icon-sm.jpg" alt="Print Page" width="16" height="16" border="0" />
jmcphie
Forum Newbie
Posts: 4
Joined: Tue Jun 01, 2010 1:21 pm

Re: .asp template to .php template

Post by jmcphie »

Even with changing the file paths images are still only able to be kept after one include transfer. The banner comes through, but the other two images become small php boxes. Also when I apply the template to any page I loose the banner.
User avatar
Benjamin
Site Administrator
Posts: 6935
Joined: Sun May 19, 2002 10:24 pm

Re: .asp template to .php template

Post by Benjamin »

:arrow: Use the PHP Code button when posting code in the forum.
Post Reply