Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#37 2004-11-22 11:07:10

1beb
Plugin Author
From: Canada, Ontario, Toronto
Registered: 2004-11-22
Posts: 169
Website

Re: [archived] jmr_gallery : Article Associated Image Gallery

coughs::nevermind! Figured it out less than a second after I asked for help.

Offline

#38 2004-11-30 07:04:15

1beb
Plugin Author
From: Canada, Ontario, Toronto
Registered: 2004-11-22
Posts: 169
Website

Re: [archived] jmr_gallery : Article Associated Image Gallery

I was also having issues with

#Getting images to show up at all
#The next and previous buttons weren’t working…

I edited the plug-in to work including some of the changes already suggested by others in this thread… I’m not sure how to make the links into clean url’s but passing the query string is good enough I hope… if you are really having problems with this plug this works for me.

<code>
function jmr_gallery($atts) {
global $pretext,$img_dir, $id; //$thisarticle;
$pfr = $pretext[‘pfr’];
if(is_array($atts)) extract($atts);
if(!$category){ $category = ‘article-’ . $id; //$thisarticle[‘thisid’]; }
$images[]= “”;
$alts[]= “”;
$heights[]=”“;
$widths[]=”“;
$imagecaptions[]=”“;
$out[]= “”;
$total= “”;
$sortby = (empty($sortby)) ? ‘date’ : $sortby;
$sortdir = (empty($sortdir)) ? ‘asc’ : $sortdir;
$q = array( “select * from txp1_txp_image”, (!empty($author) or !empty($category)) ? ‘where’ : ‘’, (!empty($author)) ? “author=’$author’” : ‘’, (!empty($author) and !empty($category)) ? “and” : ‘’, (!empty($category)) ? “category=’$category’” : ‘’, “order by”, $sortby, $sortdir, (!empty($limit)) ? “limit $limit” : ‘’ );
$rs = getRows(join(’ ‘,$q));
if ($rs){ foreach ($rs as $a){ extract($a); // $url = $pfr.$img_dir.’/’.$id.$ext; $images[]= $url; // $alts[]= $alt; // $imagecaptions[]= $caption; // $heights[]= $h; // $widths[]= $w; } //Set total num of images $total = count($images)-1; //Retrieve imagenum var from url $imagenum = $_GET[‘imagenum’];
$id=$pretext[‘id’]; //Set links, image, and current image display if(!isset($imagenum)){ $imageurl=$images1; $imagetag=’<img src=”’. $imageurl . ‘” alt=”’ . $alts1 . ‘” width=”’ . 550 . ‘” />’; //
$imagenum=1;
$nextimage=$imagenum+1;
$previmage=$imagenum-1; $prevlink=’<a id=“previmage” href=”’ . str_replace(‘’,’‘,“http://www.bertelsen.ca/” . “?id=”. $id. “&” . ‘imagenum=’). $previmage . ‘”>« Previous image</a>’; $nextlink=’<a id=“nextimage” href=”’ . str_replace(‘’,’‘,“http://www.bertelsen.ca” . “?id=”. $id. “&” . ‘imagenum=’). $nextimage . ‘”>Next image »</a>’;
// // $currentimage=1; // $currentcaption=$imagecaptions1; // }else{ $imageurl=$images[$imagenum]; $imagetag=’<img src=”’. $imageurl . ‘” alt=”’ . $alts[$imagenum] . ‘” width=”’. 550 . ‘” />’; // $nextimage=$imagenum+1; $nextimage = ($nextimage > $total) ? $nextimage=1 : $nextimage; $nextlink=’<a id=“nextimage” href=”’ . str_replace(‘’,’‘,“http://www.bertelsen.ca” . “/?id=”. $id. “&” . ‘imagenum=’). $nextimage . ‘”>Next image »</a>’; // $previmage=$imagenum-1; $previmage = ($previmage < 1) ? $previmage=$total : $previmage; $prevlink=’<a id=“previmage” href=”’ . str_replace(‘’,’‘,“http://www.bertelsen.ca” . “/?id=”. $id. “&” . ‘imagenum=’). $previmage . ‘”>« Previous image</a>’; // $currentimage=$imagenum; $currentcaption=$imagecaptions[$currentimage]; }; //Build image $out[]=$imagetag; //Build caption $out[]=’<p id=“imagecaption”>’ . $currentcaption. ‘</p>’; if ($total>1){ //Set count $count=’ | ‘ . $currentimage . ‘ of ‘ . $total . ‘ | ‘; //Build image nav $out[]=’<p id=“imagenav”>’ . $prevlink . $count . $nextlink . ‘</p>’; }; //Output results return join(n,$out);
};
};
</code>

Keep in mind, I’ve edited this to work for me specifically ( notice how I changed the width attribute on the image tag )

Last edited by 1beb (2004-11-30 21:17:02)

Offline

#39 2004-11-30 13:12:27

Matt
Member
Registered: 2004-02-28
Posts: 92
Website

Re: [archived] jmr_gallery : Article Associated Image Gallery

See how the “Next image” and “previous image” lines of code have become hyperlinks in your post? Try wrapping it all in < c o d e > and < / c o d e > (but without the spaces).
Or just link to a txt file instead.

Last edited by Matt (2004-11-30 13:13:35)

Offline

#40 2004-11-30 17:22:30

1beb
Plugin Author
From: Canada, Ontario, Toronto
Registered: 2004-11-22
Posts: 169
Website

Re: [archived] jmr_gallery : Article Associated Image Gallery

Done, Thanks Matt

Offline

#41 2004-12-01 21:06:34

arakune
Member
Registered: 2004-10-23
Posts: 13

Re: [archived] jmr_gallery : Article Associated Image Gallery

I’m having trouble getting this (fantastic-looking!) luginto work. I wondered if someone could take a look at what I’m doing, and see if they can spot a missed step or some other such.

First off, i’m using TXP1.0rc, with messy URLs (no choice about that, though I understand other people in this thread have gotten the plugin to work with mesy URLs).

I’m using an unmodified version of the plugin, per heikki74’s comments on calling the plugin within an article form.

  • the plugin is installed and active
  • I’ve added txp:jmr_gallery to my “Single” article form, just above txp:body
  • the “Single” form is being used on my default page
  • I’ve created an image category called ‘article-2’, and uploaded some images to it.

That’s it. I then look at my site (both the front page, which has article 2 included, and the permalink page for article 2), and see nothing at all from the plugin.

is there something more than I am missing, or should that do it? If that’s it, does anyone have any suggestions for troubleshooting this plugin?

TIA!

Offline

#42 2004-12-01 21:26:06

heikki74
Member
From: Finland
Registered: 2004-08-17
Posts: 100

Re: [archived] jmr_gallery : Article Associated Image Gallery

Just a quick guess.. do you have a table prefix or not?

Offline

#43 2004-12-01 21:40:47

arakune
Member
Registered: 2004-10-23
Posts: 13

Re: [archived] jmr_gallery : Article Associated Image Gallery

Ah, i should have mentioned :)

Yes, my tables are prefixed with the default ‘txp_’. However, looking at the db schema now, I just noticed something (possibly) odd: with the exception of txp_textpattern, they are all prefixed with ‘txp_txp_’ rather than just with ‘txp_’. My config.php lists the table prefix as just being ‘txp_’, and I haven’t encountered problems with any of the tables to date, but that does seem a bit unexpected. I’ll try making the table prefix edit you suggested earlier, and see if that has any effect. Thanks!

Offline

#44 2004-12-01 21:43:42

arakune
Member
Registered: 2004-10-23
Posts: 13

Re: [archived] jmr_gallery : Article Associated Image Gallery

::happiness!::

Thanks so much, heikki74! The problem was indeed with the table name.

Now to investiage what’s up with my wacky prefixes _

Offline

#45 2004-12-26 21:28:02

flavour
New Member
Registered: 2004-12-25
Posts: 3
Website

Re: [archived] jmr_gallery : Article Associated Image Gallery

Didn’t work till I saw/realized, that the gallery-tag had to go into the form section.

Now it’s working great and I love it!!! Especially the fact, that you don’t change the article, browse a gallery with thumbnails, you just click inside the article. GREAT!

Offline

#46 2004-12-28 06:32:32

jonathan
New Member
Registered: 2004-12-23
Posts: 3
Website

Re: [archived] jmr_gallery : Article Associated Image Gallery

So, which version should we be using now? The original or the modded version? I use clean URL’s and this plugin will work beatifully with one of my sites….

Offline

#47 2004-12-28 07:55:32

heikki74
Member
From: Finland
Registered: 2004-08-17
Posts: 100

Re: [archived] jmr_gallery : Article Associated Image Gallery

I suggest you try the original first. Then in case of trouble:
  • do you use table prefix? (you have to modify the plugin if you do)
  • use it inside the article form

Offline

#48 2004-12-29 04:51:01

jonathan
New Member
Registered: 2004-12-23
Posts: 3
Website

Re: [archived] jmr_gallery : Article Associated Image Gallery

very sweet! Yes, the original works fine, so long at the txp:jmr_gallery tag is placed, as suggested above, inside the article (in my case, the default form) form that you use.

Thanks to the author, and a nice siite by the way. I will use it for my own son’s site, he is 6 :-)

Offline

Board footer

Powered by FluxBB