Content Query webpart customization 1

Source: Internet
Author: User

The Content Query webpart Moss provides a great webpart.

Simple Customization

Figure 1 this effect uses two webparts

Title is the content editing webpart.

Content is Content Query webpart

 

2 places to be modified

Modify the. webpart file (after exporting the Content Query webpart, modify it)

 

1. Export "Content Query webpart. webpart", click the Web Part editing drop-down button, and export

2. Open "Content Query webpart. webpart" in notepad, edit the attribute commonviewfields, and save the following:

<Property name = "commonviewfields" type = "string"> title, text; modified, datetime </property>

Separate the middle line of multiple fields with semicolons

Front field, Back Type

Modify the. itemstyle. XSL style file to render and format data.

Find itemstyle.xls

Create an XSL: Template

<XSL: Template Name = "AA" match = "row [@ style = 'aa']" mode = "itemstyle">
<XSL: variable name = "safelinkurl">
<XSL: Call-Template Name = "outertemplate. getsafelink">
<XSL: With-Param name = "urlcolumnname" select = "'linkurl'"/>
</XSL: Call-template>
</XSL: Variable>
<XSL: variable name = "safeimageurl">
<XSL: Call-Template Name = "outertemplate. getsafestaticurl">
<XSL: With-Param name = "urlcolumnname" select = "'imageurl'"/>
</XSL: Call-template>
</XSL: Variable>
<XSL: variable name = "displaytitle">
<XSL: Call-Template Name = "outertemplate. gettitle">
<XSL: With-Param name = "title" select = "@ title"/>
<XSL: With-Param name = "urlcolumnname" select = "'linkurl'"/>
</XSL: Call-template>
</XSL: Variable>
<XSL: variable name = "linktarget">
<XSL: If test = "@ openinnewwindow = 'true'"> _ blank </XSL: If>
</XSL: Variable>
<Div id = "linkitem" class = "item">
<XSL: If test = "string-length ($ safeimageurl )! = 0 ">
<Div class = "image-area-Right">
<A href = "/{substring-after ($ safelinkurl, '//'), '/')}" target = "{$ linktarget}">

</A>
</Div>
</XSL: If>
<Div class = "link-item">
<XSL: Call-Template Name = "outertemplate. callpresencestatusicontemplate"/>
<Table Style = "width: 95%">
<Tr>
<TD> </TD>
<TD style = "width: 60%">
<A href = "{$ safelinkurl}" target = "{$ linktarget}" Title = "{@ linktooltip}">
<XSL: value-of select = "Concat (substring ($ displaytitle, 1, $ titlelength), '...')"/>
</A>
</TD>
<TD align = "Left">
<Div class = "Description">
<XSL: value-of select = "ddwrt: formatdatetime (string (@ modified), 1033, 'yyyy-mm-dd')"/>

</Div>
</TD>
</Tr>
</Table>
</Div>
</Div>
</XSL: Template>

The key point is represented by a red field, where the style is modified.
Save it to the style Library and release it.

Then, import the modified Content Query webpart to the webpart library.

Then add the Content Query webpart to the page. Select AA in the project style to see the effect ..

 

 

 


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.