Skip navigation
Currently Being Moderated

Editing HTML source document and losing the Server Behaviour details on the panel

Nov 14, 2012 6:14 AM

Hi,

I just noticed something;

When I bring in and edit my HTML source document, my server behaviour goes back to Coldfusion and the record set and record insertion is missing.

 

DW Server B1.png

I have to Click and add it back to the panel. Is this normal ?

DW Server B.png

 

Thanks

 
Replies
  • Currently Being Moderated
    Nov 14, 2012 6:22 AM   in reply to Reynold Dreamweaver CS6

    What is the file extension of your source document?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2012 2:43 PM   in reply to Reynold Dreamweaver CS6

    Why are you expecting to see anything in the server panels for a file with an extension of *.htm?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2012 3:43 PM   in reply to Reynold Dreamweaver CS6

    You cannot bind a page with an *.htm(l) extension to anything.

     

    You can have HTML and PHP on the same page, but if it has PHP on it, it MUST have a PHP extension.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2012 4:13 PM   in reply to MurraySummers

    MurraySummers wrote:

    You can have HTML and PHP on the same page, but if it has PHP on it, it MUST have a PHP extension.

    That's certainly the normal way of doing it.

     

    However the server may already be configured to parse .htm and .html pages for PHP.

     

    Or the .htaccess may have the relevant modifications added \

    http://support.hostrocket.com/knowledgebase.php?action=displayarticle& id=110

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 14, 2012 4:19 PM   in reply to John Waller

    Certainly - but it introduces an unnecessary complication into a discussion that is already 20 posts too long, doncha know?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2012 5:01 AM   in reply to Reynold Dreamweaver CS6

    Please do not investigate htaccess.  It is totally irrelevant to your issues here. What you need to investigate is basic HTML, CSS and PHP.

     

    Here are the facts:

     

    1.  A page with an HTML extension (*.htm or *.html) will NOT be parsed by the server (unless you have adjusted the configuration of the server, as rightly pointed out by John Waller) when it is fetched by a local browser.  This means that any PHP that might be in that page will not be executed and will remain visible in the page when you view source.  Thus, when you validate such a page, the validator can be confused by the remaining (unexpected) PHP scripting in the page, and begin to throw curious error messages.  Your page is an example of that. The solution is to rename the page with a *.php extension (which is how it should have been from the moment of creation).

     

    2.  A page created as an HTML page with an HTML extension (*.htm or *.html) cannot be bound to any database in your local DW. Opening such a page and then viewing the server panels would naturally produce unexpected results.  There is no possibility nor is there any reason to operate on such a page with any aspect of the Databases, the Bindings, or the Server Behaviors panel.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2012 5:03 AM   in reply to MurraySummers

    So - if you have pages with *.htm(l) extensions that also contain PHP scripting or that you want to operate on with the server panels, you MUST RENAME THEM to have a *.php extension.  Do NOT keep two versions of these pages (one with the .htm(l) extension and another with the .php extension).

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2012 5:48 AM   in reply to Reynold Dreamweaver CS6

    I am slight confused as to why should not have 2 copies of the same webpage, one in html and one in php.

    <sigh>

     

    You do not.  You have ONE PAGE - it's a page with both HTML and PHP in it.  It has a *.php extension. Period. One Page.  That's it.  No more. No *.htm(l). Just *.php.  Nada.  Nope.  Just one page.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2012 6:21 AM   in reply to Reynold Dreamweaver CS6

    I understand the html page has embeded php in it. It is HTML and PHP. It has an extension htm. I save it when I edit this? I do not ediit php right? So where does the php copy of the same come from.

     

    OK - I'm going to do this one more time. A page containing HTML and PHP cannot have an .htm(l) extension.

     

    Open the page in DW, and save it with a PHP extension.  Delete the *.htm page. In fact, delete ALL of the *.htm pages that also contain PHP after you resave them with the PHP extension.  When you open this page in DW, you can edit both the HTML and the PHP at the same time. In the same page.  All at once.

     

    Look - let's say I'm working in a new site.  I want to create a page that adds a record to the database. I use FILE > New > PHP to create this page. When I save it, DW uses a PHP extension. I go to the movies.  Everything works great.  Do not deviate from that procedure and you will not have these spurious *.htm pages ever again.  In fact, make every page a php page. Always.  Even if you never add PHP code to them.  It'll work just fine.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 15, 2012 6:45 AM   in reply to MurraySummers

    Just a follow-on comment.  Every page I make now is a PHP page (except on sites where the host doesn't support PHP). I do this for my convenience.  It works fine.

     

    The reason I do this is to cover me in the event that at some future date I want to add some PHP scripting or a PHP include to a page.  If I had originally used an *.html extension, then I'd have change my links and worry about search engine hits on the old page after it is renamed.  By using the *.php extension as a standard I never have to worry about these things.  See what I mean?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 16, 2012 5:07 AM   in reply to Reynold Dreamweaver CS6

    Change this -

     

    <?php require_once('Connections/dbAttendance.php'); ?>

     

    to this -

     

    <?php ini_set('display_errors', 1); ?>

    <?php require_once('Connections/dbAttendance.php'); ?>

     

    and this -

     

      mysql_select_db($database_dbAttendance, $dbAttendance);

      $Result1 = mysql_query($insertSQL, $dbAttendance) or die(mysql_error());

     

    to this -

     

      mysql_select_db($database_dbAttendance, $dbAttendance);

    exit($insertSQL);

      $Result1 = mysql_query($insertSQL, $dbAttendance) or die(mysql_error());

     

    Then fill out your form and click submit.  What do you get?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 16, 2012 6:11 AM   in reply to Reynold Dreamweaver CS6

    That's not an error message.  It is the printed contents of the SQL string that is to be executed when the data is inserted.

     

    This tells me that the page is working as expected with no errors to that point, and that the command that will be sent to the MySQL server is properly populated and formatted so as to initiate the insertion of the data.

     

    Now change this -

     

      mysql_select_db($database_dbAttendance, $dbAttendance);

    exit($insertSQL);

      $Result1 = mysql_query($insertSQL, $dbAttendance) or die(mysql_error());

     

    back to this -

     

      mysql_select_db($database_dbAttendance, $dbAttendance);

      $Result1 = mysql_query($insertSQL, $dbAttendance) or die(mysql_error());

     

    and try filling out the form and submitting it again - what happens?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 16, 2012 6:26 AM   in reply to Reynold Dreamweaver CS6

    Was the data written to the database?

     

    This error means that the server is unable to execute the relocation command -

     

      header(sprintf("Location: %s", $insertGoTo));

     

    because you have already sent some output to the screen.  To debug this, I'll need to see the actual PHP file. Can you save it with a *.txt extension and upload it, then post a link to it, please?

     

    By the way, did you know that there is a forum specifically for discussion of server scripting issues in DW?  It's called the DW Application Development forum.  About 90% of your questions in these several threads would be more apporpriately asked over there.  This general discussion forum is more focused on questions about static pages not dynamic ones.

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 16, 2012 11:54 AM   in reply to Reynold Dreamweaver CS6

    AppDev is here -

     

    Dreamweaver Application Development

     

    I think it would be good to summarize your current status there instead of moving an entire thread over.

     

    I do visit there from time to time.  Notwithstanding this, though, I do not see anything in your code that would cause that "headers already sent" error to be occurring.  Can you verify for me again that this in fact happens, please?

     
    |
    Mark as:
  • Currently Being Moderated
    Nov 16, 2012 12:17 PM   in reply to Reynold Dreamweaver CS6

    I gave you a link in my previous post.

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points