Search

I am considering abandoning a PHP Event Booking System I have been working on and starting again using Symphony taking advantage of the members extension and a proper CMS backend. I am looking for some advice on how to handle part of the booking process.

The current system collects various user inut throughout the booking process and stores this information in Sessions before the booking is confirmed and then written to the database. How should I handle this with Symphony?

Thanks for your help, Andy

That might me rather simple with the Session Monster extension.

You could use the Shopping Cart and Session Monster extensions as a starting point for an extension to save user input data in a session. The Session Monster only saves data from GET requests AFAIK, the Shopping Cart also works with POST. And I think there are more advanced forks of the Shopping Cart extension on GitHub.

To save the data in the database you could fill out hidden input elements in the form for your event, or you could customize the event and read the data directly there for security reasons.

How should I handle this with Symphony?

The same way as if you were building your own application from scratch. Choose the one that suits your comfort level, user flow and security:

  • store values in the session, Session Monster might be useful
  • store values in the querystring by posting forms using method="get"
  • store values using POST using method="post" on your forms
  • store values in the database (a new entry using an event) on the first page, pass the entry ID to the next form, and update the entry one each subsequent form

Thanks all. Looks like like I just need to collect different user input over a couple of pages, before confirming and then saving the appropriate entries.

Can I create a custom data source to output my Post values to the XML?

It may be easier to use sessions and clear them when you're done with the details.

Have a look how the Shopping Cart extension works, and maybe do some research on the Symphony Cookie class works, setting a cookie to 1 hour expiry may be useful, the data is mirrored in the session.

If it's stuff being posted and you don't want the hassle of moving it into session, then a simple data-source could do it

    public function grab(&$param_pool=NULL){
        $result = new XMLElement($this->dsParamROOTELEMENT);

        if(empty($_POST) || !isset($_POST))
        {
            $this->_force_empty_result = $this->emptyXMLSet();
        }

        try{

            foreach($_POST as $key => $value)
            {
                $node = new XMLElement($key, $value);
                $node->setAttribute('handle', Lang::createHandle($value));

                $result->appendChild($node);
            }

        }
        catch(FrontendPageNotFoundException $e){
            // Work around. This ensures the 404 page is displayed and
            // is not picked up by the default catch() statement below
            FrontendPageNotFoundExceptionHandler::render($e);
        }
        catch(Exception $e){
            $result->appendChild(new XMLElement('error', $e->getMessage()));
            return $result;
        }

        if($this->_force_empty_result) $result = $this->emptyXMLSet();

        return $result;
    }

Create an account or sign in to comment.

Symphony • Open Source XSLT CMS

Server Requirements

  • PHP 5.3-5.6 or 7.0-7.3
  • PHP's LibXML module, with the XSLT extension enabled (--with-xsl)
  • MySQL 5.5 or above
  • An Apache or Litespeed webserver
  • Apache's mod_rewrite module or equivalent

Compatible Hosts

Sign in

Login details