I have seen issue on Umbraco on my last project. The problem is when you open image gallery page and use same macro file on 2 pages, one page is waiting for cache. For example; On my turkish lang. page, I cant see images (http://cbmeturkey.com/tr/mothers-baby-kids-show/fotograf-galerisi.aspx) but I can see images on english side (http://cbmeturkey.com/eng/mothers-baby-kids-show/photo-gallery.aspx). And also if i entered english side of this page, I can see photos on turkish side of this page. Code is below.
Macro Settings:
Use in Editor : checked
Cache by Page : checked
Cache Period : 100 seconds
Umbraco Version : Umbraco v6.0.5 (Assembly version: 1.0.4869.18012)
Code:
@inherits umbraco.MacroEngines.DynamicNodeContext
@using umbraco.NodeFactory;
@using uComponents.Core.uQueryExtensions;
@*
Macro to display a gallery from a media folder. Add the below parameter to the macro
and use it to point the macro at a specific media folder to display it's content as
a simple list.
Macro Parameters To Create, for this macro to work:
Show:True Alias:mediaId Name:Media Folder ID Type:MediaCurrent
*@
@helper findImageFromFolder(dynamic _mediaFolder, string fileName)
{
foreach (var mediaItem in _mediaFolder) {
var _name = Convert.ToString(mediaItem.Name);
if(_name == fileName) {
var _thumb = mediaItem.umbracoFile;
<img src="@_thumb" alt="-" />
}
}
}
@functions{
public int getFolderIdfromPageId(int id)
{
switch (id){
case 1476:
return 1101;
break;
case 1394:
return 1101;
break;
case 1344:
return 1249;
break;
case 1398:
return 1249;
break;
case 1336:
return 1248;
break;
case 1395:
return 1248;
break;
default:
return 1101;
break;
}
}
}
@{
Node node = uQuery.GetCurrentNode();
var folderid = getFolderIdfromPageId(node.Id);
}
@{
@* Get the media folder as a dynamic node *@
var mediaFolder = Library.MediaById(@folderid);
var allItems = mediaFolder.Children;
if (allItems.Any())
{
<ul class="thumbnails">
@* for each item in children of the selected media folder *@
@{
foreach (var mediaItem in allItems)
{
var _mediaUrl = mediaItem.umbracoFile;
var _mediaName = mediaItem.Name;
if(_mediaName.Contains("Thumb")) { continue; }
var _strName = Convert.ToString(_mediaName);
var _strThumb = _strName.Replace("Big", "Thumb");
<li class="span2">
<a class="fancybox" rel="gallery1" href="@_mediaUrl" title="@_mediaName">
@findImageFromFolder(@allItems, @_strThumb)
</a>
</li>
}
}
</ul>
}
}
This sounds like it could be bug in the macro caching system, if you are to reproduce the behaviour in a clean v6.1.3 then you should report it at http://issues.umbraco.org
It is of course possible the the issue has been resolved in a newer version so I would recommend you upgrade to v6.1.3 to see if that resolves the issue. There has been a lot of improvements in v6.1 with respect to load balancing and caching, so there is a chance.
Get All Images from Media Folder Problem
Hi All,
I have seen issue on Umbraco on my last project. The problem is when you open image gallery page and use same macro file on 2 pages, one page is waiting for cache. For example; On my turkish lang. page, I cant see images (http://cbmeturkey.com/tr/mothers-baby-kids-show/fotograf-galerisi.aspx) but I can see images on english side (http://cbmeturkey.com/eng/mothers-baby-kids-show/photo-gallery.aspx). And also if i entered english side of this page, I can see photos on turkish side of this page. Code is below.
Macro Settings: Use in Editor : checked Cache by Page : checked Cache Period : 100 seconds
Umbraco Version : Umbraco v6.0.5 (Assembly version: 1.0.4869.18012)
Code:
Thanks, Ilker
Hi Ilker,
This sounds like it could be bug in the macro caching system, if you are to reproduce the behaviour in a clean v6.1.3 then you should report it at http://issues.umbraco.org
It is of course possible the the issue has been resolved in a newer version so I would recommend you upgrade to v6.1.3 to see if that resolves the issue. There has been a lot of improvements in v6.1 with respect to load balancing and caching, so there is a chance.
Thanks,
Jeavon
is working on a reply...