[SOLVED] dynamic gallery in a single html-block

For questions and problems with the CMS core. This board is NOT for any 3rd party modules, addons, PHP scripts or anything NOT distributed with the CMS made simple package itself.
Post Reply
ARVANDERKAMP
Forum Members
Forum Members
Posts: 22
Joined: Tue Dec 07, 2010 7:07 pm

[SOLVED] dynamic gallery in a single html-block

Post by ARVANDERKAMP »

Got a little bit of a challenge for you all (or not).

First, let me show you the site/page what it's all about: http://websitedelivery.nl/Texeltrips/in ... ingplanner

As you can see there is a gallery on the right (Gallery module). Works fine! But now i want to use this gallery on several pages, off course with other images (other directories from the Gallery). Also no problem, this works with the dir="" tag from the Gallery.

But here's my problem. I don't want to add 10 HTML content blocks (sidebars) and templates, but i just want to add one block with a dynamic code in it so it works for all of the gallery's.

I allready searched a lot of forums, but didn't find the answer. To give you guys a headstart, i think it should be something like this:

{if page='texelopties' gallery dir="texelopties"}
{if page='weddingplanner' gallery dir="weddingplanner"} etc etc..

Could you guys please help me out?

Thanks a lot.
Last edited by ARVANDERKAMP on Wed Dec 29, 2010 3:05 pm, edited 1 time in total.
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm
Location: Raalte, the Netherlands

Re: dynamic gallery in a single html-block

Post by RonnyK »

and is the gallery f.e. the same as the page you want to show the gallery on, or its parent?

As you could call something like dir=$page_alias f.e.

Ronny
User avatar
M@rtijn
Power Poster
Power Poster
Posts: 706
Joined: Sat Nov 14, 2009 4:54 pm
Location: the Netherlands

Re: dynamic gallery in a single html-block

Post by M@rtijn »

I think Ronny's option is a good one, but if you don't want the folders to be called the same as your page aliases, another possibility might be to do is as follows:

Code: Select all

{if $page_alias eq 'name1'}{Gallery dir='folder1'}
{elseif $page_alias eq 'name2'}{Gallery dir='folder2'}
{elseif $page_alias eq 'name3'}{Gallery dir='folder3'}
{else}{Gallery dir='folderX'}
{/if}
Make your community a better place!
ARVANDERKAMP
Forum Members
Forum Members
Posts: 22
Joined: Tue Dec 07, 2010 7:07 pm

Re: dynamic gallery in a single html-block

Post by ARVANDERKAMP »

Yeahhh, you're the man! It works! Veryy nice. I left the last one, behind the {else}, blank; so it doesn't show the gallery on other pages.

For people having the same problem, here's the code that did it for me:

Code: Select all

{if $page_alias eq 'workshops'}{Gallery dir='Workshops'}
{elseif $page_alias eq 'zuiver-texel'}{Gallery dir='Zuiver-Texel'}
{elseif $page_alias eq 'texelopties'}{Gallery dir='Texelopties'}
{elseif $page_alias eq 'texelteam-games'}{Gallery dir='Texelteam-Games'}
{elseif $page_alias eq 'texel-experience'}{Gallery dir='Texel-Experience'}
{elseif $page_alias eq 'korte-activiteiten'}{Gallery dir='Korte-activiteiten'}
{else}
{/if}
M@rtijn wrote: I think Ronny's option is a good one, but if you don't want the folders to be called the same as your page aliases, another possibility might be to do is as follows:

Code: Select all

{if $page_alias eq 'name1'}{Gallery dir='folder1'}
{elseif $page_alias eq 'name2'}{Gallery dir='folder2'}
{elseif $page_alias eq 'name3'}{Gallery dir='folder3'}
{else}{Gallery dir='folderX'}
{/if}
RonnyK
Support Guru
Support Guru
Posts: 4962
Joined: Wed Oct 25, 2006 8:29 pm
Location: Raalte, the Netherlands

Re: [SOLVED] dynamic gallery in a single html-block

Post by RonnyK »

This almost sounds like what I showed ;)

{Gallery dir=$page_alias}

Only the albums would than have to be lowercase, and a single line would be enough then :D

Ronny
Post Reply

Return to “CMSMS Core”