Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#31 2004-10-28 02:03:00
- nardo
- Member

- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: [archived] jmr_gallery : Article Associated Image Gallery
Justin, great work building on this concept — and here’s a feature request
I would like to place the caption and the prev/next links in other container boxes (not below the img)
absolute positioning is not an option — I guess you would have to allow for tags to place this content in other places on the page?
e.g. <code><txp:jmr_gallery_caption></code>
this would allow for great flexibility in design…
as you’ve noted before, having a bunch of pics tied to one article, and browsed on the same page, is excellent
Offline
#32 2004-11-03 07:43:33
- nardo
- Member

- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: [archived] jmr_gallery : Article Associated Image Gallery
having the same problem as Matt on page 1 — next and previous links not working…
<code>http://subdomain.domain.tld/index.php?id=1</code>
that’s my page and it’s showing a pic with next/prev links… but the next link takes me to
<code>http://subdomain.domain.tld/index.php?imagenum=2</code>
which actually leaves me at the home page…
…
I tried hacking the plugin as per Matt’s instructions but I don’t know PHP so perhaps the several places I tried to paste it in were wrong… could you show an example line of code in full?
thanks
Last edited by nardo (2004-11-03 07:44:36)
Offline
#33 2004-11-03 09:06:31
- heikki74
- Member
- From: Finland
- Registered: 2004-08-17
- Posts: 100
Re: [archived] jmr_gallery : Article Associated Image Gallery
Try using clean urls with unmodified plugin first. I don’t know if it’s supposed to work with messy ones in the first place.
Offline
#34 2004-11-03 09:45:52
- nardo
- Member

- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: [archived] jmr_gallery : Article Associated Image Gallery
thanks heikki, the unmodified plugin is what I’ve got going…
now the kinda confusing part…
I’m on TXD with a subdomain, and my site wasn’t working until I changed to messy… apparently <a href=“http://www.textdrive.com/forum/viewtopic.php?id=258”>clean URLs don’t work</a> on a subdomain yet…
but then in that post, I followed Mamash’s rewrite rules and changed the site preferences to Clean URL Mode… and the site is working, only the plugin ain’t
i.e. while all other links show clean urls, the next/previous gallery links show the same as I reported above
Last edited by nardo (2004-11-03 09:47:38)
Offline
#35 2004-11-07 10:29:30
- nardo
- Member

- From: tuvalahiti
- Registered: 2004-04-22
- Posts: 743
Re: [archived] jmr_gallery : Article Associated Image Gallery
‘nother plea for help…
this is how the NEXT/PREV urls currently look…
http://subdomain.domain.tild/index.php?imagenum=2
it should look like this:
http://subdomain.domain.tld/entry/1/?imagenum=2
I’m happy to hard-code most of the path into there (up to the article ID), and it’ll only be used on the section called ‘entry’… but I’m not having any success with hacking the plugin itself, php skills being non-existent
RESOLVED
I replaced <code>$_SERVER[‘PHP_SELF’]</code> with <code>’‘</code> and it’s working with clean urls on a TXD subdomain with Mamash’s htaccess rules
Last edited by nardo (2004-11-10 00:06:09)
Offline
Re: [archived] jmr_gallery : Article Associated Image Gallery
I’m using ‘messy’ and I’m not sure where I would find the real code to edit this plugin… I’m not familiar with the plugin system at all. If someone would be so kind as to tell me where the code for installed plugins resides I’ll gladly edit it and test heikki74’s solution
Proud Canadian. Toronto Locksmith , Actualize Consulting
Offline
Re: [archived] jmr_gallery : Article Associated Image Gallery
coughs::nevermind! Figured it out less than a second after I asked for help.
Proud Canadian. Toronto Locksmith , Actualize Consulting
Offline
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)
Proud Canadian. Toronto Locksmith , Actualize Consulting
Offline
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
Re: [archived] jmr_gallery : Article Associated Image Gallery
Done, Thanks Matt
Proud Canadian. Toronto Locksmith , Actualize Consulting
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
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