Public & Private
Skip to end of metadataSometimes it is necessary to create pages which do not belong to any particular module, but simply host use some block functions or slots, The Public and Private modules are intended to allow easy access to Core dna with minimal loading. They use the Routing and SEO-URL centre options to route to the correct template. If there is an error loading, a 404 or homepage redirect will be returned.
Anything which does not require a user login can be routed through the the Public module, e.g: 'about' page with a block function to display a contact form. If it requires a user to be logged in, for example 'my-account' page, then it must go though the Private module. Core dna will automatically check each request if the user is logged in so the front end does not have to. If the user is logged out and they request a private URL, then they will be redirected to the login page.
Example URL's
- https://sandbox10.coredna.com/public/contact-us
- https://sandbox10.coredna.com/public/about/about-us
- https://sandbox10.coredna.com/private/abc123/mytestfile
- https://sandbox10.coredna.com/private/simple
It is possible to specify a directory and then a template name. the last argument will always be the template to use (sans the .html extension) and if there is another level between public/ or private/ then that will be used as the directory.
Every P&P request supports the JSON reponse type.
Arguments
You can pass in arguments into each request simply in the following format:
- required | action - module (public or private)
- required | form_name - the template to use
- optional | directory - the directory to use. Must come before the form_name template name. Only supports one level under templates.
P&P also support the use of pretty URL parameters, for instance the above example becomes
Both URL point to the same location.
File Structure
All P&P templates must be located under a directory called templates, then the directory name passed or just under the templates directory itself.
The sandbox examples are shown below: