Zoo*_*ing 22 sitecore sitecore6
我知道我以前做过这个,但我似乎无法记住在哪里或如何.
我想在Sitecore中创建一个Item的链接.这段代码:
Sitecore.Data.Items.Item itm = Sitecore.Context.Database.GetItem(someID);
return itm.Paths.Path.ToString();
Run Code Online (Sandbox Code Playgroud)
生成以下字符串:
http://localhost/sitecore/content/Home/Item1/Item11/thisItem
Run Code Online (Sandbox Code Playgroud)
我想要这个字符串:
http://localhost/Item1/Item11/thisItem.aspx
Run Code Online (Sandbox Code Playgroud)
获取项目路径的正确方法是什么?在这种情况下,我无法使用正常的Sitecore链接:
Sitecore.Web.UI.WebControls.Link
Run Code Online (Sandbox Code Playgroud)
Mar*_*idy 36
你需要这个,假设你正在运行Sitecore v6或更新的东西(用8.2-6测试,也应该用9):
Sitecore.Links.LinkManager.GetItemUrl(item);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
8020 次 |
| 最近记录: |