Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Server-side Scripting _ Adding HTML code to php file

Posted by: lelos1 Apr 10 2017, 09:23 AM

Hi everyone! I recently got access to manage a website and i need to add an excel list. I just know very basic stuff and I am very unsure on how to do it... Any tips on how to do it would be very welcome!

I went to Microsoft excel and saved it as html. It saved 5 files and one of the html sheets has this code like this :

<html xmlns:v="urn:schemas-microsoft-com:vml"

xmlns:o="urn:schemas-microsoft-com:office:office"

xmlns:x="urn:schemas-microsoft-com:office:excel"

xmlns="http://www.w3.org/TR/REC-html40">

<head>

<meta http-equiv=Content-Type content="text/html; charset=windows-1252">

<meta name=ProgId content=Excel.Sheet>

<meta name=Generator content="Microsoft Excel 15">

<link id=Main-File rel=Main-File

href="../Alphabetical%20Member%20list%20HAAR%202017.htm">

<link rel=File-List href=filelist.xml>

<link rel=Stylesheet href=stylesheet.css>

<style>

<!--table

{mso-displayed-decimal-separator:"\.";

mso-displayed-thousand-separator:"\,";}

@page

{margin:.75in .7in .75in .7in;

mso-header-margin:.3in;

mso-footer-margin:.3in;}

-->

</style>

<![if !supportTabStrip]><script language="JavaScript">

<!--

function fnUpdateTabs()

{

if (parent.window.g_iIEVer>=4) {

if (parent.document.readyState=="complete"

&& parent.frames['frTabs'].document.readyState=="complete")

parent.fnSetActiveSheet(0);

else

window.setTimeout("fnUpdateTabs();",150);

}

}

if (window.name!="frSheet")

window.location.replace("../Alphabetical%20Member%20list%20HAAR%202017.htm");

else

fnUpdateTabs();

//-->

</script>

<![endif]>

</head>

<body link=blue vlink=purple>


<table border=0 cellpadding=0 cellspacing=0 width=1264 style='border-collapse:

collapse;table-layout:fixed;width:949pt'>

<col width=154 style='mso-width-source:userset;mso-width-alt:5632;width:116pt'>

---------------------------------------------------------------------



and the file I need to add this 'code' to is exactly like this :



---------------------------------------------------------------------

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<title>HAAR :: Hellenic Association for Aerosol Research</title>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

<link rel="icon" href="favicon.ico"/>

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

<script type="text/javascript" src="haar.js"></script>

<?php

$doc = new DOMDocument;

$doc->preserveWhiteSpace = false;

$doc->Load('bgs.xml');

$theBGs = $doc->documentElement->childNodes->length - 1;

$randomBGnum = rand(0,$theBGs);

$randomBG = $doc->documentElement->childNodes->item($randomBGnum)->getAttribute("name");

echo "<style type='text/css'><!-- body { background-image:url(images/" . $randomBG . ".jpg);

background-attachment:fixed; background-position:top right; background-repeat:repeat; } --></style>";

if ($_GET["howMany"] == "") $howMany = 5; else $howMany = $_GET["howMany"];

if ($_GET["l"] == "") $lang = "gr"; else $lang = $_GET["l"];

?>

</head>

<body>

<div id="logo"><img src="images/logo1.png" border="0" alt="HAAR logo"/></div>

<div id="lang"><a href="?l=gr" class="menu">ελ</a> | <a href="?l=en" class="menu">en</a></div>

<div id="menu">

<a class="menu" href="index.php?l=<?php echo $lang; ?>"><?php if ($lang == "gr") echo "σχετικά";

else echo "about"; ?></a> |

<a class="menu" href="news.php?l=<?php echo $lang; ?>"><?php if ($lang == "gr") echo

"νέα/δραστηριότητες"; else echo "news/activities"; ?></a> |

<a class="menu" href="links.php?l=<?php echo $lang; ?>"><?php if ($lang == "gr") echo

"σύνδεσμοι"; else echo "links"; ?></a> |

<a class="menu" href="contact.php?l=<?php echo $lang; ?>"><?php if ($lang == "gr") echo

"επικοινωνία"; else echo "contact"; ?></a> |

<a class="menu" href="eac.php?l=<?php echo $lang; ?>">_eac_</a> |

<a class="menuActive" href="#"><?php if ($lang == "gr") echo "Μέλη"; else echo "Members"; ?></a>

</div>

<div id="viewer">

<?php

$content = new DOMDocument;

$content->preserveWhiteSpace = false;

$content->Load('contact.xml');

?>

<div class="title"><?php if ($lang == "gr") echo "Κατάλογος Μελών"; else echo "Members list";

?></div><br/>

Posted by: pandy Apr 10 2017, 10:00 AM

You should add just the table part where you want it to be in the existing HTML. But the the page from Excel is full off Office junk code and need to be cleaned up before you use it. You'd also need to add your own styling for the table.

Basically take everything from <table> to </table> but remove all attributes and stuff, just a clean table. Paste it where you want it and see how it looks. Then style it to fit with your page. We can help you with that, but you need to remove the junk first.

Instead of this....

CODE
<table border=0 cellpadding=0 cellspacing=0 width=1264 style='border-collapse:

collapse;table-layout:fixed;width:949pt'>

<col width=154 style='mso-width-source:userset;mso-width-alt:5632;width:116pt'>


Use this.
CODE
<table>
<col>


And so on. You probably can lose COL altogether, but keep it for now to make things easier for you. Keep tags, clean off attributes and values. And of course keep the content of the cells also! happy.gif

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)