variables in layout.Master?

A place for discussion about skinning and design. Before posting questions here you should review the documentation about creating skins.

This thread is closed to new posts. You must sign in to post in the forums.
12/14/2010 8:02:37 PM
Gravatar
Total Posts 147
Download Free Mojo Skins http://crypticsites.net

variables in layout.Master?

I'm wondering if there's any way to use variables in layout.Master -- mainly, to refer to the folder of whatever is the current skin.

The situation is that in my skin designs, I've created a new AddThis button, which is a square plus sign, orange, to match their orange plus sign logo; rather than putting this in the header, where its presence or absence may disrupt the layout, I place it in the lower right corner of the page, directly across from the RSS symbol in the lower left which is standard with Artisteer designs -- I use a 32x32 RSS square, so that symbol and the 32x32 orange plus sign are perfectly balanced, but if one does not appear, it doesn't disrupt the layout.  I include this addthisplussign.png in the images folder, so it would be useful to have a way to refer to the folder of the current skin, to always point to that folder for that image -- rather than having to hard code each different path for each different skin.

I've gotten the first of my skins updated and just about ready to zip up and put in shared files; you can see this square plus sign design at http://crypticsites.net/biz-portal-redux-4-mojo.aspx (at the bottom of the page).

Andria

 

12/14/2010 8:05:21 PM
Gravatar
Total Posts 2253

Re: variables in layout.Master?

Hi Andria,

Check this page out: http://www.mojoportal.com/using-images-in-layoutmaster.aspx.

Hope it helps,
Joe D.

12/14/2010 8:50:50 PM
Gravatar
Total Posts 147
Download Free Mojo Skins http://crypticsites.net

Re: variables in layout.Master?

Hmm, that's very interesting; I hadn't run across this page before; it definitely opens up a lot of intriguing possibilities.  However, it might be a bit tricky for the AddThis button, since it's already some sort of control (that "<mp:InsecurePanel ..." business).  Is it possible to "embed" one control inside another?

Sorry to be so ignorant, but this is all new territory to me.

Thx!

Andria

12/15/2010 9:45:50 AM
Gravatar
Total Posts 18439

Re: variables in layout.Master?

Hi Andria,

You can override the path for the button image on the AddThisButton control using 

ButtonImageUrl="~/pathtoyourimage.png"

where ~/ will be resolved as the root of the site.

Some controls can contain other controls. InsecurePanel  is really a custom version of <asp:Panel which is a container control that renders as a div. All InsecurePanel is for is to suppress insecure content on a page that is secured with SSL. The reason the AddThisButton is inside it is beacuse it does some non-ssl stuff and if you let it render on a page secured by SSL the user will get browser warnings about the page having both secure and insecure content. So InsecurePanel just detects if the page is using SSL and if so it hides itself and any contained content, so in this case the addthis button will not be shown on pages secured by ssl to avoid the browser warning.

Hope it helps,

Joe

12/15/2010 3:02:43 PM
Gravatar
Total Posts 147
Download Free Mojo Skins http://crypticsites.net

Re: variables in layout.Master?

I think I'm just stuck hardcoding for the skin; using that "~/" may render as the site root, but the site root isn't what I'm looking for in a variable -- I want the active skin folder, so I don't have to type it out all the way to:

~/Data/Sites/1/skins/BlackLeather/images/addthisplussign.png

 

I looked at the page the-other-Joe referred me to, and that looks really useful, unless you need that path inside another control.  What I ended up with, looks like this, and I'm pretty sure it won't fly:

 

<mp:InsecurePanel ID="InsecurePanel1" runat="server" CssClass="addthisbutton">
<portal:mojoAddThisButton ID="at2" runat="server" AccountId=""
<portal:SkinFolderImage ID="imgs1" runat="server" ImageFileName="addthisplussign.png" AlternateText="Share This Using Popular Bookmarking Services" /> />
</mp:InsecurePanel>

There actually already is a control inside the insecure panel; when I try to put in the "skinfolderimage" control, what I end up with is two closing tags just before the closing tag of the InsecurePanel -- I just can't see how that will be workable at all.  So I guess I'm stuck with hardcoding the path to the current skin, like so:

<mp:InsecurePanel ID="InsecurePanel1" runat="server" CssClass="addthisbutton">
<portal:mojoAddThisButton ID="at2" runat="server" AccountId="" ButtonImageUrl="~/Data/Sites/1/skins/BlackLeather/images/addthisplussign.png"
Text="Share This Using Popular Bookmarking Services" CustomBrand="" CustomLogoUrl=""
CustomLogoBackgroundColor="" />
</mp:InsecurePanel>


crying

Andria

12/16/2010 6:38:34 AM
Gravatar
Total Posts 18439

Re: variables in layout.Master?

you could do it like this:

<portal:mojoAddThisButton ID="at2" runat="server"
AccountId=""
ButtonImageUrl='<%= SkinBaseUrl + "yourimagefile.png" %>'
Text="Share This Using Popular Bookmarking Services"
CustomBrand=""
CustomLogoUrl=""
CustomLogoBackgroundColor=""

/>

note carefully the use of single quotes and double quotes, it must be formatted as shown. 

12/16/2010 9:03:15 AM
Gravatar
Total Posts 147
Download Free Mojo Skins http://crypticsites.net

Re: variables in layout.Master?

Hmm... well, that didn't work.  I tried it first exactly as you posted it:

<portal:mojoAddThisButton ID="at2" runat="server"
AccountId=""
ButtonImageUrl='<%= SkinBaseUrl + "addthisplussign.png" %>'
Text="Share This Using Popular Bookmarking Services"
CustomBrand=""
CustomLogoUrl=""
CustomLogoBackgroundColor=""
/>

Saw no image, so, realizing that I wanted the images dir rather than the base skin dir, I made the filename (inside the double quotes) say /images/addthisplussign, and, I removed the spaces.  Still saw no image, so I removed the initial slash, making it images/addthisplussign (no slash at the start).  Still no image.  So I looked at the source code that's being rendered from this, and this is what it shows:

<a id="ctl01_at2" onmouseover="try {return addthis_open(this, '','[URL]', '[TITLE]' );}catch(ex){} " onmouseout="try { addthis_close(); }catch(ex){}" href="http://www.addthis.com/bookmark.php"><img src="/&lt;%=SkinBaseUrl+&quot;images/addthisplussign.png&quot;%20%>" alt="Share This Using Popular Bookmarking Services" style="border-width:0px;" /></a>

As you see, the leading bracket for the "SkinBaseUrl" expression is being rendered as if it is escaped, as &lt; rather than a literal bracket -- however there is no corresponding &gt; so clearly there's a problem here somewhere.

I'm half done now with updating these skins, so I guess I'll just stick with hardcoding the skin path.

Thx though; it looked like it might work, but doesn't seem to.

Andria

 

12/16/2010 9:46:21 AM
Gravatar
Total Posts 18439

Re: variables in layout.Master?

Sorry, change the = to # like this:

<portal:mojoAddThisButton ID="at2" runat="server"
AccountId=""
ButtonImageUrl='<%# SkinBaseUrl + "yourimagefile.png" %>'
Text="Share This Using Popular Bookmarking Services"
CustomBrand=""
CustomLogoUrl=""
CustomLogoBackgroundColor=""

/>

12/16/2010 9:53:48 AM
Gravatar
Total Posts 18439

Re: variables in layout.Master?

I take it back that didn't work either. I'll add a setting for the next release to allow it by setting UseSkinBaseUrl="true", then you will be able to use ImageFileName="yourimage.png" to specify the file name.

You must sign in to post in the forums. This thread is closed to new posts.