Announcement

  •  » Themes
  •  » Example for theme with configuration?

#1 2016-06-14 21:41:22

TheDoc
Member
Munich / Germany
2015-10-18
173

Example for theme with configuration?

Hi,

using the documentation from http://piwigo.org/doc/doku.php?id=dev:e … e_creation I have managed to combine my various bits and pieces into a theme :-)

Now I would like to add a configuration screen to allow users to select what features should be enabled. Is there any good example where I could find code to "re-use"?

Thanks,
Thomas

Piwigo version: 2.8.1
PHP version: 5.6.21
MySQL version: 5.5.49-0+deb7u1-log
Graphics Library: External ImageMagick 6.6.0-4
Piwigo URL: bilder.feuster.com

Offline

 

#2 2016-08-22 02:51:44

rachel19
Member
2016-08-20
1

Re: Example for theme with configuration?

TheDoc wrote:

Hi,

using the documentation from http://piwigo.org/doc/doku.php?id=dev:e … e_creation I have managed to combine my various bits and pieces into a theme :-)

Now I would like to add a configuration screen to allow users to select what features should be enabled. Is there any good example where I could find code to "re-use"?

Thanks,
Thomas

Piwigo version: 2.8.1
PHP version: 5.6.21
MySQL version: 5.5.49-0+deb7u1-log
Graphics Library: External ImageMagick 6.6.0-4
Piwigo URL: bilder.feuster.com

Hey Thomas,

Did you end up finding any resources? If yes, could you please share.

Thanks!

Offline

 

Notice: Undefined offset: 5 in /var/www/piwigo.org/forum/include/parser.php on line 551

#3 2016-08-25 13:22:43

philb
Member
2014-07-22
30

Re: Example for theme with configuration?

It's fairly simple (but unfortunately undocumented):

* Create a folder "admin" in the root directory of your theme
* Create a file "admin.inc.php", add your logic in here and assign the page to the template:

Code:

// Fetch the template.
global $template;

// Add our template to the global template
$template->set_filenames(
    array(
        'theme_admin_content' => 'path/to/admin.tpl'
    )
);

// Assign the template contents to ADMIN_CONTENT
$template->assign_var_from_handle('ADMIN_CONTENT', 'theme_admin_content');

I think that's it and Piwigo detects that it's there automatically.

You can reuse code from the admin, e.g. tabbed example: [Github] bootstrapdefault file admin/admin.inc.php

Last edited by philb (2016-08-25 13:24:59)

Offline

 

#4 2016-08-25 15:42:40

TheDoc
Member
Munich / Germany
2015-10-18
173

Re: Example for theme with configuration?

Cool, will have to try that once I have some idle time on my hands...

Offline

 

#5 2017-11-13 16:17:12

ghutch
Member
2017-11-13
3

Re: Example for theme with configuration?

Hello TheDoc. 

I know this is an old thread but it the only way I could find to contact you.

I have run into a problem with one of your published themes.  It is the Elegant Slick theme.  I installed it in my current version of Piwigo and set it as default.  Now I get an error everytime I try to goto my website. 

The error is "Fatal error: Can't use method return value in write context in J:\roadking\spike\public_html\piwigo\themes\elegant_slick\themeconf.inc.php on line 45"

I have attempted to remove the offending theme, change the default back to Elegant and many other iterations. I still get the error unless I goto the piwigo/admin.php site directly.

Is there anything I can do to eliminate this error and reaccess my website?  Am I missing some additional feature I must add to make Elegant Slick work?

I hate to think that installing this theme was fatal to Piwigo.

Gary Hutchison

Offline

 

#6 2017-11-13 21:12:21

TheDoc
Member
Munich / Germany
2015-10-18
173

Re: Example for theme with configuration?

Hi Gary,

sorry to hear about that. Which version of PiWiGo are you using? Works fine for my since 2.8.1 (currently 2.9.2)

Let me see...

1) The error

Line 45 is

Code:

if (isset($template->get_template_vars('current')['selected_derivative']))

Google hits for this error don't really enlighten my as to what the problem is :-( They all sound like "method get_template_vars might not be there" - which would be a major PiWiGo issue.

2) Uninstalling

Have really never tried to uninstall the theme. Do you get any error message when disabling the theme or changing the default to some other one? Works for me without issues. Only thing I have noticed: you need once to logout of the admin UI before the changes seem to take affect...

Have you tried accessing your webspace directly and deleting /piwigo/themes/elegant_slick directly after deactivating the theme? After that the error you have mentioned should be impossible.


Sorry, not much that comes to mind right now. Maybe if you could share the link to your gallery or similar I might be able to help you. Unfortunately, I haven't run into any of the issues you have listed.

Thomas


    Piwigo 2.9.2
    Operating system: Linux
    PHP: 5.6.31 (Show info) [2017-11-13 21:11:57]
    MySQL: 5.5.57-0+deb7u1-log [2017-11-13 21:11:57]
    Graphics Library: External ImageMagick 6.8.9-9

Offline

 

#7 2017-11-13 23:33:00

ghutch
Member
2017-11-13
3

Re: Example for theme with configuration?

Hi, I was successful in getting Piwigo to respond again.  I have removed the theme. It was strange, I would get the error from one system with one browser.  Until I restarted the browser the error continued.  It is gone now since the restart.  However, I am gunshy about applying the theme again. 

I am not sure if I am missing something needed by the theme.  I am installing under windows IIS.  I installed mysql and php.  Is anything else needed?

Offline

 

#8 2017-11-18 15:34:10

TheDoc
Member
Munich / Germany
2015-10-18
173

Re: Example for theme with configuration?

I'm not aware of any preconditions for the theme. But I must confess I haven't made any checks with this regard... A quick switching off of all plugins shows that OpenStreetMap is required - but I could surely make the theme work without it.

Don't you have a test installation you could play around with first?

Offline

 

#9 2017-11-18 18:29:35

TheDoc
Member
Munich / Germany
2015-10-18
173

Re: Example for theme with configuration?

I have fixed the check for the openstreetmap plugin. Now the theme works on my end without any plugins enabled. So no dependencies that I'm aware of.

Offline

 

#10 2017-11-21 13:03:15

ghutch
Member
2017-11-13
3

Re: Example for theme with configuration?

Thank you Thomas for the help.  It seems to work well now.

Offline

 
  •  » Themes
  •  » Example for theme with configuration?

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact