Carbon: Getting Block to show on root album page

Freelancealot

Joined: 2009-08-18
Posts: 36
Posted: Fri, 2009-08-21 00:53

Hi,

I've tried a couple of different ways to get a text list of the albums under the description on the root album page (ie the first page of the /gallery2 installation) but neither have worked. And I have a feeling I'm missing something obvious.

I'm using the carbon theme. I've set "Blocks to show on album pages (below description)" to 'Links to album/photo peers', but that's made the album list appear on the individual album pages but not on the root album page.

I've also tried adding the following code to the album.tpl:

Quote:
<div class="gbBlock">
{if $theme.item.id == 7}
<td class="tree">
{if !empty($theme.tree[$child.id])}
<h4> {g->text text="Subalbums:"} </h4>
<ul>
{assign var="empty" value=""}
{assign var="depth" value=0}
{foreach from=$theme.tree[$child.id] item=node}
{if $node.depth > $depth}
<li><ul>
{elseif $node.depth < $depth}
{$empty|indent:$depth-$node.depth:"</ul></li>"}
{/if}
{assign var="depth" value=$node.depth}
<li>
<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$node.id`"}">
{$theme.treeItems[$node.id].title|default:$theme.treeItems[$node.id].pathComponent|markup}
</a>
</li>
{/foreach}
{$empty|indent:$depth:"</ul></li>"}
</ul>
{/if}
</td>
{else}

{* Show the album blocks chosen for this theme *}
{foreach from=$theme.params.albumUpperBlocks item=block}
{g->block type=$block.0 params=$block.1}
{/foreach}
{/if}
</div>

But that hasn't worked.

Sorry, I realise this is probably a really obvious setting but I just can't find it.

Cheers,

Tracy

 
Freelancealot

Joined: 2009-08-18
Posts: 36
Posted: Fri, 2009-08-21 01:10

I've also tried:

Quote:
<div class="gbBlock">
{if $theme.item.id == 7}
{g->block type=albumselect.AlbumTree}
{else}

{* Show the album blocks chosen for this theme *}
{foreach from=$theme.params.albumUpperBlocks item=block}
{g->block type=$block.0 params=$block.1}
{/foreach}
{/if}
</div>

But that doesn't seem to do anything either.

Ho hum...

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2009-08-21 02:21

Your 2nd try should work if you add the javascript:

{if $theme.item.id == 7}
<script type="text/javascript" src="modules/albumselect/dtree.js"></script>
              {g->block type=albumselect.AlbumTree}
{else}
...
...
...
               

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 27300
Posted: Fri, 2009-08-21 02:23

This will also list the albums in a <li>

  {g->callback type="albumselect.LoadAlbumData" stripTitles=true truncateTitles="20" createTextTree=true}
			{assign var="data" value=$block.albumselect.LoadAlbumData.albumSelect}
				<ul id="navigation" class="navigation" >	
					{foreach from=$data.tree item=node}
						{if ($node.depth == 0) && ($theme.item.title == $data.titles[$node.id])}
							<li>
								<a href="{$data.links.prefix}{$data.links[$node.id]}"  class="current" >{$data.titles[$node.id]}</a>
							</li>
						{elseif $node.depth == 0}
							<li>
								<a href="{$data.links.prefix}{$data.links[$node.id]}">{$data.titles[$node.id]}</a>
							</li>
						{/if}
					{/foreach}
				</ul>

Dave

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Freelancealot

Joined: 2009-08-18
Posts: 36
Posted: Fri, 2009-08-21 03:29

Hi,

I've tried both, but no dice for either as yet.

The second one is writing the javascript declaration when you do view source in browser, but is not displaying the actual list on the page.

Quote:
<div class="gbBlock">
{if $theme.item.id == 7}
<script type="text/javascript" src="modules/albumselect/dtree.js"></script>
{g->block type=albumselect.AlbumTree}
{else}
{* Show the album blocks chosen for this theme *}
{foreach from=$theme.params.albumUpperBlocks item=block}
{g->block type=$block.0 params=$block.1}
{/foreach}
{/if}
</div>

is showing this

Quote:
<div class="gbBlock">
<script type="text/javascript" src="modules/albumselect/dtree.js"></script>

<div class="block-albumselect-AlbumTree">
<div class="dtree">
<script type="text/javascript">
// <![CDATA[
function albumSelect_goToNode(nodeId) {
document.location = new String('main.php?g2_itemId=__ID__').replace('__ID__', nodeId);
}
var albumTree = new dTree('albumTree');
var albumTree_images = 'modules/albumselect/images/'
albumTree.icon = {
root : albumTree_images + 'base.gif',
folder : albumTree_images + 'folder.gif',
folderOpen : albumTree_images + 'imgfolder.gif',
node : albumTree_images + 'imgfolder.gif',
empty : albumTree_images + 'empty.gif',
line : albumTree_images + 'line.gif',
join : albumTree_images + 'join.gif',
joinBottom : albumTree_images + 'joinbottom.gif',
plus : albumTree_images + 'plus.gif',
plusBottom : albumTree_images + 'plusbottom.gif',
minus : albumTree_images + 'minus.gif',
minusBottom : albumTree_images + 'minusbottom.gif',
nlPlus : albumTree_images + 'nolines_plus.gif',
nlMinus : albumTree_images + 'nolines_minus.gif'
};
albumTree.config.useLines = true;
albumTree.config.useIcons = false;
albumTree.config.useCookies = false;
albumTree.config.closeSameLevel = false;
albumTree.config.cookiePath = '/gallery2/';
albumTree.config.cookieDomain = '';
albumTree.add(0, -1, " Art &amp; Cartoons", 'main.php');
{ var pf = '/gallery2/v/';
albumTree.add(1, 0, "Creation", pf+'creation/');
albumTree.add(2, 0, "Energy", pf+'energy/');
albumTree.add(3, 0, "Soul Mates", pf+'soul-mates/');
}
document.write(albumTree);
// ]]>
</script>
</div>

Any ideas?

Cheers,

Tracy

 
Freelancealot

Joined: 2009-08-18
Posts: 36
Posted: Fri, 2009-08-21 03:38

Okay... I got your second one working. My bad. I tried it before I'd loaded the albumselect module.

That's perfect!! :)

Thanks again, Floridave.

Right...now to tidy up the mini-thumbs. I would prefer to have the mediaBlock stuff as an unordered list as I find them easier to style than tables, but I think this would probably send it loopy. May give it a try at some point...that should be fun!! ;)

Cheers,

Tracy

 
yoannelyankee

Joined: 2009-09-12
Posts: 9
Posted: Mon, 2009-09-14 13:55

Hello

I have paste that in my album.tpl

Quote:
<div class="gbBlock">
{if $theme.item.id == 7}
<script type="text/javascript" src="modules/albumselect/dtree.js"></script>
{g->block type=albumselect.AlbumTree}
{else}
{* Show the album blocks chosen for this theme *}
{foreach from=$theme.params.albumUpperBlocks item=block}
{g->block type=$block.0 params=$block.1}
{/foreach}
{/if}
</div>

It's ok on index but if i click on file the block desapears on the second page !!

can you help me ?

 
yoannelyankee

Joined: 2009-09-12
Posts: 9
Posted: Mon, 2009-09-14 14:05

ok !!!

i just keep that in table :

Quote:
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr>
<td><div class="gbBlock">
<script type="text/javascript" src="modules/albumselect/dtree.js"></script>
{g->block type=albumselect.AlbumTree}
</div></td>

Its ok