Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#277 2006-02-12 10:22:12
Re: [plugin] [ORPHAN] rss_thumbpop - Thumbnail Image Gallery w/ popups
And hot on the heels of that one, I’ve added another function to my rss_thumbpop. Might be useful to someone else so here it is.
Sometimes my galleries aren’t at the top of the page so when paging through with next/previous, the page reloads and drops the surfer back to the top, whereby they have to scroll down to the photos again. What would be useful in this case is a way to use the html tag <a name="photos"></a>
immediately above your photo gallery and have the plugin return you to that part of the page.
Enter the aname=
argument… simply specify the name of the section of the page defined by your <a name=..></a>
tag and the surfer is put back at the top of the gallery when they click next or previous.
To do this you need to add two lines to your v0.6.1 plugin code and change two other lines as follows:
1) In the declaration block at the top of the code, add this line (I added mine under the $addpermlink = isset($addpermlink) ? $addpermlink: "1";
line but it doesn’t matter too much where it is as long as it’s in that block at the top somewhere) :
$aname = isset($aname) ? $aname: "";
2) Then scroll almost to the bottom of the code and find the bit that starts:
...
if ($numPages > 1 && $showpagelinks) {
$next = ($numPages > 1 && $thumbpage != $numPages);
$back = ($numPages > 1 && $thumbpage > 1);
...
and add this line right below it:
$anameStr = ($aname) ? "#".$aname : "";
3) A line or two below that you find two lines that start:
$output[] = ($back) ? ...
and
$output[] = ($next) ? ...
They need to have .$anameStr
added to them, thus:
$output[] = ($back) ? '<li class="left"><a href="?tpg='.($thumbpage-1).$anameStr.'">'.$backlabel.'</a></li>'.n : '';
$output[] = ($next) ? '<li class="right"><a href="?tpg='.($thumbpage+1).$anameStr.'">'.$nextlabel.'</a></li>'.n : '';
And that’s it. So if you now add <a name="photos"></a>
immediately above the txp:rss_thumbpop...
tag in your article form, and add an option aname="photos"
to the rss_thumbpop arguments you’re all set.
Usual disclaimer applies if your site explodes after making these changes, but it should work ok providing you’re careful. And if somebody finds a better way of doing this, I’m all, erm, eyes.
[ edit: btw, forgot to mention that <a name="..."></a>
doesn’t strictly validate as XHTML; it should technically be <a id="..."></a>
. Despite this minor discrepancy, I left the plugin option as aname=
, because aid=
sounds like it might offer some sort of help :o) ]
Last edited by Bloke (2006-03-04 20:48:34)
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
#278 2006-02-12 16:33:05
Re: [plugin] [ORPHAN] rss_thumbpop - Thumbnail Image Gallery w/ popups
Thanks panik! That was the problem. I had it in a page template… I moved it out to an article form and all was well… It must be something with the variables in textpattern, the plugin probebly doesn’t know what the article attributes are so it is matching everything. I did have to use the <code>addpermlink=“0”</code> to get the popups to work as well… Oh well, no worries…
bloke great find and ideas, I’ll try them out today and let you know what my milage is… I’m trying to rebuild a website from legacy asp code and port it to textpattern, the image galleries was the only point of contention, with these last couple changes and finds, this might be the ticket! Thanks
willshire – it might be helpful in the docs to add somethign to the effect of if you want to use the <code>usearticle=“1” catfield=“cat_field”</code> then the plugin must reside in an article form. This is a GREAT plugin, thanks so much for all of your hard work!
Last edited by rbe (2006-02-12 16:36:12)
Offline
#279 2006-02-14 03:18:28
- sonnyzm
- New Member
- Registered: 2006-02-14
- Posts: 9
Re: [plugin] [ORPHAN] rss_thumbpop - Thumbnail Image Gallery w/ popups
Hi I’m trying to install rss_thumbpop, but after i press install, it just says “plugin install failed”, anyone know the solution? (btw i’ve tried it on two different servers with the same result.
cheers, Sonny
Offline
#280 2006-02-14 17:20:54
Re: [plugin] [ORPHAN] rss_thumbpop - Thumbnail Image Gallery w/ popups
sonny… the only time i’ve had that happen is if I got a corrupted download… i’d try to download the plugin again, and open it with a basic text editor (notepad on windows or textpad on mac). copy, paste and you should be good.
Offline
#281 2006-02-15 07:59:09
- sonnyzm
- New Member
- Registered: 2006-02-14
- Posts: 9
Re: [plugin] [ORPHAN] rss_thumbpop - Thumbnail Image Gallery w/ popups
Thanks for the reply rbe, but that wasnt the problem, I reinstalled older an older version of php and it worked fine, I dont think the script is compatible with php 5.
Offline
#282 2006-02-16 03:05:25
Re: [plugin] [ORPHAN] rss_thumbpop - Thumbnail Image Gallery w/ popups
Made another minor mod today to this awesome plugin. When using usearticle="1"
, this hack allows multiple categories to be specified as a comma-separated list in your article’s custom field. So the custom field then works the same way as the category=
option.
If that sounds like something you want, make these highlighted changes to your v0.6.1 plugin code (this bit is near the top of the code, just after the declaration block) :
...
if ($res) {
foreach($res as $a) {
extract($a);
populateArticleData($a);
foreach (explode(',', doSlash($a[$catfield])) as $artcategory) {
$artcatsql[] = ($artcategory) ? " (category = '" . doSlash($artcategory) . "') " : "";
}
$artcat = " AND ";
$artcat .= ($artcategory) ? '(' . join(' OR ', $artcatsql) . ')' : '1=1 ';
$artlink = permlinkurl($a);
}
}
That’s it. Essentially, you’re swapping out the original line that was there:
$artcat = " AND (category = '" . doSlash($a[$catfield]) . "') ";
with those 5 bulletted lines of code there. Don’t ask me why I had to put the $artcat = " AND ";
on a separate line rather than combining it with the next line; for some reason it wouldn’t work with it all on one line :-/
It’s quite inefficient so if you have loads of categories it’ll probably slow down a bit. There’s no doubt a better way by using the SQL ‘IN’ statement and supplying a list instead of keep doing OR (category="cat1") OR (category="cat2") OR...
. Perhaps even using wildcards? Anyone care to mod the mod to make it faster?!
No warranties again, but it’s working here through my limited testing. Should work for you. Enjoy.
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
#283 2006-02-18 02:22:35
- sonnyzm
- New Member
- Registered: 2006-02-14
- Posts: 9
Re: [plugin] [ORPHAN] rss_thumbpop - Thumbnail Image Gallery w/ popups
Hi, is there a way to display multiple thumbnail galleries on a single page, I’ve ebeen playing around with it and cant get it to work.
Offline
#284 2006-02-18 02:40:44
Re: [plugin] [ORPHAN] rss_thumbpop - Thumbnail Image Gallery w/ popups
sonnyzm, what have you tried to get them to display? I’m using it to show a gallery that is associated to a single article, but I’m sure it can be done. If you set the category attribute on the tag for each gallery, I don’t see why it wouldn’t work. The jpop functionality might be a little dicey, but the popups should be good to go…
Offline
#285 2006-02-18 02:52:08
- sonnyzm
- New Member
- Registered: 2006-02-14
- Posts: 9
Re: [plugin] [ORPHAN] rss_thumbpop - Thumbnail Image Gallery w/ popups
Well lets say I have a portfolio of my graphics:
I have section: Graphics
then I have categories for different types of graphics i.e sections: 2d, 3d, vector
each one of those sections is a different category, but I cant get them to show all in one page (all three gallery sections) I can only make links to the individual pages with the thumbnails
I’ve only started using textpattern this week so please forgive my newbness lol =)
cheers, sonny
Offline
#286 2006-02-18 02:57:47
Re: [plugin] [ORPHAN] rss_thumbpop - Thumbnail Image Gallery w/ popups
no worries, I started last week :) Can you post your page/form code here in a code section?
Last edited by rbe (2006-02-18 02:58:06)
Offline
#287 2006-02-18 03:05:13
- sonnyzm
- New Member
- Registered: 2006-02-14
- Posts: 9
Re: [plugin] [ORPHAN] rss_thumbpop - Thumbnail Image Gallery w/ popups
Well so far I’m using the original form code from the thumbgallery tutorial and my page code is like this
<code>
<txp:if_article_list>
<txp:article_custom form=“gallery-list” category=“article-17”
section=“gallery” />
</txp:if_article_list>
<txp:if_individual_article>
<txp:article form=“gallery-single” />
</txp:if_individual_article>
</code>
which is also very much like the original code, I want it to display the thumbnail gallery on the page, not the link to it. (btw my category 2d is assigned as article-17)
code tags not working?
Last edited by sonnyzm (2006-02-18 03:14:52)
Offline
#288 2006-02-18 03:08:55
Re: [plugin] [ORPHAN] rss_thumbpop - Thumbnail Image Gallery w/ popups
sonny, can you edit that post and put the code in “code” tags? Thanks! Just from reading it, I think you might need to put your rss_thumbpop tag in an article form… the page can do the article list for the “gallery” section, and the article form should contain the thumbpop tag. I had a similiar problem the first time I used it…
Offline