{"id":1242,"date":"2012-09-13T10:46:11","date_gmt":"2012-09-13T10:46:11","guid":{"rendered":"https:\/\/poiseddevelopers.com\/reality-tech\/?p=1242"},"modified":"2024-05-13T10:57:33","modified_gmt":"2024-05-13T10:57:33","slug":"adding-banding-in-a-cqwp","status":"publish","type":"post","link":"https:\/\/poiseddevelopers.com\/reality-tech\/adding-banding-in-a-cqwp\/","title":{"rendered":"Adding Banding in a CQWP"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_65 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 eztoc-toggle-hide-by-default' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/poiseddevelopers.com\/reality-tech\/adding-banding-in-a-cqwp\/#CQWP_Banding_using_XLST\" title=\"CQWP Banding using XLST\">CQWP Banding using XLST<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/poiseddevelopers.com\/reality-tech\/adding-banding-in-a-cqwp\/#Tuning_the_CQWP\" title=\"Tuning the CQWP\">Tuning the CQWP<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/poiseddevelopers.com\/reality-tech\/adding-banding-in-a-cqwp\/#Tuning_the_XSLT\" title=\"Tuning the XSLT\">Tuning the XSLT<\/a><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h2><span class=\"ez-toc-section\" id=\"CQWP_Banding_using_XLST\"><\/span>CQWP Banding using XLST<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>The Content Query Web Part aggregates SharePoint content. Banding can be added by customizing the associated XSLT in a file called ItemStyle.XSL.<\/p>\n<p>One can optionally customize the XSL in a copy of this file and then customize the CQWP to use the customized file. I wanted to customize the list of Blog posts to be condensed, with a truncated preview.<\/p>\n<p>Here\u2019s how to do it.<\/p>\n<h3><span class=\"ez-toc-section\" id=\"Tuning_the_CQWP\"><\/span>Tuning the CQWP<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Use the following settings in the CQWP to create a list of just Blog Post Links:<\/p>\n<ol>\n<li>List Type: Posts<\/li>\n<li>Content Types: List Content Types<\/li>\n<li>Show items: Post<\/li>\n<li>Group by: Created By<\/li>\n<li>Sort by: Created<\/li>\n<li>Limit: 25<\/li>\n<li>Group style: Banded<\/li>\n<li>Item Style: Title Only: Important, this determines the XSLT template customized and used later<\/li>\n<li>Fields to display: Title: Title (only)<\/li>\n<\/ol>\n<p>Optional:<\/p>\n<ol>\n<li>Export Web Part<\/li>\n<li>Open in Notepad<\/li>\n<li>Edit and change the XSLT file ItemStyle.XSL referenced, to point to a different file<\/li>\n<li>Save<\/li>\n<li>Import as a web part<\/li>\n<\/ol>\n<h3><span class=\"ez-toc-section\" id=\"Tuning_the_XSLT\"><\/span>Tuning the XSLT<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>Locate the XSLT template processing the item, and refine it. If a new XSL file is desired, copy ItemStyle.XSL and edit that one. Here\u2019s the customized commented code for the TitleOnly template:<\/p>\n<pre lang=\"php\">        \r\n            \r\n                \r\n            \r\n        \r\n        \r\n            \r\n                \r\n                \r\n            \r\n        \r\n \r\n<!-- Joel's alternating row colorings-->\r\n         \r\n        \r\n                 \r\n        \r\n        \r\n                \r\n                   \r\n                               \r\n               \r\n                  \r\n              \r\n            \r\n           \r\n \r\n<!-- Joel's table, created for each row, 300 wide seems a good number -->\r\n<!-- Joel's decision to use the existing 'description' class, to get more vertical compression than 'tem'-->\r\n<!-- Joel's create a table, row and cell around each link, to allow banding --><\/pre>\n<div class=\"description\">\n<p>&nbsp;<\/p>\n<table width=\"300\">\n<tbody>\n<tr style=\"background: {$AlternatingCssClass};\">\n<td><!-- Joel's HTML for closing the data cell, row, and table--><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>&nbsp;<\/p>\n<\/div>\n<p>&nbsp;<\/p>\n<pre lang=\"php\"><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>CQWP Banding using XLST The Content Query Web Part aggregates SharePoint content. Banding can be added by customizing the associated XSLT in a file called ItemStyle.XSL. One can optionally customize the XSL in a copy of this file and then customize the CQWP to use the customized file. I wanted to customize the list of [&hellip;]<\/p>\n","protected":false},"author":10,"featured_media":1244,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[49],"tags":[],"class_list":["post-1242","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-xlst"],"acf":[],"_links":{"self":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts\/1242","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/users\/10"}],"replies":[{"embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/comments?post=1242"}],"version-history":[{"count":3,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts\/1242\/revisions"}],"predecessor-version":[{"id":3974,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/posts\/1242\/revisions\/3974"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/media\/1244"}],"wp:attachment":[{"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/media?parent=1242"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/categories?post=1242"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/poiseddevelopers.com\/reality-tech\/wp-json\/wp\/v2\/tags?post=1242"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}