Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...How to refer to skin path in skin object attributes?How to refer to skin path in skin object attributes?
Previous
 
Next
New Post
1/14/2007 11:39 AM
 

Some skin objects (e.g. [SEARCH] and [LOGIN]) let the skin designer customize their text. For example, [SEARCH] has a 'Submit' attribute, which can contain arbitrary HTML. So if you want to replace the default "Search" text with an image, you simply assign something like "<img src='mybutton.gif'>" to the 'Submit' attribute.

So far, so good. But:
If I want to use an image in my skin directory, I cannot do this with with the <%= SkinPath %> tag, because this is not resolved in skin object attributes. Instead, I have to write the full path relative to the portal root directory, e. g. "<img src='myportal/portals/0/skins/myskin/mybutton.gif'>", which makes the skin not portable.

I'm using DNN 4.3.6. I didn't find a solution in the skinning guide, so if one of you has an idea, please let me know!

 
New Post
1/15/2007 6:46 PM
 
Maybe you can put an image in it like this
<img id="SubmitImg" src="myimage.gif">
Add a javacript function to your page that accepts a path and replaces the image, and call this with the skinpath

replaceImage ("<%=skinpath%>NewImg.gif")

Since then the skinpath does get processed...
It's a workaround, but it works.

   
 
New Post
1/17/2007 4:20 AM
 

Hi Timo,

thanks for your response. I'll try your workaround (but I still hope that DNN itself has a solution for this without doing some strange "code behind" programming in the core...)

 
New Post
1/17/2007 10:11 AM
 

this little question intrigued me just enough to look into it a bit further :)

I tried this:

<dnn:SEARCH runat="server" id="dnnSEARCH" Submit='<%# "<img border=""0"" src=""search.gif"" />" %>'/>

The <%# %> construct means databinding, and this is done automatically at some stage during the loading of the skin. Not sure why, but at least in my test, the correct path of the skin was automatically prepended to the image file name

Source output in IE looks like this:

<a id="dnn_dnnSEARCH_cmdSearch" class="SkinObject" href=" __doPostBack('dnn$dnnSEARCH$cmdSearch','')"><img border="0" src="/DotNetNuke/Portals/_default/Skins/dnn-blue/search.gif" /></a>

Let me know if this works for you too ;)

<edit>

you can even make this localizable like this:

<dnn:SEARCH runat="server" id="dnnSEARCH" Submit='<%# "<img border=""0"" src=""search."+System.Threading.Thread.Currentthread.CurrentUICulture.Name+".gif"" />" %>'/>

which will render like this (if the current locale is en-US):

<a id="dnn_dnnSEARCH_cmdSearch" class="SkinObject" href=" __doPostBack('dnn$dnnSEARCH$cmdSearch','')"><img border="0" src="/DotNetNuke/Portals/_default/Skins/dnn-blue/search.en-US.gif" /></a>

</edit>

<edit2> removed too many closing quotes rendering an extra quote in final html </edit2>


Erik van Ballegoij, Former DNN Corp. Employee and DNN Expert

DNN Blog | Twitter: @erikvb | LinkedIn: Erik van Ballegoij on LinkedIn

 
New Post
1/17/2007 10:21 AM
 
I'm not using any core hack it's a skin hack.
The reason that <%=skinpath%> doesn't work has to do with the way asp.net works, not DNN I think.
Erik solution is very nice, but I have no idea why it works....
Do you Erik?
Where is the skinpath coming from?
 
Previous
 
Next
HomeHomeUsing DNN Platf...Using DNN Platf...Skins, Themes, ...Skins, Themes, ...How to refer to skin path in skin object attributes?How to refer to skin path in skin object attributes?


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, please observe the following posting guidelines:

  1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out