Jump to content

CMS Templates in application


Go to solution Solved by bfarber,

Recommended Posts

I have some question to CMS templates included into app:

1. Is it intentional that CMS templates delivered with the application are not removed if application is uninstalled?

2. If it is supposed that deleting must be handled in Uninstall extension manually, how do I know what templates belong to the app? I can see the field template_app in cms_templates table. However there is no value in it for any template. Is there any mapping table or function to get all templates that belong to the app?

3. If the application is uninstalled and the templates are still there and I try to install the application again, I get the error: 

Quote

2S100/6 The page you requested does not exist

The error persists until I manually delete the templates that have been delivered with app. After that the installation is possible again. It looks like leaving templates there produces error, so they must be deleted.

Thanks.

Link to comment
Share on other sites

  • Solution

1. Uninstalling the application will not remove the custom Pages templates, no.

2. No mapping is retained. There is no out of the box way for you to know which templates were inserted from your app.

3. Can you send me a copy of a basic app you can reproduce this issue with? That sounds like a bug we should take a look at.

 

The reality is, Pages templates aren't designed to be tied to your app - they're part of Pages once they're imported. Databases could be set up that are using those templates and simply deleting them from the database could break those databases, for instance. That said, you shouldn't run into errors reinstalling a copy of the app.

Link to comment
Share on other sites

21 hours ago, bfarber said:

1. Uninstalling the application will not remove the custom Pages templates, no.

This would mean that no application that uses this feature will be approved in Marketplace. Right? As for the rules, the Uninstall extension should be used to delete everything that app installs. In this case it would not. 

21 hours ago, bfarber said:

2. No mapping is retained. There is no out of the box way for you to know which templates were inserted from your app.

So, no updates for the templates delivered this way are possible, right? If I release a new version of the app, the templates delivered with it will not be updated as there is no way to know what templates belong to the application.

21 hours ago, bfarber said:

The reality is, Pages templates aren't designed to be tied to your app - they're part of Pages once they're imported. Databases could be set up that are using those templates and simply deleting them from the database could break those databases, for instance. That said, you shouldn't run into errors reinstalling a copy of the app.

In my app, I deliver a Pages database, templates, language strings, some extensions, custom fields, blocks, hooks and settings with application. The templates alone would not work as they rely on special fields and hooks provided with the app. Leaving templates there after uninstall would not make any sense, as they would throw errors. They cannot be used in other databases without special fields and hooks. 

The question is: does it make sense to provide a one-step-install for a Page database with rich features via special fields, templates and plugins? Or is there no way to be approved in Marketplace with it? 

22 hours ago, bfarber said:

3. Can you send me a copy of a basic app you can reproduce this issue with? That sounds like a bug we should take a look at.

I'll send you a copy as soon as not alpha any more 😉 

Link to comment
Share on other sites

5 minutes ago, Sonya* said:

This would mean that no application that uses this feature will be approved in Marketplace. Right?

It means the opposite. Since it’s the default behaviour to have these templates remain installed, this is what IPS expects and approves. 

Before 4.5, templates were delivered separately and had to be installed manually. Since that is not possible anymore, since all Marketplace offers are now just one file, templates now come with apps and plugins, but they behave as before. 

5 minutes ago, Sonya* said:

So, no updates for the templates delivered this way are possible, right? If I release a new version of the app, the templates delivered with it will not be updated as there is no way to know what templates belong to the application.

It’s not about the app/plugin that installed it. It’s about the name of the template. If names match during the upgrade, there will be conflict dialog which gives the user the choice to update the template or to keep the old one. 

 

Link to comment
Share on other sites

22 minutes ago, opentype said:

It’s not about the app/plugin that installed it. It’s about the name of the template. If names match during the upgrade, there will be conflict dialog which gives the user the choice to update the template or to keep the old one. 

Do you get a conflict dialog during install es well? Assuming there are templates that have the same name as yours before your app installed. This is exactly what does not work for me. The installation breaks. I have to remove the templates manually before trying the new install. 

Link to comment
Share on other sites

@bfarber, I am not sure it is the best way to leave templates there. Especially if they rely on existing app settings, storage extension, language strings, hooks and so on. For me, it would be better to map templates to the app and to delete them if the app is uninstalled. As they are not usable without app and not usable on ALL databases but only on specific one.

Link to comment
Share on other sites

7 minutes ago, Adriano Faria said:

Delete the templates in your resource uninstall: 

I do. But still there can be a case where the customer renames the template himself. If I rely on the templates name only in my Uninstall extension, I can occasionally delete the templates that do not belong to my app. I know, this would be a very rare case but still, I do not have a good feeling to delete something that I am not sure has been installed with my app. On the other hand, I do not have a good feeling leaving templates in the system, that are definitely unusable without my app. As they are garbage in this case

Cant Decide No Clue GIF by JMatt

Link to comment
Share on other sites

Make sure the application the template relies on is installed and enabled before you try to access those methods. 

For all the data I fetch from a non-Pages app I do something like this:

{{$classifieds = array();}}
{{if \IPS\Application::appIsEnabled( 'classifieds' )}}
	{{ try { $classifieds = \IPS\myapp\MyClass::getFrontpageClassifieds(); } catch (\Error $e) { } }}
{{endif}}

And then I can just do a count() on $classifieds before printing that data.

Link to comment
Share on other sites

  • 2 weeks later...
On 9/25/2020 at 3:26 PM, bfarber said:

3. Can you send me a copy of a basic app you can reproduce this issue with? That sounds like a bug we should take a look at.

Please try to reproduce the error as described in this topic: 

I have tried with support ticket, but had no luck so far. 

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Upcoming Events

    No upcoming events found
×
×
  • Create New...