Today, I suddenly saw a good blogArticleHere is a record, haha ~~ Although you have previously performed operations on the Content Query Web part...
Before customization:
Although the data is read, how to customizeItemTo meet our needs? This articleBlogWill take you to complete the custom work. In fact, the way to complete this task is to modify it with thisWeb PartRelatedXSLTTo format the data.Content Query Web PartRelatedXSLTThere are three files:
File Name |
Directory |
Description |
Contentquerymain. XSL |
\ Style Library \ XSL style sheets \ contentquerymain. XSL |
This file is usedWeb PartThe overall structure, which defines some logic and functions and calls them when appropriate.Header. XSLAndItemstyle. XSL |
Itemstyle. XSL |
\ Style Library \ XSL style sheets \ itemstyle. XSL |
This file is used to define eachItem, Which has a predefined part.StyleAnd can be customized.Item Style |
Header. XSL |
\ Style Library \ XSL style sheets \ header. XSL |
This file defines how to display the TemplateHeaderAnd make sure all GroupsHeaderConsistency |
in most cases, we only need to care about itemstyle. XSL This file may also involve changes to the other two files based on project requirements. Here we only need to modify itemstyle. XSL this file is enough, because the three files are site default built-in, in order not to other Web Part cause, so we need to create a folder , copy a copy to our folder and make custom modifications. The procedure is as follows:
1.UseSPDOpenSite, In/Style Library/XSL style sheets/CreateFolderCalledNewsandeventsAnd copy the above three files to thisFolderBelow:
2. Configure the page Web Part Export to local disk, modify three XSLT File Path and Commonviewfields Attribute To modify this attribute, you can add custom fields in XSLT Can be referenced in Render To the page, because Web Part There are four fields by default. Title, description, linkurl And Imageurl So we only need to add other custom XSLT Field Information in the format "Internalname, fieldtype" Multiple fields are separated by semicolons, as shown in the following code:
property name = " mainxsllink " type =" string ">/Style Library/XSL style sheets/newsandevents/contentquerymain. XSL property >
property name = " itemshortlink " type =" string ">/Style Library/XSL style sheets/newsandevents/itemstyle. XSL property >
property name = " headerxsllink " type =" string ">/Style Library/XSL style sheets/newsandevents/header. XSL property >
<Property Name="Commonviewfields" Type="String">Learnmorelink, URL; summary, note;</Property>
3.Save the modifiedWeb PartAnd then import itPageAnd modifyWeb PartOfTitleFor "News browsing"
4.ModifyItemstyle. XSLFile, that is, add the customItemstyleThe layout and style are as follows:
5.EditPageWeb part,ExpandPresentationAttribute, inItem StyleSelect the one we just defined in the drop-down box.Newsitemstyle
6.SaveWeb PartAndCheck inPage, we can see the layout and style we want:
Original article:
Http://www.cnblogs.com/crazysharepoint/archive/2011/04/08/2009011.html