WeBuilder breaking PHP code

Post your questions and problem reports here

Moderator: kfury77

Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.
  • Check the Support section of the corresponding product first. Chances are you will find your answer there;
  • Do not create new topics for already reported problems. Add your comments to the existing topics instead;
  • Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
  • Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
  • Include the version number of the software you are using;
  • This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;
Post Reply
tcloud
Posts: 3
Joined: Sun Nov 07, 2010 3:05 pm

WeBuilder breaking PHP code

Post by tcloud »

I have a large php web page (330 K) that I've been using for years (and update with new project participants periodically).

I'm test driving WeBuilder (my first use of it) and really like what I see, but it broke part of my PHP code and I can't figure out why. (This is after I did an html tidy.) (I wanted to see how it would handle a file this large.)

It also highlights the closing </body></html> tags in red even though selecting either of them also selects the opening <html><body> tags ?? (To be fair, it found a couple of tags I had not closed (a table and span at the beginning I believe) and maybe that's what broke the code?)

The html portion of the code can be seen here:
http://mykindred.com/cloud/dna/results/pedchart.php ... and I will be happy to zip a copy of the source file if anyone wants to look at it.

The original php is above the <body> tag. There is no other php code on the page -- here it is:

Code: Select all

<?
$doctitle = "Cloud DNA Project pedigree chart";
$historypath = "http://mykindred.com/cloud/dna/results/" ;
$thisfile = "pedchart.php";
$tngrootpath = '../../TX/' ;
include( $tngrootpath.'begin.php');
if( !$cms[support] )
	$cms[tngpath] = $tngrootpath ;
include($cms[tngpath] ."genlib.php");
include($cms[tngpath] ."getlang.php");
include($cms[tngpath] ."log.php");
//include($cms[tngpath] ."$mylanguage/text.php");
//
$thisfile = $historypath.$thisfile;
writelog("<a href=\"$thisfile\">$doctitle</a>");
?>
<!DOCTYPE html public "-//w3c//dtd html 4.0 transitional//en">
<html>
<head>
<link href="ped.css" rel="stylesheet">
<meta name="author" content="Tom Cloud">
<link rel="shortcut icon" href="favicon.ico">
<?php
echo "<title>$doctitle</title>\n";
echo "<meta name=\"Description\" content=\"$doctitle\">\n";
?>
</head>
WeBuilder creates CSS code for all of my <div> positioning elements -- and I like that -- and it's a large number of styles so I won't include them here. Here is what WeBuilder creates for me after I did an html tidy (note that my meta title tag is empty and the meta description tag has disappeared):

Code: Select all

<?
$doctitle = "Cloud DNA Project pedigree chart";
$historypath = "http://mykindred.com/cloud/dna/results/";
$thisfile = "pedchart.php";
$tngrootpath = '../../TX/';
include ($tngrootpath . 'begin.php');
if (!$cms[support])
  $cms[tngpath] = $tngrootpath;
include ($cms[tngpath] . "genlib.php");
include ($cms[tngpath] . "getlang.php");
include ($cms[tngpath] . "log.php");
//include($cms[tngpath] ."$mylanguage/text.php");
//
$thisfile = $historypath . $thisfile;
writelog("<a href=\"$thisfile\">
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">

<html>
<head>
  <link href="ped.css" rel="stylesheet" type="text/css">
  <meta name="author" content="Tom Cloud">
  <link rel="shortcut icon" href="favicon.ico">

  <title></title>
  <style type="text/css">
div.c1216 {text-align: center}
... styles omitted
... followed by the style block

and then this strange php code:

Code: Select all

... (style statements)
  </style>
</head>

<body>
  $doctitle"); ?> <?php
  echo "<title>$doctitle</title>\n";
  echo "<meta name=\"Description\" content=\"$doctitle\">\n";
  ?>

  <div class="c1216">
I can accept it's something I'm doing wrong (??) ... but what?

thanks
Tom
User avatar
MikeyB
Top Contributor
Posts: 511
Joined: Fri Jun 09, 2006 10:38 am
Location: UK
Contact:

Re: WeBuilder breaking PHP code

Post by MikeyB »

Hi,

HTML Tidy is not written by Blumentals, it's a third-party program that you can access from within WeBuilder Documentation & support can be found at http://tidy.sourceforge.net/
There are a lot of options you can change within HTML Tidy, Tools -> HTML Tidy -> Configure Tidy but again these are not WeBuilder options but direct options for the HTML Tidy tool.
It's the HTML Tidy tool that craetes the CSS styles & reformats your HTML code.
tcloud wrote:It also highlights the closing </body></html> tags in red
If I view the source of your page http://mykindred.com/cloud/dna/results/pedchart.php the </body> or </html> tags are not in red.
On line 10 I do get <div> <table> <tr> and <td> tags highlighed in red.

Maybe this is where HTML Tidy tried to "fix" your HTML?

The HTML Validator at http://validator.w3.org/ also says that your HTML is invalid http://goo.gl/npAu9 I was suprised it found so many erros, but then a lot of them are it saying your should use & instead of &
tcloud
Posts: 3
Joined: Sun Nov 07, 2010 3:05 pm

Re: WeBuilder breaking PHP code

Post by tcloud »

Thanks -- html tidy also confuses the contents of the php code block as the html head element in my sample code. Once the missing html tags are corrected, it works okay, but it looks like an error to me in that it should ignore everything inside any php code block.

... thanks again for the insight into the problem. I am grateful to have WeBuilder highlight the problems. FrontPage didn't do that and DreamWeaver just inserted the corrections where it thought they ought to go.
Post Reply