MediaPortal Forums HTPC/MediaCenter

Go Back   MediaPortal Forum » MediaPortal 1 » Community Skins and Plugins » Skins


Skins You are working on a new Skin? Post it here!

Reply
 
Thread Tools Display Modes
Old 2008-07-30, 15:02   #1 (permalink)
Portal Member
 
Join Date: Feb 2008
Posts: 140
Thanks: 6
Thanked 136 Times in 37 Posts

Country:

My System

Lightbulb Undocumented feature: Styles

I was looking for a way to specify global style definitions. You can include a common xml for Controls used the same way on different pages. But what if you want the same styling applied to other controls? You'll end up specifying the same style multiple times. If you change your mind about a certain color later on it is a lot of work to change it all over your skin.

references.xml provides a place to specify default values for control properties. I wanted something like that so i read the wiki part about references.xml. It says the following:
Quote:
It can also defines styles that can be applied to any control although this feature is not covered in this document.
Sounds promising! So i looked at the MediaPortal sources and found a great but undocumented feature called styles.
Here's how you can use it.

It is possible to define named styles in the references.xml file. You can apply this named style to any Control in your other skin files.

Note: below code blocks are not php code they are xml but i like the syntax highlighting

Imagine we want to use a lot of big red text on our screens ( Don't be surprised if you come back to this decision later on )

Define a global style named 'Heading1' or some other descriptive name. Every Control we apply 'Heading1' to should have font24 and a red textcolor. You can add as many styles as you need. And you are not limited to just font and color as i used here.
PHP Code:
// references.xml
<controls>
  <
skin>
      ...
  </
skin>
  <
style Name="Heading1">
    <
font>font24</font>
    <
textcolor>red</textcolor>
  </
style>
  <
control>
      ... 
Please not that xml attributes are case sensitive, this means 'Name' should be 'Name' and not 'name' or 'nAme'. Same goes for 'Style'!!

Now everywhere you want to use this style you can apply it as shown below
PHP Code:
    <control Style="Heading1">
      <
description>Top title</description>
      <
type>label</type>
      <
label>This is our title</label>
    </
control
This label is shown big and red.

Styles do not override properties defined in the Control itself. If you specified another font for this label it would show using that font and not the one you defined in the style. The style only provides default values!

I think this can be of great use to guarantee a uniform look throughout a skin.

Happy Skinning,

Sambal
Sambal is offline   Reply With Quote
2 Users Say Thank You:
Old 2008-07-30, 16:29   #2 (permalink)
Portal Member
 
the_ult's Avatar
 
Join Date: Jun 2008
Posts: 93
Thanks: 24
Thanked 10 Times in 3 Posts

Country:

My System

Default

Sounds very promising :-)
the_ult is offline   Reply With Quote
Old 2008-08-02, 19:26   #3 (permalink)
Portal Member
 
Join Date: Apr 2008
Age: 22
Posts: 34
Thanks: 7
Thanked 28 Times in 7 Posts

Country:


Send a message via MSN to JakeyMouse
Default

Great work on finding out how to use this!
JakeyMouse is online now   Reply With Quote
Reply

Bookmarks

Tags
feature, styles, undocumented

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
DVD Feature Ebeneezer Improvement Suggestions 5 2008-04-14 05:13
Newzbin This Feature sdalberg My TVSeries 5 2007-11-30 23:04
Feature Request Kurtis My TVSeries 3 2007-08-08 07:11
Is This Feature Already Implemented? stevenduk Improvement Suggestions 4 2005-04-12 01:31


All times are GMT +1. The time now is 15:11.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 Protected by Akismet Blog with WordPress
Advertisement System V2.6 By   Branden