7 Replies Latest reply on Feb 15, 2009 7:17 AM by Günter Schenk

    Passing a Variable with $ins_properties->registerTrigger("END")

    Ben Densin
      Hello,
      I'm creating a real estate site with forms which will enable an agent to add property info and features, then upload photos. Here's the steps/forms I've set up:

      Form 1: The agent will enter property details and property features (this is working with no problems). He or she, after this form is submitted, needs to be sent to a form to upload property photos, while passing a variable, "property_number."

      Form 2: This form needs to receive the variable "property_number" from Form 1, in order to specify the name of an images folder to be created.

      So this line,

      ###CODE###

      $ins_properties->registerTrigger("END", "Trigger_Default_Redirect", 99, "photo_upload.php");

      ###END CODE###

      needs to be modified, and "photo_upload.php" needs to be changed to "photo_upload.php?property=$variable"

      Keeping in mind this is not the form action destination, it is the page to which users are directed if Form 1 is submitted successfully.

      This variable can be passed by either the POST or GET variables, it doesn't matter, but for some reason I keep getting error messages, possibly because of clashes with the quotation marks.... I can't figure it out.

      How would I modify the photo_upload.php URL to pass this variable, then retrieve it in the second form?

      Thanks very much!

      Ken
        • 1. Re: Passing a Variable with $ins_properties->registerTrigger("END")
          Günter Schenk Level 4
          Hi Ken,

          it´s fortunately very easy to pass ADDT´s insert or update transaction values to the Trigger_Default_Redirect page, as all you need to do is appending them using ADDT´s "dynamic data" format, which in your case would be:

          photo_upload.php?property={property_number}

          Rather than coding this manually you could actually achieve the same by...

          1. double clicking the existing Insert Transaction in the Server Behaviours tab

          2. appending "?property" to the already defined "after inserting, go to" page

          3. clicking the blue thunderbolt to the right and select:

          a) Get values from: Transaction field
          b) Transaction field: property_number

          As I said, the result will be the same

          -------
          Form 2: This form needs to receive the variable "property_number" from Form 1, in order to specify the name of an images folder to be created
          -------

          The to-be-created images folder should equal the value of the URL variable (aka GET) "property"

          Cheers,
          Günter Schenk
          Adobe Community Expert, Dreamweaver
          • 2. Re: Passing a Variable with $ins_properties->registerTrigger("END")
            Günter Schenk Level 4
            BTW, I´ve been working for a turkish construction / real estate company for many years and also developed a custom property database with ADDT respectively its predecessor MX Kollection ;-)

            Cheers,
            Günter Schenk
            Adobe Community Expert, Dreamweaver
            • 3. Re: Passing a Variable with $ins_properties->registerTrigger("END")
              Ben Densin Level 1
              Thanks Gunter!

              I wouldn't have thought to do it that way. I'm new to ADDT, it looks like it can do just about anything I'd have to hard-code, just in a bit of a different way. I'll give it a try and post the results!
              • 4. Re: Passing a Variable with $ins_properties->registerTrigger("END")
                Ben Densin Level 1
                I was going to send you a PM but don't see a way to do that... If you can contact me on the contact form at TurkeyCentral.com I may be able give you a link in our real estate directory, it's the largest English-friendly directory for everything having to do with Turkey on the Web... I have to check each site personally first. You'd definitely be getting some traffic from us as a result! :)
                • 5. Re: Passing a Variable with $ins_properties->registerTrigger("END")
                  Günter Schenk Level 4
                  Hi Ken,

                  as you say you´re new to ADDT, I´d like to point you to some additional tutorials which might be of help in the future:

                  1. Waleed Barakat (from Egypt) has written many excellent tutorials on his website: http://www.developer-online.com/

                  2. yours truly has written some stuff as well: http://www.guenter-schenk.com/tutorials/

                  AFAIK there are some even some additional tutorials out there which have been written by other ADDT users, but as those chaps just don´t shout that out from the rooftops, and as I can´t recall the URLs, googling might help.

                  ------
                  it looks like it can do just about anything I'd have to hard-code
                  ------

                  well, even ADDT has some limits by nature, and once you´re ready to develop more advanced stuff you will come to a point where you need some additional hand-coding.

                  BTW, may I ask why you´re planning to create a property image folder which is named after a transaction value ? Of course you´ll need a unique folder somewhere, but I wonder if it´s named according to a user-defined value (the contents of a form field), or if the folder name will be defined according to a certain "behind the scenes" rule you define ?

                  Cheers,
                  Günter Schenk
                  Adobe Community Expert, Dreamweaver
                  • 6. Re: Passing a Variable with $ins_properties->registerTrigger("END")
                    Ben Densin Level 1
                    Well you certainly might be able to help me from painting myself into a corner here! I'm still somewhat of a novice to PHP/MySQL as well, and have to use tutorials to find my way as I go.

                    Each property detail page will have the basic info about the property, features (which were handled with a lookup table and ADDT's many-to-many wizard), and a photo gallery. So I have to find some way to assign certain photos according to each property.

                    To upload properties, and photos of the properties, the real estate agent will use two forms to add a property to the site. The first will be a form with the property's basic information and the features.

                    After submitting that, the agent will be redirected to a photo upload form. To make sure the photos are added to the correct property, the variable from the first form is used to make sure the photos correspond to the same property.

                    Each property will get its photos from a folder hierarchy something like this:

                    /images/(primary key)/
                    and
                    /images/(primary key)/thumbnails

                    Of course as a novice I'm not sure if this is the best way to do it, but I can't think of a better way. I've searched for, but haven't found, any decent tutorials on this.

                    I don't know if ADDT has a way to do it, but I'm using the book PHP Solutions to set up a photo upload which will create a new images folder, re-size and upload the photos there, then also create a thumbnails sub-folder and put thumbnails in that folder.

                    I could use another value, for example the property number the agent uses, but my concern is that they might use the same number twice, and I thought using the primary key would be the easiest way to handle it.

                    If there's a better way to handle this, I'd certainly appreciate any advice you might have!

                    By the way, the variable is being passed successfully! Thanks!!! :)

                    I'm working on a site for Cesme, near Izmir, where I live.
                    • 7. Re: Passing a Variable with $ins_properties->registerTrigger("END")
                      Günter Schenk Level 4
                      Hi Ken,

                      just some pointers:

                      -------
                      Each property will get its photos from a folder hierarchy something like this:

                      /images/(primary key)/
                      and
                      /images/(primary key)/thumbnails

                      Of course as a novice I'm not sure if this is the best way to do it
                      -------

                      naming the images folder after the property offer´s primary key is indeed the best way, as this is the only data type which will always be unique. Wise decision :-)

                      --------
                      So I have to find some way to assign certain photos according to each property.
                      --------

                      pretty easy: make sure to have ADDT insert the corresponding "property_number" value into another column (type: int) of your "images" table -- this value gets most probably derived from an URL variable you´re passing to the image upload form.

                      From experience I´ve come to find at least one additional column pretty important for property image galleries: "active", which would have to be a char1 column, holds a Boolean Y/N value, and can be driven by a checkbox.

                      -------
                      I don't know if ADDT has a way to do it, but I'm using the book PHP Solutions to set up a photo upload which will create a new images folder, re-size and upload the photos there
                      -------

                      ADDT has an "image upload and resize" feature, and if the specified image folder doesn´t exist yet, it will be created prior to uploading the image there

                      -----
                      then also create a thumbnails sub-folder and put thumbnails in that folder
                      -----

                      thumbnails will (but not automatically when uploading the main image) be created in a "thumbnails" folders below the main image directory

                      ------
                      I'm working on a site for Cesme, near Izmir, where I live
                      ------

                      the company I work(ed) for has its head office in Kusadasi and also builds villas on the west coast of the Bodrum peninsula

                      Cheers,
                      Günter Schenk
                      Adobe Community Expert, Dreamweaver