Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Matt 2 posts 22 karma points
    Jul 18, 2010 @ 03:23
    Matt
    0

    How to dynamically change banner / background image based on page.

    Hello all.  Before we begin, I am an experienced C# developer, but regrettably a complete Umbraco newb.  This is my first attempt at installing this CMS in a site, so please forgive me if I'm asking a stupid question or posting in the wrong place.

    That being said, I am trying to dynamically change the banner based on the page.  I would like the user to be able to select an image (or upload a new one) and have that dynamically set that on the page load.  What's the best way to accomplish this?  So far, I have added a "Generic Property" called "Background Image" of type "Media Picker".  I have yet to figure out:

    • how to upload images into the media folder, (When I click media, no options are displayed?) or to
    • how to set div background on the master page to the image value

    Any help with this topic would be appreciated. Tx

  • Folkert 82 posts 212 karma points
    Jul 18, 2010 @ 09:42
    Folkert
    0

    I think it's important to understand how Umbraco works. To accomplish your task you have to:

    1. create document type with a media picker control
    2. create a template
    3. create a macro(xslt/usercontrol) to pick up the value from the documenttype
    4. create a node based upon the document type
    5. use the template from step 2 to render the node
    6. run the page

    The fun is in the third step, to create the actual logic. This can be done by xslt or just a usercontrol using the umbraco API.

    There are lost of samples posted in this forum to retreive the image selected in the node.
    The easiest way is to use xslt for selecting the background.

     

  • Dan 1285 posts 3917 karma points c-trib
    Jul 18, 2010 @ 10:36
    Dan
    0

    Hi Matt,

    Umbraco.tv is your friend if you're new to Umbraco.  Watch a few tutorial videos on document types, templates and macros (it'll take about an hour or so to get through the key ones) then you'll be completely set.  Once you get your head around the key concepts, it's an absolute piece of cake.

    HTH

  • Matt 2 posts 22 karma points
    Jul 19, 2010 @ 01:55
    Matt
    0

    I have learned a little about XSLT and Custom Controls, but I have failed to find any documentation on where in the XML I'm supposed to transform the page's (node's ?) properties come from. 

    The same comment applies to Custom Controls & .NET.  I have learned how to create a custom control and macro, but have yet to see it interact with the page data structure.  The only possibility, would be for Umbraco to pass the page id into my control as a property, and I would query the database for the filename directly based of the page id.

    Is there something I'm missing?  Thanks again.

  • Folkert 82 posts 212 karma points
    Jul 19, 2010 @ 09:26
    Folkert
    0

    I think you should install a starterkit from the package repository and try to understand how things work. take a look at the templates, the macro's the xslt files and the usercontrols. Read tutorials in the document section and look at the great video's found on the Umbraco site.

Please Sign in or register to post replies

Write your reply to:

Draft