Hi DynamicWeb
I made my own itemtype that has some basic information on it like name, rich text editor and so on. But i would now like to add something that can take multiple images which i can then output on the item.
Many thanks in advance
Hi DynamicWeb
I made my own itemtype that has some basic information on it like name, rich text editor and so on. But i would now like to add something that can take multiple images which i can then output on the item.
Many thanks in advance
Hi Casper
You can either use a field of type folder and then go through all images in the folder, or you can make another item type and enable it for item list. Then you can insert a field of type item relation list, where you can use multiple instances of the other item (see http://manual.dynamicweb-cms.com/Default.aspx?ID=7660 for further info).
Regards Thomas
Ok thanks for the info. I couldn't get really get my head around the item relations, so i ended up making a folder for each item that needed photos and used some code to get each image and i used the image name as my title for my accordion and put the image inside the accordion body'
@{
string folder = GetValue("ItemPublisher:Item.Billeder").ToString();
string folderOnDisk = System.Web.HttpContext.Current.Server.MapPath(folder);
var directoryInfo = new System.IO.DirectoryInfo(folderOnDisk);
foreach (var fileInfo in directoryInfo.GetFiles("*.png")){
<img src="@(string.Format("{0}/{1}", folder, fileInfo.Name))" />
}
}
thanks to Imar Spaanjaars for providing the code here
http://developer.dynamicweb.com/forum/templates/looping-through-a-folder-using-razor.aspx
You must be logged in to post in the forum