Is there anyway I can make each gallery image clickable as a link to an internal page on my site?
I have the gallery setup using some jquery which makes each image slide or fade from one to another, ideally I want each image or banner to be wrapped inside a link.
Is this possible?
[SOLVED] Gallery Problem
[SOLVED] Gallery Problem
Last edited by delve2013 on Fri Aug 23, 2013 2:54 pm, edited 1 time in total.
Re: Gallery Problem
Yes it is add a custom field (attached to images) and ask for page alias.
Then use that value inside the Gallery template you use to build the link.
However, if it's 'just' a slider you might consider using another module for it. ListIt2 might be a good option because it has the option to add a page dropdown list (so editors don't need to know about alias but just select a page).
Combined with CGSmartImage module you could make sure images are resized to the proper width and height.
Then use that value inside the Gallery template you use to build the link.
However, if it's 'just' a slider you might consider using another module for it. ListIt2 might be a good option because it has the option to add a page dropdown list (so editors don't need to know about alias but just select a page).
Combined with CGSmartImage module you could make sure images are resized to the proper width and height.
Re: Gallery Problem
so this is my template code:
Can you please give me an example of how I would use a custom definition here?
Code: Select all
<div id="slides">
{foreach from=$images item=image}
{if !$image->isdir}
<img src="{$image->thumb}" alt="{$image->titlename}" />
{/if}
{/foreach}
</div>
<a id="prev" href="#">Prev</a>
<a id="next" href="#">Next</a>Re: Gallery Problem
Add a Field Definition called 'targetpage', apply field for: images and check 'public' (not sure if that's required).
Type page ALIAS in the field for all images.
Then change code:
Didn't test this.If it does not work maybe you could change one line to:
(where ` is a backtick NOT single quote)
Note that the NAME of the field not per se is the same as the ALIAS of the field. In the code you should use the alias, which is visible after adding the Field Definition
Type page ALIAS in the field for all images.
Then change code:
Code: Select all
<div id="slides">
{foreach from=$images item=image}
{if !$image->isdir}
<a href="{cms_selflink href=$image->fields.targetpage.value}">
<img src="{$image->thumb}" alt="{$image->titlename}"
/>
</a>
{/if}
{/foreach}
</div>
<a id="prev" href="#">Prev</a>
<a id="next" href="#">Next</a>Code: Select all
<a href="{cms_selflink href="`$image->fields.targetpage.value`"}">Note that the NAME of the field not per se is the same as the ALIAS of the field. In the code you should use the alias, which is visible after adding the Field Definition
Re: Gallery Problem
You are a legend, it worked perfectly!
Thank you
Thank you
Re: [SOLVED] Gallery Problem
If I wanted to change the target page to a full url how would I do that?
Re: [SOLVED] Gallery Problem
Not sure what the question is:delve2013 wrote:If I wanted to change the target page to a full url how would I do that?
- do you want to be able to type a full url in the custom field with each image?
- if so, do you want to be able to type an alias in stead too?
- ...?


