4 Replies Latest reply on Aug 30, 2008 5:05 AM by (Colin_Walton)

    Problems turning PHP into HTML so it can be emailed using Dev Toolbox

      I have a site where the client can add their latest menu to the database. The website then updates with the latest menus. What I would now like to do is to create a page/application where the client can take the list of customer emails on the database and email them an updated page containing the latest menus.

      I have two problems:
      1) To dynamically generate the menu from the database the page has to be in PHP, but I can only send an email in HTML format. Is there a way to use the server to fill in the fields and convert the PHP into HTML? I have tried SSI but can't seem to make this work as again I think it has to be PHP. This is the page I want to email: http://www.relishlunch.com/emails/index.php

      2) I have bought the Dreamweaver Developers Toolbox as it has the facility to take emails from a database and then send a file - which is just what I want. I have created a page where the update record action would I thought trigger the email sending but it doesn't work either. The instructions mention "it is an AFTER trigger, and it can be executed after insert / update / delete / custom TRANSACTIONS" is this not the same as updating a record? what is the difference and how do I set this page up? do you have an example I could see? I think its the triggering I don't understand!

      Thanks for any help!
        • 1. Re: Problems turning PHP into HTML so it can be emailed using Dev Toolbox
          Günter Schenk Level 4
          Hi Colin,

          -------
          To dynamically generate the menu from the database the page has to be in PHP, but I can only send an email in HTML format. Is there a way to use the server to fill in the fields and convert the PHP into HTML?
          -------

          when choosing the "Retrieve content from file" option, your template file can be a regular HTML file and can contain both static text and "dynamic data" like e.g. insert/update - transaction values, which need to be inserted between braces -- when the mail is sent, "Dear {firstname}" will translate to "Dear John"

          -------
          I have created a page where the update record action would I thought trigger the email sending but it doesn't work either.
          ------

          do you get an error message when applying the Send Email trigger ?

          -------
          The instructions mention "it is an AFTER trigger, and it can be executed after insert / update / delete / custom TRANSACTIONS" is this not the same as updating a record? what is the difference and how do I set this page up?
          -------

          it´s actually the same, and any PHP page that´s containing an ADDT "Insert Record" or "Update Record" form should automatically register the added Send Email - behaviour as AFTER trigger.

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Problems turning PHP into HTML so it can be emailed using Dev Toolbox
            Level 1
            Hiya,

            I have finally managed to get the update record and the email sending to work. The final problem is trying to send the actual dynamic parts of the email.

            Your reply says I should replace the current code to get the data with just {sandw1} but all I get in the final email is sandw1 and not the actual record from the database.

            Have I misunderstood? I would have thought now there is no PHP code left in the document its not going to replace anything in curly brackets as there is no instruction to tell the server to do this???

            Do I need some other sort of code somewhere to make this final step work?
            The PHP page is at: http://www.relishlunch.com/emails/index.php
            The stripped out HTML is at: http://www.relishlunch.com/emails/index.html

            Its so frustrating as I am now so nearly there!

            Thanks for any more advice!

            Colin
            • 3. Re: Problems turning PHP into HTML so it can be emailed using Dev Toolbox
              Günter Schenk Level 4
              Hi Colin,

              --------
              Your reply says I should replace the current code to get the data with just {sandw1} but all I get in the final email is sandw1 and not the actual record from the database.
              --------

              the syntax for embedding recordset data is slightly different and should be {LatestLunchesRecordset.sandw1}

              Cheers,
              Günter Schenk
              Adobe Community Expert, Dreamweaver
              • 4. Re: Problems turning PHP into HTML so it can be emailed using Dev Toolbox
                Level 1
                HOOOOORRRAAAAAAAAAHHHHHHHHHHHHHYYYYYYYY

                FABULOUS THANKS Sorted now.

                C