sample of page specific images
Last Post 02/29/2012 10:19 PM by Joseph Craig. 8 Replies.
Author Messages
ALH
Nuke Newbie
Nuke Newbie
Posts:2


--
02/10/2010 7:35 PM
    Hi there

    I looking for a solution that would allow me to put page specific images, under the logo or instead of the logo image on my DNN site.  I found a post which offers a possible solution but to be honest don't have enough experience to fully understand everything that is being suggested.  Can you or anyone else add details or better yet provide an example of how to implement this solution?

    It would be very much appreciated.

    Here is the link to the original post

    http://www.dotnetnuke.com/Community...oding.aspx

    And here is the text in that post.


    Here is a shortcut to show page specific images, like page headers, on every page by adding a tiny bit of code to your skin:

       <h3 class="current-place-head">
       <%
        If (Not PortalSettings.ActiveTab Is Nothing) Then
            Response.Write("<img class="png" src="" & SkinPath & "images/images/" & _
                PortalSettings.ActiveTab.TabName.Replace(" ", "-") & ".png" alt="" & _
                PortalSettings.ActiveTab.Title & "" />")
        End If
       %>
    </h3>

    Here is what I did:

    1. Named my images exactly the same as the Page Name on which they will reside

    2. Replaced spaces used in Page Names with dashes (-) in the images names

    3. In a skin file, I simply put the above code in the place where the page header should appear (in this case it's inside an h3 tag)


    Thanks in advance

     M.

    Joseph Craig
    DNN MVP
    Posts:11667


    --
    02/10/2010 8:31 PM
    The example you cited is a really good one. The basic idea is that it will generate an image tag with the src set to the URL of an appropriately named image.

    Here is another way to do this using token replacement in the Text/HTML module.

    If you enable token replacement for the module, you can put something like this in the Text/HTML module:

    http://[Portal:URL][Portal:HomeDirectory]myDirectory/[Tab:TabName].jpg

    Now, if you have a directory in the root of your portal (i.e. /Portals/N/myDirectory) and you have images in that directory named Home.jpg, Page1.jpg, etc., the page image will be displayed if you wrap the above string in an image tag.

    I would set your skin so that there is a "content pane" where you want the images to appear, place a Text/HTML module in that pane, and set the module to appear on all pages. You will need to the string in the "source" mode of the editor.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    ALH
    Nuke Newbie
    Nuke Newbie
    Posts:2


    --
    02/11/2010 9:39 AM
    Hello Joe

    Thanks for your response. I am going to try to implement your solution this morning.  Could you take a moment and expand on the last sentence in your post which reads

    "You will need to the string in the "source" mode of the editor."

    I don't understand the message that you are trying to convey to me.

    Thanks

    M.
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    02/11/2010 9:52 AM
    When you use the editor to insert into a text/HTML module, you can enter it as WYSIWYG text, or you can turn off the rich text editor and enter html.  Since you are inserting an image tag, you will need to do this in HTML mode.

    You can get into HTML mode by clicking the SOURCE button in the editor, or by changing the radio button selection to just turn off the rich text editor.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    a a
    Posts:10


    --
    02/23/2012 5:04 AM
    I've found this thread very useful, but I would need something more.
    I mean not only [Portal:URL] or [Portal:HomeDirectory] my need is for SkinPath .

    I've tried [Tab:SkinPath], but I get this error "Error accessing [Tab:SkinPath], access to SkinPath is restricted for datasource Tab"

    Please help me!
    Thanks
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    02/23/2012 9:54 AM
    The list of tokens available in the HTML module is here:

    http://www.dotnetnuke.com/Resources...okens.aspx

    As you'll see, there is no Tab:SkinPath.

    Generally, modules should not be configured to need to know what skin is being used on the page, though I could see a reason. It might be better to put those kinds of images in a folder -- say Images/PageXXX/myimage.jpg and use Portal:HomeDirectory and Tab:TabName to construct the path to the image.

    Joe Craig, Patapsco Research Group
    Complete DNN Support
    a a
    Posts:10


    --
    02/23/2012 10:03 AM
    Ok thanks.
    That's the solution I was going to apply.

    Bye
    a a
    Posts:10


    --
    02/29/2012 3:27 AM
    Other question.
    I've used this syntax in my html module:
    [Portal:HomeDirectory]Images/myimage.jpg
    and it works.

    But when I re-edit the module, I find this written:
    /Portals/30/[Portal:HomeDirectory]Images/myimage.jpg

    It is still working (strange...) but it's completely unuseful form my work of copy and paste in modules of different Portals.

    Please let me know.
    My DNN version is: DotNetNuke Community Edition 5.6.2

    Thanks
    Joseph Craig
    DNN MVP
    Posts:11667


    --
    02/29/2012 10:19 PM
    When you "re-edit" the module, do you edit the link? You can always go into HTML mode and edit out the domain name, making the links relative.

    Joe Craig, Patapsco Research Group
    Complete DNN Support


    ---