Stump the Panel » End Users and Information Workers

Show specific image on blog page based on category

(3 posts)
  • Started 7 months ago by spmiller
  • Latest reply from spmiller
  1. spmiller
    Member

    I have created a SP Blog. On the category.aspx page, I'm using a URL filter to show only the post(s) for each category when I select that category. So for instance, the filter reads category.aspx?name=feature then only shows the posts categorized as feature.

    What I want to do is show on that category.aspx an image at the top that brings out the fact that this is the "Feature" category, as opposed to another one of the categories. How can I do that?

    And would a potential solution also work for the post.aspx page?

    Posted 7 months ago #
  2. Okay, here's how to do it:
    First, make sure you have an image library that contains each of the category images, and create a lookup field in that library to the Category list's Title field. That way, you can associate each image with a category

    Create a blank web part page. Open this page in SP Designer, and click in a zone, and add a data view web part. Pick your image library where the associated images are store.

    In the data source library, click the drop-down on your image library, and choose "Show data". Select only the Name field, and choose to insert selected field as... Multiple item view.
    Put your aspx page in split screen, so you can see the code. Select the first cell that contains the name of the first image in the library. In the code, within the <td> (that cell), paste this:

    <img border="0" src="{@FileRef}" />

    Then, this will display only the images in your table.

    Save, and go open this web part page in your browser. Export the web part, and then go to the category.aspx page. Import the web part there.
    Then, create a new web part connection from your Query String URL filter to this new image library web part. For the filter field, choose "Category".

    VOILA!
    FUN STUFF!

    Laura Rogers
    http://spinsiders.com/laurar

    Posted 7 months ago #
  3. spmiller
    Member

    Thank you so much Laura. That worked great for the category.aspx page. I tried to use it on the post.aspx page but I wasn't successful. Since the post only has an ID, I can't use the URL filter, so I tried using the Category Name Filter to pull the blog category from the post, but when I connect the filter to the image webpart (the same that I created for the category page), it doesn't show the image. Any thoughts on that?

    Thanks again for your help!

    Posted 7 months ago #

RSS feed for this topic

Reply

You must log in to post.