Search

Hi,

I am about to start writing a couple of events to help with shopping cart integration for a site. As well as the events I will be adding some other custom classes (to store cart info etc). Where is the recommended place for storing these type of helper classes?

My current thinking is within the /workspace folder, is this how other people tend to do it? I'm thinking of having something similar like workspace/custom/ and them within /custom/ have any classes etc I require.

Does this sound like a good/sensible idea? If not, what is the recommended way for doing this?

I'm not sure if it's best practice (although given the MVC structure I imagine it would be), but every now and then I need access to some custom PHP functions, so have a 'Custom PHP' extension that I often have installed that I can just drop them in to. Then I can call them in the XSL using the

xmlns:php="http://php.net/xsl"

declaration (at whatever level is appropriate).

I personally consider this a bit hacky so someone else might have a better response - but this works and is tidy enough.

I'd personally avoid sticking helpers into the workspace folder just because that's the 'view'.

Yeah I see what you mean with workspace being the view.

My thinking was that I shouldn't put it into symphony as that's for the core stuff, is this correct?

Ideally, it is best to create your custom coding via extensions. I find when I approach everything from the perspective of an extension, I create more reusable code for other projects. Event and data source folders in an extension folder are read by Symphony.

Nonetheless, we have all been guilty of creating some down and dirty event and data sources for one-off use in a project and stored them in the appropriate workspace folders. If you go this route, make sure you set allowEditorToParse to false so that you don't accidentally overwrite your custom code via the editor in the backend.

You should never store anything in the symphony folder.

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