Developer forum

Forum » Swift » Custom templates by Area

Custom templates by Area

Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,
I have a project where I need to implement a few different websites. Each website has its own branding and its own needs.
The challenge here is to handle customization of the templates while still keeping the Swift v2 approach.
We have identified a few options to handle this scenario; each has its own benefits and downsides.
The ideal scenario is to have a single design folder (Swift V2) with custom templates (where needed) for each website. The thing I don't like very much with this approach is that we will end up with a long list of templates for each paragraph. I was wondering if there is any way of filtering these templates by area. To be more exact, I was wondering if we can use a naming convention, adding the Area number as the start of the template name, and filter the list before loading the item type interface for the admin.  I have not thought about the convention in detail; at this point, I want to know if there is an existing way of handling this scenario with default functionality, and if not, if I can create some code that would filter the list of available templates before rendering the ItemType interface.
Thank you,
Adrian


Replies

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Anybody?

 
Karsten Thuen Dynamicweb Employee
Karsten Thuen
Reply

Hi Adrian

I do not think the template look up has any secrets that looks at an area id. There are two options I can think of:

1. Use presets. This will give you visual options, limited to what you created on each area. But you will still have possiblilites from the other areas, on for example the paragraph edit -> layout.

2. In theory, and as far as I know, you could take all the content from the Swift-v2 folder and move it to the root of the "Template" folder. Then you add folders under Design for each of the areas. Following the folder and naming conventions, you may make varitaion templates in these folders.


Best regards
Karsten Thuen 

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi Karsten,
Thank you very much for the suggestions.
I did consider using the presets (actually, we will use the presets), but it does not solve the complexity for a user trying to choose a different layout. We can use naming conventions for the layouts, but it will still be a very long list (we will have +7 different brands in the same solution).
I did consider having separate Page templates for each brand and separate folder trees for each Page, but this will not solve choosing a default template.
I have not tried the Templates approach. I did consider it, but I dismissed it very fast. Maybe I should give it another thought.
My hope was that I would somehow "intercept" the templates lookup and do some filtering before they are loaded in the interface.

Thank you,
Adrian

 
Adrian Ursu Dynamicweb Employee
Adrian Ursu
Reply

Hi guys,

On this topic, I was wondering if anyone knows exactly how the child themes work.
It seems that adding a "Swift-v2_Custom" would become a child theme of "Swift-v2".
Is there any way I can create multiple child designs based on the same Master design? Something like "Swift-v2_custom_project1" ?

Thank you,

Adrian

 

You must be logged in to post in the forum