Making the Layouts section of the "Create Page" page easier to read

原文链接:http://blog.thekid.me.uk/archive/2008/04/02/making-the-layouts-section-of-the-create-page-page-easier-to-read.aspx

 

Its always frustrated me that the list box on the "Create Page" page always shows the content type first with brackets around it. I am always looking for the layout title, but when you have a number of available layouts based on a single content type it can be tricky to find the one you are after...

image

I thought it would be nice to have the layout title first and the content type second....

image

I wrote a piece of javascript which swaps the position of the content type and makes it easier (IMHO) to find the layout you are after...

<script>
      var oSelection = document.getElementById("ctl00_PlaceHolderMain_layoutPickerSection_ctl01_pageTemplatePicker_ctl00_dropdownList");
     if (oSelection != null)
     {
         for (var c=0; c<oSelection.children.length; c++)
         {
             var oChild = oSelection.children[c];
             var sContentType = oChild.innerText.substring(0, oChild.innerText.indexOf(")")+1)
             oChild.innerText = oChild.innerText.substring(oChild.innerText.indexOf(")")+2) + " " + sContentType;
         }
     }
</script>

To use the code you will need to paste it into CreatePage.aspx, which is found in the LAYOUTS folder. The code should be pasted just before the </asp:Content> at the bottom of the file.

I did add some code to sort the entries, but this messes it all up a bit and didn't work. I'm sure this will annoy me eventually and I'll add that, but for now this is better than it was.

 

posted on 2008-11-06 00:04  王丹小筑  阅读(162)  评论(0)    收藏  举报

导航