Gallery Theme for Multisite installs

sneeper

Joined: 2005-10-24
Posts: 20
Posted: Sun, 2006-04-16 00:48

I'd like to create a themes that points back to the multisite folder URL for the Logo. This way, multisite specific images, like a logo, can be stored in the user's folders and not in the central codebase.

How does one access the multisite URL in the API?

(Even better would be for the user to be able to specify in the GUI the path to the logo, but I think that's a bit harder.)

-Sneeper

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2006-04-18 03:22

good question.. G2 itself doesn't need to do this, so there currently is no option for it.. but of course it is useful as you describe, and the option is easy to add. i've made the change in CVS, you can try tomorrow's nightly snapshot. or, here is a patch to modules/core/classes/GalleryUrlGenerator.class

@@ -547,7 +547,7 @@
        } else if (isset($params['href'])) {
             /* In case of multisites, get the codebase base URL */
            $url = $gallery->getConfig('galleryBaseUrl');
-           if (empty($url)) {
+           if (empty($url) || !empty($options['forceDirect'])) {
                $url = $this->getCurrentUrlDir(true);
            }
 

with this change you can do: {g->url href="images/site.jpg" forceDirect=true}
and this will be relative to the multisite dir instead of the codebase dir.

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Tue, 2006-05-23 00:29

Mindless, was this ever implemented? I rooted through the code and did not see this. If it was, possible to expand on the usage a little more? Am mucking through the multi-site and unique logo thing, trying to come up with a solution without cloning, tho that is of course an option.

tx

mindless wrote:
good question.. G2 itself doesn't need to do this, so there currently is no option for it.. but of course it is useful as you describe, and the option is easy to add. i've made the change in CVS, you can try tomorrow's nightly snapshot. or, here is a patch to modules/core/classes/GalleryUrlGenerator.class

@@ -547,7 +547,7 @@
        } else if (isset($params['href'])) {
             /* In case of multisites, get the codebase base URL */
            $url = $gallery->getConfig('galleryBaseUrl');
-           if (empty($url)) {
+           if (empty($url) || !empty($options['forceDirect'])) {
                $url = $this->getCurrentUrlDir(true);
            }
 

with this change you can do: {g->url href="images/site.jpg" forceDirect=true}
and this will be relative to the multisite dir instead of the codebase dir.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2006-05-23 14:50

yes, it is there. get current svn or nightly snapshot.
can't think of a better example than the one I gave. try that g->url call with and without forceDirect=true to see the difference.

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Tue, 2006-05-23 23:18

My skill level is not quite there to understand the usage. At the risk of getting yelled at, would you mind adding a sentence or two on usage. I will work to muck my way through understanding what I am looking at.... but can you add a little more on actual usage?

What I think this means is, in a multi site installation, I create a subdir named ???, and can place logo.gif inside it and change the true/false statement in the code? How far off am I??

Commence yelling at another low skilled worker, me...

mindless wrote:
yes, it is there. get current svn or nightly snapshot.
can't think of a better example than the one I gave. try that g->url call with and without forceDirect=true to see the difference.

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2006-05-24 01:12

okee.. example:
codebase: http://example.com/g2codebase/
multisite: http://example.com/myg2/
{g->url href="images/mylogo.png"} --> http://example.com/g2codebase/images/mylogo.png
{g->url href="images/mylogo.png" forceDirect=true} --> http://example.com/myg2/images/mylogo.png

The reason I asked you to try it is then you could have seen this difference firsthand.

So, create a directory called images in the multisite dir, use g->url with forceDirect=true to point at that directory (that directory in EACH multisite.. so you'll need one in each)

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Wed, 2006-05-24 03:24

Hello, and thank you for your responses. After plinking around G2 for awhile, I have finally come to realize that I need to learn PHP and the logic of the code so I can do these things on my own. I owe that to the G2 team.

So, you're still gonna shoot me but I have to ask.... where is "g->url with forceDirect=true" applied?
In modules/core/classes/GalleryUrlGenerator.class ??? I am pulling the current build right now and will look for this string, but I am still not clear where this is applied, tho I understand the creation of the images/mylogo.png in each multisite dir.

mindless wrote:
okee.. example:
codebase: http://example.com/g2codebase/
multisite: http://example.com/myg2/
{g->url href="images/mylogo.png"} --> http://example.com/g2codebase/images/mylogo.png
{g->url href="images/mylogo.png" forceDirect=true} --> http://example.com/myg2/images/mylogo.png

The reason I asked you to try it is then you could have seen this difference firsthand.

So, create a directory called images in the multisite dir, use g->url with forceDirect=true to point at that directory (that directory in EACH multisite.. so you'll need one in each)

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2006-05-24 03:28

when you look around the code you'll find that g->url is used in tpl files.
try testing by putting it in themes/{yourtheme}/templates/theme.tpl

 
drhiii

Joined: 2003-04-27
Posts: 397
Posted: Wed, 2006-05-24 03:51

NOW I get it. Makes sense. And as it would go, I've been fiddling with PGTheme which has a different construct. Natch. But this is a good task to tackle. But it makes sense now.... mucho gracias.

mindless wrote:
when you look around the code you'll find that g->url is used in tpl files.
try testing by putting it in themes/{yourtheme}/templates/theme.tpl

 
CarlosMirandaLevy
CarlosMirandaLevy's picture

Joined: 2005-01-06
Posts: 10
Posted: Mon, 2006-05-29 16:17

I removed my comment and question about passing HTTP_HOST to theme.tpl from here and posted it as a new question as suggested...
http://gallery.menalto.com/node/49802

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Tue, 2006-05-30 00:53

Please start a new topic for your question.

 
sneeper

Joined: 2005-10-24
Posts: 20
Posted: Mon, 2006-10-30 21:50

Thank you, mindless!

This change is a Good Thing. I now created a "Classic With Unique Logo" and a "Matrix With Unique Logo", which are identical to Matrix and Classic but looks for (multisite)/images/logo.png for the logo, and now my users can have their own logo at the top of their site.

What would REALLY be useful is the ability for them to have their own themes in their multisite folder. This way they can really customize their multisite install (maybe they want to center their logo?). Right now, they have no way to do that other than colorpacks.

Is there any plan to allow themes in multisite folders?

 
mindless
mindless's picture

Joined: 2004-01-04
Posts: 8601
Posted: Mon, 2006-10-30 23:02

sorry, no plans atm..