Managing themes: download / preview

Issue #131 open
Christopher Kramer created an issue

Originally reported on Google Code with ID 131

In issue #130, a teryaki proposed a new way of managing themes for phpliteadmin and
I think we need to discuss this.

I would like to integrate theme management into phpliteadmin itself:

- possibility to download several themes into a "themes" folder (one css + preview
image (?) each)
- user can select the theme in user interface
- user can preview downloaded themes and other available (not yet installed) themes
directly in the user interface (loads list of available themes + preview graphics from
our site)
- user can pick one of the available themes in the user interface so it gets downloaded
into his themes folder and can be selected

What do you think about that? Good idea? Down-side is that we might add some kb of
code that some users might feel is rather useless. But in case this really gets to
big, we could also make this feature optional.
This really sounds like another idea for a plugin (issue #129).

What do you think about it?

Reported by crazy4chrissi on 2012-11-04 18:39:57

Comments (3)

  1. Former user Account Deleted
    I was just thinking about something simpler at the beginning, like:
    
    Line: 1468
    
    <?php
    if(isset($_GET['theme'])) $theme = $_GET['theme'];
    else $theme = "phpliteadmin.css";
    
    if(!file_exists($theme))  //only use the inline stylesheet if an external one does
    not exist
    {
    ?>
    
    Line: 1779
    
    <?php
    }
    else //an external stylesheet exists - import it
    {
       echo "<link href='".$theme."' rel='stylesheet' type='text/css' />";
    }
    
    only for one-time-viewing purpose, not to work with it
    

    Reported by teryaki1963 on 2012-11-05 02:53:46

  2. Christopher Kramer reporter
    Yeah, that's a good start. I was just thinking about how we could do this even cooler
    ;-)
    
    I Think next steps could be:
    - store the currently selected theme in a session-variable
    - scan the folder "themes" for themes and let the user choose one of these using a
    dropdown or something
    
    So it is not only a preview, but the user can really select another theme from the
    user interface.
    

    Reported by crazy4chrissi on 2012-11-06 14:54:03

  3. Former user Account Deleted
    ok i was only thinking of a quick preview for the theme before downloading it.
    you want to offer an option section to save the the theme as default. 
    Yes, it depends on if files are writeable on the users server, then its no problem.
    
    I wanted to do the same idea but wanted to offer as a plugin. phpLiteAdmin comes with
    no own database to save all options (theme name, rows number, header information etc.)
    but a plugin can have a small sqlite database with it. Thats why i think, that plugins
    integration can make phpLiteAdmin more powerful and also stays simple as usual.
    
        "scan the folder "themes" for themes and let the user choose one of these using
    a dropdown or something"
    
    i have already such a function, in case you need it
    
    <?php
    // list all themes names from folder themes 
    function get_themes(){  
        $res = "";
        $default = 'phpliteadmin.css'; //assuming this is the current used theme
    
        if($handle = opendir('themes')) {
            while (false !== ($file = readdir($handle))) {
                if ($file != "." && $file != ".." && !is_dir('themes/'.$file)) {
    
                    $def = "";
                    if($file == $default) $def = ' selected="selected"';
    
                    $res .= '<option value="'.$file.'"'.$def.'>'.$file.'</option>';
                }
            }
            closedir($handle);
        }
        return $res;
    }
    
    ?>
    
    <select name="themes">
    <?php echo get_themes(); ?>
    </select>
    

    Reported by teryaki1963 on 2012-11-06 15:56:45

  4. Log in to comment