SylvainTI / phpliteadmin

Automatically exported from code.google.com/p/phpliteadmin
0 stars 0 forks source link

Managing themes: download / preview #131

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
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?

Original issue reported on code.google.com by crazy4ch...@gmail.com on 4 Nov 2012 at 6:39

GoogleCodeExporter commented 9 years ago
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

Original comment by teryaki1...@googlemail.com on 5 Nov 2012 at 2:53

GoogleCodeExporter commented 9 years ago
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.

Original comment by crazy4ch...@gmail.com on 6 Nov 2012 at 2:54

GoogleCodeExporter commented 9 years ago
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>

Original comment by teryaki1...@googlemail.com on 6 Nov 2012 at 3:56