embedUri + G2 rewrite module
cschlatt
Joined: 2005-05-24
Posts: 17 |
Posted: Thu, 2005-06-30 10:35 |
I'm using G2 CVS current version. It seems that a request string in $embedUri of the form ?param=value does not get appended to G2 URLs if the G2 rewrite module is activated. As an example, I use GalleryEmbed's Init(..) with
and after calling HandleRequest(..), I get G2 URLs of the form http://www.example.com/pmwiki/v/album/ . What I would need is http://www.example.com/pmwiki/v/album/?module=gallery2. Is there a way to enable that? Thanks for any hints, |
|
Posts: 389
You should check your .htaccess file in the CMS directory. There the '?module=gallery2' part should be appended to the rewritten pattern.
Posts: 17
The .htaccess method is OK for static rewriting, e.g. always append ?module=gallery2 to the URL. The problem is that my application dynamically generates query string parameters (like e.g. ?action=insertimage) that should be appended to all G2 links.
IMHO, query strings in EmbedUri should be appended to G2 URLs (as it happens if G2 rewrite is deactivated) also if G2 rewrite is active.
Posts: 389
Even if your CMS dynamically generates query string params there should be one that maps to Galllery (module=gallery2). How could there be more params that map to the gallery2 plugin? module=gallery2 should load the Gallery module which takes care of the request (the rest of the POST/GET action).
Posts: 17
You're right, one parameter is enough to map to the g2 plugin. But as you mention
the rest of the GET action can only be made if the GET params still exist in the URL (this would not be a problem for POST actions).
Imagine the following situation:
I call the G2 plugin with the URL
http://www.example.com/pmwiki/g2page?module=g2&action=insertimage
The param action=insertimage tells the CMS to include a special link in the CMS page that shows embedded G2. Now if G2 rewrite is active, the action=insertimage param does not get appended to G2 URLs, and so if I click on an album link, the special link cannot be included anymore by the CMS.
Posts: 32509
cschlatt, so the problem is not the param "?module=gallery2. " as you described in your initial post, correct?
the problem are additional parameters, right?
Posts: 17
Yes, the problem are additional params, I see now that my first post was a bit misleading :-?
I'm integrating G2 into PmWiki. Embedding a gallery view into a wiki page is simply made by writing something like (:g2 in the wiki page. The G2 embedding code is triggered as soon the wiki parser sees the syntax (:g2. This is why I don't use "?module=gallery2" at all, but would like to pass additional URL GET parameters to G2.
As already mentioned, this works if G2 rewrite is deactivated (GET params in $EmbedUri get appended to G2 links).
Thanks for any help,
Christian
Posts: 32509
can i see this in action? not sure if i fully understand what the result looks like.
Posts: 17
have a look at
http://www.schlatter.net/pmwikitest/pmwiki.php?n=Main.Image
If you look at the image links, there is always a "pref=Main.Image" request string. This is used to generate the back link on the gallery page. This link exists as long as the mentioned pref parameter is in the URL, so that one can navigate in the gallery without loosing the back link.
If I activate G2 rewrite, the "pref=Main.Image" param does not get appended any more.
Posts: 32509
i get only errors on the page. because i wrote that part of G2, i know why i get errors.
you are using the GalleryEmbed::getImageBlock() functions.
therefore, you need to specify "fullInit" => true in the GalleryEmbed::init() call, if you omit this, anonymous users will get the errors i get right now.
to your request:
where / how do you add the param "pref=Main.Image" to G2 urls?
Posts: 17
hmm, I did that, but I'm quite surprised, since I always tested it as anonymous user. In fact, I haven't implemented yet user management G2<->PmWiki at all ... Is this because I had still a cookie from a G2 standalone session?
I set it via $EmbedUri, e.g.
When I enable PmWiki rewrite, this gets to
Posts: 32509
@cookie / error: i don't get any error anymore. whatever it was, it's fixed now.
@param:
$EmbedUri = '?pref=Main.Image' won't quite work.
embedUri is the string directly after the host/path/ parts of the url, it's not something that is appended.
you could abuse
the 'embedSessionString' param of GalleryEmbed::init() just set
embedSessionString => pref=Main.Image, i guess this should work.
as for a better / cleaner solution...maybe we can add a better method later.
Posts: 17
Unfortunately, this doesn't work. The 'embedSessionString' only gets appended if in "cookie-less" mode. From GalleryUrlGenerator.class:
$EmbedUri = '?pref=Main.Image' works well as long as G2's rewrite module is not activated (I use it like this).
After enabling URL rewrite in PmWiki, the URLs of the form
http://www.example.com/pmwiki.php?n=Group/Page
get tohttp://www.example.com/Group/Page
. And so the string directly after the host/path/ is empty (except any query strings).IMHO, all query parameters in $EmbedUri should be appended to G2 URLs like with embedSessionString. This would also be consistent with the G2 embed docu:
Thanks for your help,
Christian
Posts: 32509
we treat embedUri as a string, it is not separated in a file part and a parameter part.
of course we could do that and append the params then to all urls.
but i don't have time for this at the moment.
could you file an RFE on http://sf.net/projects/gallery/ ? thanks.