2015년 10월 26일 월요일

SPEAK UI는 무엇인가?

#FYI #SPEAK #XSLT

 SPEAK UI는 무엇인가?

Sitecore는 버전 6.6부터 SPEAK(Sitecore Process Enablement and Acceleration Kit) UI를 CMS 추가하기 시작하였다. 부분적으로, 기존에 사용하고있던 Sheer UI의 약점(?)을 보완하기 위하여 시작하였으며, 개발자에게 있어서 어플리케이션을 만드는데 더 유연하게 사용할수있도록 설계가 되어있다.

기존의 Sheer UI는 XSLT기기반으로 코드는 aspx/ascx/xml 등으로 만들어져있으며, 부분적으로 플래쉬 파일(.swf)을 렌더링하여 유저에게 인터페이스를 제공한다. 다시 말하면, Sheer UI를 업데이트하는데 있어서, 많은 리소스가 필요할뿐더러 개발자로써도 수정을 많은 어려움을 있을수있다. 하지만 SPEAK UI는 MVC기반으로 만들어졌으며, 인터페이스는 Javascript를 이용하여 유저의 Request를 실행한다. 추가적으로 /App_Config/Inlcue/ 폴더에서 "Sitecore.Speak.Applications.config" 파일을 수정하여 SPEAK UI를 Disable 할수가 있다.

2015년 10월 14일 수요일

미디어 아이템 렌더링

#FYI #HowTo #.NET

 먼저, 렌더링 아이템의 미디어 정보를 가져오는 중, 아주 유용한 정보를 찾았다. 아래는 Muhammad Jameel 블로그에서 가져온것이다.

Create an object for the target item in the database- replace itempath with the relative path to the item in the Content Tree, such as “home/about/item1” or start the path with a backslash (/) to indicate an absolute path, such as “/sitecore/content/home/about/item1”– a null value will be set in either case if the item does not exist - Sitecore does compare case when evaluating item paths.


 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
Sitecore.Data.Database db = Sitecore.Context.Database;
Sitecore.Data.Items.Item item = db.GetItem("itempath");
Sitecore.Data.Fields.ImageField image = item.Fields["imagefield"];
if (image!=null && image.MediaItem!=null)
{
      Sitecore.Data.Items.MediaItem image = new Sitecore.Data.Items.MediaItem(imageField.MediaItem);
      string src = Sitecore.StringUtil.EnsurePrefix('/', Sitecore.Resources.Media.MediaManager.GetMediaUrl(image));
      if (!string.IsNullOrEmpty(src))
      {
             string imgTag = String.Format(@"<img src=""{0}"" alt=""{1}"" />", src, image.Alt);
      }
}