Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
maverick / wet
Nope, the behaviour was my fault. Rule #1: check the return value from core function calls and handle the situation where it returns false. Now if you destroy a theme the plugin does what it can to keep running by doing the following:
- If the directory is missing, the skin will not be selectable or even switchable even if the smd_skin / theme_name tells it to try. You will see classic instead
- If the PHP file is corrupt (e.g. you haven’t named the class properly) the theme is editable but the manifest info won’t be available (it’ll show
-
for each column) nor will the theme be selectable in the prefs/chooser even if the smd_skin / theme_name asks it to. You will drop to classic if you were trying to use the theme at the same time as edit it - If you try to switch to a skin that is in any way banjaxed the plugin will use classic instead. Note however that the message will still say “theme switched to blah” even though it couldn’t manage it. If I can fix this then I will, but currently it’s not fixable the way I’ve implemented that feature. You’ll only see this when you’re an admin: ordinary users using the Admin->Theme chooser will simply not see any theme that is out of order
- If you are in the process of editing a skin and screw up, the plugin will try and immediately drop you to classic
- In the event it cannot drop you to classic at any time, you will see errors and possibly a dead admin side (depending on the severity of the death) but going into FTP, downloading the current PHP file and fixing it (or deleting the offending file / dir) will mean that your admin side returns to normal without insisting on using the old theme. Only when it is fixed will it become available for selecting again
I cannot guarantee that it’ll never give you an error, but I’ve done my best so far to try and shield you from PHP corruption by simply ignoring the offending theme to the best of my ability.
Try the updated v0.1 and please report how you get on. If you can still break it or get warnings/errors please let me know under what circumstances so I can see if I can address those too. Thanks for your hard work in test cases and diagnosing this, maverick. Can’t believe I missed all that!
EDIT: You also can’t export or base a theme on a knackered theme.
Last edited by Bloke (2009-06-15 21:35:09)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
#26 2009-06-15 21:24:16
- jpdupont
- Member
- Registered: 2004-10-01
- Posts: 752
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
Stef,
After creating a new theme then clicked on “modify”, I get this error :
Warning: Invalid argument supplied for foreach() in /home/www/cb820cbbec8f07b5fb68355329019811/web/textpattern/lib/txplib_misc.php(580) : eval()'d code on line 377
—> Same error on themes without images in the directory, like Dds_simplexbubble
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
jpdupont wrote:
Same error on themes without images in the directory, like Dds_simplexbubble
Hmmm, what version of PHP are you using? glob
was added in 4.3.0 so if it’s before that you’re out of luck unless I can find a way round it.
EDIT: sorry, it was a dumbass question. TXP itself require 4.3.0 or greater. Erm…
EDIT2: try this update. It should gt rid of the warning but whether it fixes the problem I would doubt.
Last edited by Bloke (2009-06-15 22:04:49)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
Bloke wrote:
When I wrote the first version of the plugin last year the thumbnails were limited to 150 × 120px which made it a lot neater on-screen. In wet’s vision of themes he stipulated 260 × 150px (far more usable when viewed standalone) which I used verbatim in the plugin because I’m lazy. Now you mention it, I agree it’s a tad mahoosive in the interface.
One might doodle the possibility to arrange all available themes in a grid fashion, as the current vertically oriented table layout probably produces a lot of white space in the text-heavy columns with any reasonable thumbnail size. Imagine how 260px times 3 plus a bit of intermediary gutter fits nicely into 960px.
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
Another observation:
smd_at_setup()
is used as an event handler for plugin_prefs.smd_admin_themes
, which would require a function signature of mixed handler(string $event, string $step[, mixed $payload, ...])
.
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
wet wrote:
One might doodle the possibility to arrange all available themes in a grid fashion
You mean a bit like this latest iteration? There’s an option in the Setup to choose from either a List or Grid view.
smd_at_setup() … would require a [different] function signature
Thanks. I’ve cheated and just written a new wrapper function smd_at_options()
which is used in the callback and simply calls smd_at_setup()
. Is that good enough or should I be using the $event
and $step
? I’m a bit dim on this front, sorry.
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
Huzzah! Nice. And much more than good enough.
Offline
#32 2009-06-16 15:14:26
- jpdupont
- Member
- Registered: 2004-10-01
- Posts: 752
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
Stef,
no more error, now.
Thanks !
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
Bloke wrote:
You mean a bit like this latest iteration? There’s an option in the Setup to choose from either a List or Grid view.
fantastique! That makes it all much more delicious. Jolly good work, chumpster.
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
Sorry for the delay in the feedback.
The update fixed smd_admin_theme getting stuck in the error. Thanks!
The adjustable thumbs is a nice feature, but I think for UI purposes the grid view is an even better move.
I’ve got more playin . . . cough um testing to do when I get time in the next week ;)
Thanks Bloke!
Mike
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
Referring to Maverick’s problem with the confusing “extra level”.
When I first created the theme for 4.0.9 this plug-in didn’t exist, at least not for 4.0.9.
That being the case I decided that it would be necessary to include some instructions for the “uninitiated” which is why I have the extra level. Of course, if you read the instructions all becomes clear.
Now that we have this plug-in I think we need to decide on a common packaging method. The problem is that there will be users who would like to install a theme but don’t want to install the plug-in. Great as the plug-in is (nice one Stef), it isn’t a requirement for using admin-side themes. So are we going to require 2 packaging methods for each theme ie one for use with the plug-in and one for no plug-in or can we come up with a common method for both or do we just ignore the possibility that someone who isn’t using the plug-in might require some sort of help with installation?
Last edited by thebombsite (2009-06-24 16:27:15)
Stuart
In a Time of Universal Deceit
Telling the Truth is Revolutionary.
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
thebombsite wrote:
I decided that it would be necessary to include some instructions for the “uninitiated” which is why I have the extra [directory] level.
Yes, that’s perfectly valid and I would love the plugin upload to work seamlessly no matter where the directory resides in the zip file. Sadly it’s tricky to “know”, and until I find a clever fix I’m afraid the plugin will be limited to only work with themes that start at the level of the theme’s name :-(
As Stuart correctly states, the plugin is just a nice-to-have so we do need to cater for both the casual and hardcore themers. An instructions.txt file seems logical.
One thing that might work is to make sure that theme packages begin at the top level in the archive, and put any (optional) README or instructions inside that directory. The instructions file then become part of the theme when installed via the plugin and can be edited from the plugin interface and distributed automatically when the theme is subsequently exported. If someone who does not use the plugin double-clicks the zip, the first thing they’ll see is the theme dir. Personally, when faced with a single dir in an archive, I always then drill down into the archive to see if there were any files or instructions below that, but perhaps that’s just me. What does everyone think? Is that asking too much? Or is there a better way? Or can anyone think of a way the plugin can figure out which dir is the right one to upload?
Last edited by Bloke (2009-06-24 17:39:30)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Txp Builders – finely-crafted code, design and Txp
Offline