coppermine-gallery.com/forum

Support => cpg1.5.x Support => cpg1.5 plugins => Topic started by: mykee on August 16, 2013, 11:25:17 AM

Title: Can I get a parameter from album list of control panel?
Post by: mykee on August 16, 2013, 11:25:17 AM
Dear developers,

I made a plugin, and I think, I will use this plugin more than once on index.php. Can I use or call this plugin with parameters from album list? Like you: "catlist,4" -> "myplugin,(parameter)"? Ex.: myplugin,rand\myplugin,lastn\myplugin,lastup\alblist ?

Thanks,
Mykee
Title: Re: Can I get a parameter from album list of control panel?
Post by: Αndré on August 20, 2013, 03:41:39 PM
I don't get what you're asking for. If you want to add different content to the main page, I suggest to use different keywords instead of the same keyword concatenated with another keyword. I'm not sure if this will work at all.
Title: Re: Can I get a parameter from album list of control panel?
Post by: mykee on August 21, 2013, 07:59:23 AM
I need use same plugin on index.php, but with different parameters, like coppermine albums (random, latest, etc.). Can I add parameter on configure site or not? (like row numbers: "lastn,4")
Title: Re: Can I get a parameter from album list of control panel?
Post by: Αndré on August 21, 2013, 10:36:48 AM
Sure, but it's only possible to add numbers, no strings. Have a look at the plugin hook:
$matches = CPGPluginAPI::filter('plugin_block', $matches);

I assume we're talking about your "isotope" plugin. If so, you implemented the filter incompletely:
function isotope_mainpage()
needs to be
function isotope_mainpage($matches)

If you now add something like
isotope,42
to the content of the main page, you're able to use that additional number in your isotope_mainpage function.

print_r($matches);
will return
Array
(
    [0] => isotope,42
    [1] => isotope
    [2] => 42
)

which means, that you can access your additional number via $matches[2].
Title: Re: Can I get a parameter from album list of control panel?
Post by: mykee on August 21, 2013, 10:50:01 AM
Thanks for great help! Yes, this is isotope plugin, where I think put latest and random gallery with isotope - more gallery on index page. I will try your help at aftertnoon, and develop this plugin with more function.
I'd like this: if add a parameter, then select more gallery on one page at twice or more, if not add parameter, then select under config what see on frontpage.
Title: Re: Can I get a parameter from album list of control panel?
Post by: mykee on August 22, 2013, 06:16:05 PM
Parameter works now. :) Thanks for help!
(I'm sad: I cannot add one plugin more than once to parameter list. :( )
Title: Re: Can I get a parameter from album list of control panel?
Post by: Αndré on August 22, 2013, 08:46:44 PM
Quote from: mykee on August 22, 2013, 06:16:05 PM
I cannot add one plugin more than once to parameter list
Do you mean you cannot enter something like
Quoteisotope,1/isotope,4/isotope,12
? As far as I know that should be possible, at least I'm quite sure I tested that with the default options (lastup, etc.).
Title: Re: Can I get a parameter from album list of control panel?
Post by: mykee on August 22, 2013, 09:31:21 PM
Hmmm... Working now, if use more than one in parameter list, but isotope script no runned when second gallery showed. TipTip or Adipoli worked, just isotope not. :(
I will search why not. Thanks!
Title: Re: Can I get a parameter from album list of control panel?
Post by: mykee on August 22, 2013, 11:25:45 PM
I rewrited my plugin id's, script, because if use plugin more at once, then category filter and isotope script not worked correctly. Check my website for this solution, this worked. Many thanks for great and usefull help!
If anyone need this plugin, I can publish it, but JQuery licenses is different on each script (Isotope, TipTip, Adipoli and LightBox) what includes in this plugin! Often free for personal use, but for commercial use not. I made this for better gallery start page :)