Guilouz Wrote:Hi Bob,
I don't really understand how is working templates. I want to avoid widgets reloading and I see it's the solution.
This is my Personalized widgets : [redacted-in-case-you-don't-want-it-publically-shared-and-thats-why-you-PM'd-me]
How to "convert" this to use them as templates ?
Thanks for your reply.
Hi Goilouz. Hope you don't mind me responding here - I do my absolute upmost not to do 'support' via PM
It's not necessarily easy to convert what you have to templates, purely because the different elements of Skin Shortcuts are designed to work with each other. So, when using templates for widgets they work best with the Skin Shortcuts widgets methods - You may well be using them already, but just in case I'm going to go from the absolute basics here. So, the entire process, assuming you're not already managing the widgets with Skin Shortcuts, would be something like...
(1) Add a couple of new controls to the management dialog. GUI 312 to let the user select a widget, and a second with an ID of your choice (which doesn't clash with any of Skin Shortcuts own GUI controls) to choose a layout for the widgets
(2) Now, in the overrides.xml, you need to tell the script what layouts your support. Something like the following:
Code:
<property property="widgetLayout" label="Categories Big">WidgetListCategoriesBig</property>
<property property="widgetLayout" label="Categories Small">WidgetListCategoriesSmall</property>
<property property="widgetLayout" label="List Poster">WidgetListPoster</property>
Keep going until you have one for each layout you support. Note the value that will be set is the name of your include for that layout - that will make things easier when writing the template. (You could potentially use the template to decide which layout to use based on content, for example, but this is the easiest way and a good place to start!)
Edit: Actually, you might already be doing something like this with your WidgetStyles property - if so, then obviously just use that instead of this widgetLayout, though you'd need to tell the template what include to use for whatever values you have for the WidgetStyles property...
Now, still in the overrides, tell Skin Shortcuts to use the second button you added in step (1) to actually set the 'widgetLayout' property:
Code:
<propertySettings property="widgetLayout" buttonID="[id-you-chose-in-(1)]" />
More details on properties -
https://github.com/BigNoid/script.skinsh...properties
(3) The template. Because you already use includes and params, this should actually be quite easy. You're going to want an 'other' template, and build it when the widgetPath property is set. We'll pull out the various widget properties that the script sets, and the widgetLayout property we've added (as well as give that a fallback). A simplistic template for a single widget only - which obviously hasn't been tested by me in any way, and doesn't include things such as scrollbars or anything else beyond the actual include, would be…
Code:
<other include="widget">
<!-- Only build if the widgetPath property has a value -->
<condition tag="property" attribute="name|widgetPath" />
<!-- Pull out Skin Shortcuts widget properties -->
<property name="name" tag="property" attribute="name|widgetName" />
<property name="path" tag="property" attribute="name|widgetPath" />
<property name="target" tag="property" attribute="name|widgetTarget" />
<!-- Pull out the widgetLayout property, and give it a value if none is specified -->
<!-- Note, there are other ways to give it a default value - doing it here may not be the best way -->
<property name="layout" tag="property" attribute="name|widgetLayout" />
<property name="layout">WidgetListPoster</property>
<!-- We also pull out the ID of the main menu so we can ensure each list has a unique ID -->
<property name="id" tag="mainmenuid" />
<controls>
<!-- Every one will be in it's own grouplist, so let's define it and give it a unique ID -->
<control type="grouplist" id="2200$SKINSHORTCUTS[id]">
<!-- Current common include -->
<include>WidgetGroupListCommon</include>
<!-- Skin Shortcuts-managed visibility -->
<skinshortcuts>visibility</skinshortcuts>
<!-- Use the value of 'widgetLayout' as the name of the include we're using -->
<include content="$SKINSHORTCUTS[layout]">
<!-- Pass the Skin Shortcuts widget parameters to the include -->
<param name="content_path" value="$SKINSHORTCUTS[path]"/>
<param name="widget_header" value="$SKINSHORTCUTS[name]"/>
<param name="widget_target" value="$SKINSHORTCUTS[target]"/>
<!-- Not sure what this one does exactly, but I'm sure you know what to do with it -->
<param name="list_id" value="22100"/>
<!-- Skin Shortcuts can set the visibility, so the following isn't used any more -->
<!-- <param name="visible" value="String.Contains(Container(9000).ListItem.Property(WidgetStyle1),Posters) | String.IsEmpty(Container(9000).ListItem.Property(WidgetStyle1))"/> -->
</include>
</control>
</controls>
</other>
And you should have something that - with a bit of time taken to understand, debug and tweak - should work as your first widget.