Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#541 2009-08-18 21:25:53

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_gallery: super-flexible gallery generator

Hi,

when just having one article image (on article image field) and using the sort="fixed" attribute, I get

Tag error: <txp:smd_gallery id=”?article_image” limit=“1” sort=“fixed”> -> Warning: Invalid argument supplied for foreach() on line 390

To be more precise, this is the snippet I’m using:

<txp:smd_gallery id="?article_image" limit="1" sort="fixed">
	<txp:image id="{id}" />
</txp:smd_gallery>

La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#542 2009-08-19 05:08:59

tye
Member
From: Pottsville, NSW
Registered: 2005-07-06
Posts: 859
Website

Re: smd_gallery: super-flexible gallery generator

Hey maniqui que pasa

I had a similar problem (I think) and Stef said to use the combo tag – although I wasn’t using it as a container tag… maybe that could help

Offline

#543 2009-08-21 15:26:11

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_gallery: super-flexible gallery generator

@tye, thanks for the reply, but I’m not sure how it could be related to the issue I posted.

@bloke,

here is the full snippet I’m using

// Output the first (main) image as full image
<txp:smd_gallery id="?article_image" limit="1" sort="fixed">
	<txp:image id="{id}" />
</txp:smd_gallery>
// Check if the are more images on article_image field
<txp:smd_if field="article_image" operator="contains" value="," param_delim=";">
	<h3>More photos</h3>
	<txp:smd_gallery id="?article_image" sort="fixed">
		<txp:thumbnail id="{id}" />
	</txp:smd_gallery>
</txp:smd_if>

As said on my previous post, the error is generated when there is just one image on article_image field. The problem is that if remove the sort="fixed" attribute, then when there are more than one image, it won’t output the first one (the first ID on article_image field) as expected.

In spoken english, this is what is happening:

smd_gallery says:

“hey, I just have one image to output, that’s ok, I’ll do it. But wait, mmm, what is this sort="fixed" attribute doing here? I don’t need it, as there is just one image on the article_image field. Ok, no problem, I will output the thing as expected, but I will also give you an error message for free.” :)

I could do some black magic to first check if there is just one image on article_image field, and if so, changed the value of sort attribute, but I would prefer not to.

Bottom line: I don’t care that much about the error itself, because the thing work as expected. The thing I’m trying to avoid is to have an error at top of the page (while developing), when there is no error at all on the output.

Thanks.

Last edited by maniqui (2009-08-21 15:28:05)


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#544 2009-08-21 16:11:35

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: smd_gallery: super-flexible gallery generator

maniqui wrote:

Tag error: <txp:smd_gallery id=”?article_image” limit=“1” sort=“fixed”> -> Warning: Invalid argument supplied for foreach() on line 390

Sorry maniqui, should have got back to you earlier on this. I’ll issue a fix when I’ve tidied the plugin for 4.2.0 usage (more stuff in the pipeline). For now, just edit the code around line 354 to this:

// Tack on the remaining rows
if ($rs) {
	foreach($rs as $row) {
		if (!in_array($row['id'], $ignoreList)) {
			$remainingRS[] = $row;
		}
	}
}

(i.e. add if ($rs) { ... } around the foreach statement. That’ll shut it up!

Thanks for the report.

Last edited by Bloke (2009-08-21 16:11:53)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#545 2009-08-21 16:23:40

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_gallery: super-flexible gallery generator

Thanks, Bloke, and sorry for my usual bothering.


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#546 2009-08-21 23:45:58

visualpeople
Member
From: Corvallis, Oregon - USA
Registered: 2005-11-16
Posts: 73
Website

Re: smd_gallery: super-flexible gallery generator

Any thoughts on why this:

       <div id="slideshow" class="pics">
 <txp:smd_gallery category='<txp:category1/>' sublevel="0" form="category-show" sort="name" />
</div>

(category-show form:)

            <img src="{imagepath}{imagedef}" alt="{caption}" />

Would produce this code below only when <txp:category1/> name has a hyphen in it?:

       <div id="slideshow" class="pics">
             <img src="http://www.inkwellhomestore.com/images/146.jpg" alt="U.S. based Chantal products are made with the highest- quality AA enamel." />
            <img src="http://www.inkwellhomestore.com/images/146.jpg" alt="U.S. based Chantal products are made with the highest- quality AA enamel." />
            <img src="http://www.inkwellhomestore.com/images/147.jpg" alt="All Emile Henry cookware is produced entirely in Burgundy, France where it began production in 1850." />
            <img src="http://www.inkwellhomestore.com/images/147.jpg" alt="All Emile Henry cookware is produced entirely in Burgundy, France where it began production in 1850." />
            <img src="http://www.inkwellhomestore.com/images/148.jpg" alt="Le Creuset has brought high-quality stoneware cookware to kitchens worldwide since 1925." />
            <img src="http://www.inkwellhomestore.com/images/148.jpg" alt="Le Creuset has brought high-quality stoneware cookware to kitchens worldwide since 1925." />
</div>

If the category1 field has no hyphens it seems to produce the normal one listing for each image.

I sat here scratching my head on this one for a long time before figuring out what was causing the double-listings, but now I’d like to know why (because there are about 20 categories that have hyphens and I’d love to not have to go back through and re-name them all!)

(running txp 4.0.8)

edit Blast! I just tried changing some of the categories with hyphens and it appears that may have just been a coincidence — still the double listing…

Last edited by visualpeople (2009-08-21 23:48:24)

Offline

#547 2009-08-22 00:02:33

maniqui
Member
From: Buenos Aires, Argentina
Registered: 2004-10-10
Posts: 3,070
Website

Re: smd_gallery: super-flexible gallery generator

Hi visualpeople:

I used to have this duplicated images issue once.
Check this two posts and I hope it helps you:

http://forum.textpattern.com/viewtopic.php?pid=201240#p201240
http://forum.textpattern.com/viewtopic.php?pid=201417#p201417


La música ideas portará y siempre continuará

TXP Builders – finely-crafted code, design and txp

Offline

#548 2009-08-22 00:08:18

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,448
Website GitHub

Re: smd_gallery: super-flexible gallery generator

visualpeople

Freaky. Thanks for the detailed diagnostics. I’m sure this has cropped up before but I can’t find it (EDIT: maniqui has though, yay!)

Please do the following so I can help track it down:

  1. confirm the versions of smd_lib and smd_gallery you are using
  2. let me know if you are using MLP
  3. give some example category names and titles so I can try and replicate this here (it’s behaving for me, even with hyphens)
  4. add debug="1" (2, or 3) to the tag so we can get some even more detailed diagnostics. Mail the relevant bits to me if you don’t want to post them here

Thanks!

Last edited by Bloke (2009-08-22 00:09:47)


The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.

Txp Builders – finely-crafted code, design and Txp

Offline

#549 2009-08-22 00:19:02

visualpeople
Member
From: Corvallis, Oregon - USA
Registered: 2005-11-16
Posts: 73
Website

Re: smd_gallery: super-flexible gallery generator

Maniqui —

Brilliant. Brilliant. Brilliant.

I did what I thought was a pretty extensive search — then scanned through all of the pages with a find for “double” and “twice” but stupidly did not search for “duplicate”

That was exactly the same problem – somehow I must have changed the titles of a couple of image categories and, though I didn’t change the names, it was seeing them twice.

The same solution: going back into the image categories and re-saving with the new title and old category name has mysteriously fixed the problem, I think (even though I still don’t quite understand why)!

Thanks Bloke, too for a quick reply.

Offline

#550 2009-08-25 08:38:25

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,090
Website GitHub Mastodon Twitter

Re: smd_gallery: super-flexible gallery generator

This is what I am trying to do:

<div id="gallery"><txp:smd_gallery form="galleryform" category='<txp:section />' /></div>

where <txp:section /> has the same name as the image category name.

the problem is that it does not parse the <txp:smd... tag at all. The resulting code becomes <div id="gallery"> </div> and ignores the smd tag.

Solved…

Mental Note: Remember to add images to the image gallery:)!

Last edited by colak (2009-08-25 08:44:25)


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#551 2009-08-30 11:27:10

dhmax88
New Member
Registered: 2009-08-30
Posts: 7

Re: smd_gallery: super-flexible gallery generator

Thanks Maniqui i was having the same problem…now to try the fix.

Last edited by dhmax88 (2009-08-30 11:32:11)

Offline

#552 2009-08-31 18:01:01

dhmax88
New Member
Registered: 2009-08-30
Posts: 7

Re: smd_gallery: super-flexible gallery generator

Hi guys Im working on a site over at Rose Fay Illustrator

And i’m getting really stressed about getting smd_gallery and shadowbox to work how I want them to. Basically I have categories of images for each tab along the top of the image content. Only one of the images in the category has a thumbnail and thats what I want to be displayed at the front of each category. (the site should give you an idea of what I mean). But at the moment textpattern is trying to drag thumbnails of all the images even though they don’t exist which is fine in Firefox because they don’t show up but in safari and IE it messes up. So basically,

how do i only get textpattern to get the thumbnails which actually exist!?

Not sure what code you need but this should do :

GALLERY:

<div id="<txp:category1 />" >
<txp:smd_gallery category='<txp:category1 title="0" />'  form="gallery" thumblimit="6" />
</div>

and the gallery FORM:

<a href="{url}" title="{title}" rel="shadowbox[{category_title}]">
<txp:soo_image_select category='<txp:category1 />'>
<txp:soo_if_image_thumbnail><img class="img" src="<txp:site_url/>images/{thumbdef}" alt="{alt}" />
<txp:else /></txp:soo_if_image_thumbnail>
</txp:soo_image_select></a>

This is my last attempt trying to use soo_if_image_thumbnail…
Any idea? Thank you so much for your help in advances!

JD

Last edited by dhmax88 (2009-08-31 18:03:37)

Offline

Board footer

Powered by FluxBB