We use cookies to improve your experience. No personal information is gathered and we don't serve ads. Cookies Policy.

ExpressionEngine Logo ExpressionEngine
Features Pricing Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University
Log In or Sign Up
Log In Sign Up
ExpressionEngine Logo
Features Pro new Support Find A Developer
Partners Upgrades
Blog Add-Ons Learn
Docs Forums University Blog
  • Home
  • Forums

Any nice way to get the Gallery prefs?

Development and Programming

Erin Dalzell's avatar
Erin Dalzell
790 posts
17 years ago
Erin Dalzell's avatar Erin Dalzell

Or do I have go get it manually from the DB?

       
Jamie Poitra's avatar
Jamie Poitra
409 posts
17 years ago
Jamie Poitra's avatar Jamie Poitra

Did you try the $PREFS class?

Jamie

       
Erin Dalzell's avatar
Erin Dalzell
790 posts
17 years ago
Erin Dalzell's avatar Erin Dalzell

I did take a look at that class, but I don’t see the gallery prefs in there. In the mcp.gallery.php file, it isn’t used…

       
Jamie Poitra's avatar
Jamie Poitra
409 posts
17 years ago
Jamie Poitra's avatar Jamie Poitra

Ah, my bad, sorry.

You could try using the Gallery_CP class functions for it.

assign_gallery_preferences

Jamie

       
Erin Dalzell's avatar
Erin Dalzell
790 posts
17 years ago
Erin Dalzell's avatar Erin Dalzell

Maybe, though I am not sure the gallery_id can be set as it appears to be set thusly:

$this->gallery_id = ( ! $IN->GBL('P')) ? FALSE : $IN->GBL('gallery_id', 'GP');

Which looks like an URL based test of some kind.

       
Jamie Poitra's avatar
Jamie Poitra
409 posts
17 years ago
Jamie Poitra's avatar Jamie Poitra

IF you call the Gallery_CP class you should be able to do something like this:

$GALL->gallery_id = '#';
$GALL->assign_gallery_preferences();

Then you would have the prefs you needed available from:

$GALL->prefs;

I’m just shooting from the hip here. I have a meeting to run off to in a few minutes. But something like the above should work. I’m assuming you called the class as: $GALL = new Gallery_CP; of course.

Jamie

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

Or you could also just run the query and gather the preferences yourself, which would seem to be the lightest way to get them. Isn’t that a “nice” way?

       
Erin Dalzell's avatar
Erin Dalzell
790 posts
17 years ago
Erin Dalzell's avatar Erin Dalzell

Ya, that’s what I ended up doing…I just hate duplicating code, that’s all.

       
Derek Jones's avatar
Derek Jones
7,561 posts
17 years ago
Derek Jones's avatar Derek Jones

Without knowing what you’re doing, I’d say in this case it’s not worth it to dogmatically stick to a practice of never duplicating code (believe me, I hate duplicated code too). Reason being, that method was never intended to be used outside of the Gallery module, and including that entire file and instantiated a class object for just that one tiny method may be better for you from a code perspective, it is worse for the user and server, occupying more resources, not to mention running a bunch of things in the class constructor method that you do not need.

       
Jamie Poitra's avatar
Jamie Poitra
409 posts
17 years ago
Jamie Poitra's avatar Jamie Poitra

Or you could just do what Derek says…

Crawls back into his hole 😊

Jame

       

Reply

Sign In To Reply

ExpressionEngine Home Features Pro Contact Version Support
Learn Docs University Forums
Resources Support Add-Ons Partners Blog
Privacy Terms Trademark Use License

Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.