Modx Gallery Error - php

I have a portfolio page with small boxes with a image and link.
This seems (after struggling in code) to work, but the image don't work.
For each porject on the portfolio page:
[[!Gallery? &album=`[[+tv.gallery]]` &limit=`1` &thumbWidth=`870` &thumbHeight=`400` &thumbZoomCrop=`2` &toPlaceholder=`projecten`]]
<li class="[[dynamicWidget]]" id="[[+tv.category]]">
[[!+projecten:notempty=`
<div class="item">
<a href="[[~[[+id]]]]" title="[[+description]]">
<img src="[[+projecten.image]]" alt="[[+description]]" />
</a>
</div>
`]]
</li>
( i'm using the default gallery function)
thetv.gallery is the id of the gallery wich i like to use, but now i takes only the first album, not the first picture of a project.
It works, but only the selected image is not the album's first item (tv.gallery) but the first or second image in that album.
So:
- i have 2 pages with each a gallery witht to images
- the code gives me the first album with picture 1 and picture 2.
How to solve this, please give me some advice because i really want this script to be finished. thanks

Not sure if I understood exactly what you want to do, but maybe you should be using the GalleryAlbums snippet in this case, in combination with the albumCoverSort option.
edit: based on your comment, it looks like Gallery might be the best choice:
[[!Gallery? &album=`myProject` &limit=`1` &sort=`rank`]]
Refer to the docs for more info about how to sort the thumbnail shown.

Related

How do I assign images to gallery id in Wordpress with shortcodes in Page Templates

My friend has asked me to help them move images around on their wordpress site. They have an image slideshow that runs along the bottom of the page and the image gallery that shows, depends on the page template used.
One template has the following code:
<?php
$tagu = get_post_meta($post->ID,'bototm_gallery');
?>
<div class="flt box_bottom">
<ul style="margin-left:10px !important; width:100% !important;" class="sub_photo sub_photo_gigs" class="sub_photo">
<?php echo do_shortcode($tagu['0']); ?>
</ul>`
and another page template shows this code:
<?php $tagu = get_post_meta($post->ID,'bototm_gallery'); ?>
<div class="flt box_bottom">
<div class="sv_footer_photo">
<?php echo do_shortcode($tagu['0']); ?>
</div>`
How do I add images to a specific gallery? I can't find a gallery id in the media library and/or I don't know where to find the class such as sv_footer_photo or sub_photo.
Could you please explain it to me?
Oh Wow, I've found it and sure enough it was simple.
I had to click on 'Screen Options' at the top of the page, tick the box for custom fields and then I can see the gallery image ids assigned to that page.

Not showing a picture where table field is empty

I have a MTSQL database where up to 25 images can be stored, in table fields called picture1 through to picture 25.
What i want to do is check these variables once they are pulled from the database to see whether they should be displayed or not.
currently if there isn't an images it still shows and you just get the missing image sign. And no matter what i seem to write it shows regardless off if there is an image or not, below is my current code.
<? if(!isset($picture2) || empty($picture2)){ ?
<div class="property-slide">
<a href="m/properties/<?php echo $row['picture2']; ?>" class="image-popup">
<img alt="" src="m/properties/<?php echo $row['picture2']; ?>"></a>
</div>
<? } ?>
The value of picture 2 is currently just 1.jpg which is located in a folder on the server at the path m/properties/.
I did consider storing all the images seperatley, which would be easier as i could use a query to show all relevant properties, but this was pre built by somebody else and the database is populated from a third party api.

carrying product_id value to an extra added page through url

I am using OpenCart. I want to give a link from product_form.tpl to another page. I mean I have added a tab called 'Allocation' in which I have given a button 'Add Allocation' which should redirect an external page. I'd like also to provide the product_id within this link but it's not working properly...
Here is my code (product_form.tpl)
<div id="tab-allocate">
<table class="list"><tr><td align="center">ADD ALLOCATION</td></tr></table>
</div>
But allocation.php?product_id=&product_id is not working, it goes to allocate.php page
but doesn't carry the product_id. What am I doing wrong?
I think, it's something wrong in your passing parameter, please try like that
<a href="allocation.php?product_id=product_id" target="_blank" class="copybutton" style="width:120px;">
Your previous style work to pass two parameter. eg
<a href="allocation.php?product_id=product_id&second_id=Second_id" target="_blank" class="copybutton" style="width:120px;">
Hope this help
Ps. You can also use like that
$this->request->post['product_id'] OR $this->request->get['product_id']
What a messy HTML...
Change that link to this one:
ADD ALLOCATION
This should work. And put the CSS styles into the CSS files (catalog/view/themes/<YOUR_THEME>/css/stylesheet.css).

Addthis on an image gallery

I'm using addthis.com to share my pictures from an album (just a page with some pictures in it).
This is my addThis code:
<div class="addthis_toolbox addthis_default_style addthis_32x32_style"
addthis:url="<?php echo HTTP; ?>album.php?id=<?php echo $_GET['id']; ?>"
http://lasala-gastrobar.be/album.php?id=27
addthis:title="An Example Title"
addthis:description="An Example Description">
<a class="addthis_button_facebook"></a>
<a class="addthis_button_print"></a>
<a class="addthis_button_email"></a>
I have this code for every image in my album, and the javascript at the bottom.
Now when I share on facebook, it shares all the images, but I want to be able to share one 1 image at a time.
Same when I click print, only print that 1 picture, not the rest.
got it: the link has to go to a separate page showing only 1 image with correct tags in the head

Fancybox 2 loads the last item of the gallery when I'm using trigger('click')

I realized that when I was using
$(.fancybox).fancybox().trigger('click')
to launch fb gallery during the window loading. My fb gallery loaded the last item of the gallery. Have no idea.
The thumbs' order is correct.
FB version 2
<?php foreach(***)?>
<a class="fancybox" href="*big image*">
<img src="*thumb*" />
</a>
<?php endforeach ?>
Help, please, thanks.
I wrote like this:
$('.fancybox').fancybox();
$('.fancybox:first').trigger('click');
and it works. Now it loads the first item.
Most likely your class "fancybox" has or inherited a "position:absolute" within your CSS, so that makes the last image to be on top of the stack, hence it's displayed first.

Categories