Thanks CalGuy and Uniqu3.
Just for the record, I ended up doing it like this:
1. I've created folders with pictures numbered x.1.2.3 (following page hierarchy replacing the first character for "x" since I am using MLE and the pages in diferent languages differ only in that first character).
2. I've created an UDT named get_position:
Code: Select all
global $gCms;
$manager =& $gCms->GetHierarchyManager();
$thisPage = $params['page_alias'];
$node = &$manager->sureGetNodeByAlias($thisPage);
$content= $node->getContent();
$position = $content->Hierarchy();
echo $position;
3. I then list the content of subpages in a template, automatically grabing the correct picture for each child, which is inside the respective folder, and works for all languages without having to repeat them. I have used CGSimple and I automatically resize the pictures creating thumbs with CGSmartImage.
Code: Select all
{$cgsimple->get_children('','false','children')}
{if count($children)}
{foreach from=$children item='child'}
{capture assign="position"}{get_position page_alias=$child.alias}{/capture}
{assign var="var" value=$position}
{assign var="bar_at" value=$var|strpos:"."}
{capture assign=path}uploads/images/energia/obras/x.{$var|substr:$bar_at+1}/destaque/*.jpg{/capture}
{assign var='files' value=$path|glob}
<div class="portfolio">
{if count($files)}
{foreach from=$files item='file'}
{assign var='filename' value='/'|explode:$file}
{if $filename[6]|truncate:6:"" != 'thumb_' }
{CGSmartImage src=$file filter_croptofit='100,120' title='' alt='' class="left"}
{/if}
{/foreach}
{/if}
{cms_selflink page=$child.alias}
</div>
{/foreach}
{/if}
Well, I am pretty sure that there is an easier better way to do it, but I had to solve it the same day, so... Anyway, ideas still welcome as optimizing is always good.
For the record, each child portfolio page creates an image gallery with fancybox and CGSmartImage, works pretty good, also repecting MLE structure without having to repeat the pictures in the server (using de idea of x.1.2.3 folders). Like this:
Code: Select all
{assign var="var" value=$position}
{assign var="bar_at" value=$var|strpos:"."}
{capture assign=path}uploads/images/energia/obras/x.{$var|substr:$bar_at+1}/fotos/*.jpg{/capture}
{assign var='files' value=$path|glob}
{if count($files)}
<h3>{MleCMS name="snippet_Fotos"}</h3>
<div class="gallery">
{foreach from=$files item='file'}
{assign var='filename' value='/'|explode:$file}
{if $filename[6]|truncate:6:"" != 'thumb_' }
<a rel='simple_album' class="fancybox" href="{CGSmartImage src=$file filter_resize='h,500' notag=1 noembed=1}">{CGSmartImage src=$file filter_croptofit='150,100' title='' alt=''}</a>
{/if}
{/foreach}
</div>
{/if}
Don'f forget to activate fancybox.
Thanks
