Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
#16 2009-06-14 21:21:52
- rsilletti
- Moderator

- From: Spokane WA
- Registered: 2004-04-28
- Posts: 707
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
Thanks Steph, Simple_x_Bubble is the first admin theme I’ve seen that I’m tempted to use, the visual enhancement is perfect and the structure that I’m used to remains in place, very nice. Between the three you suggested as tutorials (seems to be pretty much all that’s out there as yet?) there is plenty of insight into how this works to get started.
A little off thread but a new topic doesn’t seem justified. I never was able to resolve the time problems with smd_calendar, ran out of time at the time to get my head all the way around that and the project I was pursuing it for has since gone a bit idle. I did come up with a couple of ideas if you’re curious, I built them so as to plug them into the article context inside the cells, primarily for testing. They are PHP 5 and there may be a better way to do this but they might suggest an idea or two.
class_ts_diff
class_rasTimeDiff
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
rsilletti wrote:
Simple_x_Bubble is the first admin theme I’ve seen that I’m tempted to use
Yeah, it’s bloody brilliant. As long as your clients aren’t attached to IE of course, because it uses inline CSS data elements for the nice tabs, which IE6 and 7 don’t support.
the three you suggested as tutorials (seems to be pretty much all that’s out there as yet?)
Ummm, yeah! The competition closing date looms…
I’m no designer or I’d do one myself but nemoorange’s site has a wealth of fab CSS-only themes that are very easy to try by simply creating a New theme from the plugin and pasting his CSS in. Just tweak a few of the url links in the CSS to point to the classic skin and it’s game on. Speaking of which I think I missed one of the images in the simplexbubble port I posted above. Can’t remember if I fixed it or not.
A little off thread <snip>
Thanks for the links. I’ll give the plugins a whirl and see if smd_calendar / the core can benefit. Much obliged.
Last edited by Bloke (2009-06-14 21:31:16)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
Bloke —
Thanks for the heads up on packaging the themes into a one level directory. Good to know. In my case, it still was the lack of zip support. gzip/tars are fine, but even single level zips failed.
All —-
I don’t want to offend Jon or Dave, but realize that you have to have themes in order to play with the new toy. So, here are my quick and dirty ports of Jon Hick’s and Dave DeSandro’s themes. (Guys, if I’ve overstepped, I’ll gladly pull them down). There may be some bugs yet, but they seem to work well, and were quick to port.
Oh, and a quick suggestion, Bloke. I added a screenshot to your port of Dave’s simple_x_bubble and remora. That now gives me six themes w/ screenshots in the theme manager. And it’s feeling (to me), unwieldy. If you anticipate people keeping multiple themes installed, perhaps have the screenshots as expandable/collapsible might make it more manageable?
fwiw
Mike
Last edited by maverick (2009-06-15 00:30:05)
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
maverick
Thanks for the ports. That’s what I did with simplexbubble (and I did forget one of the images, sorry — I’ll try and fix that today). I’m sure when Dave / Jon do their official themes we can pull our versions from our sites and host the proper themes on Textgarden. In the meantime it is fun to experiment with porting themes using the plugin and does highlight some workflow issues such as…
six themes w/ screenshots in the theme manager. And it’s feeling (to me), unwieldy.
Very good point. 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.
How about I add an option in the prefs to allow you to set the thumb dimensions? They’ll be squished by the browser unfortunately — and we all know they make piss-poor attempts at resizing — but if you set either dimension to 0 the thumbs will be turned off.
EDIT: Like this new version with the same version number as before *cough cough* :-)
EDIT2: and I fixed the carver.gif in dds_simplexbubble. zip | tgz
Last edited by Bloke (2009-06-15 08:57:55)
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
I’ll give the new version a go around as soon as I have a chance. It probably won’t be an issue for most sites – they are likely to only have the three themes shipped by default, and one or two added by the user.
I think Wet’s got a good point about the screen shots being large enough to give some sense of what you are choosing, so it appears to UI needs are in conflict.
Tangent:
One other issue I’m having with themes (in general, not the plugin) is when I’m working on a theme and it pulls an error in the php. Up to now I’ve had to manually log into the site and remove the theme from the directory, then refresh the site. With no automatic failover to a “safe” theme” I can see potential for client panic if something goes wrong.
As of today, even after pulling the offending theme out of the directory (a port of aro_marine I’m playing with) I am unable to get back to a working theme. I’ll have to work on it later. Hopefully it won’t be too hard to fix :)
Edit: As much as I hate to suggest it, perhaps admin_themes should act like the plug in tabs, where the themes are disabled in case of emergency?
By the way, this was the error message I got after I removed the non-working theme: “cannot_instantiate_theme: aro_marine, aro_marine_theme, /path to website/textpattern/theme/aro_marine/aro_marine.php”
I went to the plugin tab, and disabled admin_themes, and was able to access the backend again. I think maybe the error above may be related to how the plugin is storing your selected theme?
I notice that:
- With the offending theme placed back in the theme directory
- The offending theme still chosen in the plugin (and throwing errors)
- Then the plugin disabled
- The backend defaults back to classic
So I’m guessing that the plugin is not changing the actual preference in admin->preferences but setting its own preference that overrides the actual preference?
Then I’m guessing that because of that, the “cannon_instantiate” error when removing the offending theme from the theme director is related to the plugin’s preference?
(Hope that all made sense . . .)
Last edited by maverick (2009-06-15 14:36:41)
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
update:
- Classic is the chosen theme under admin->preferences->advanced
- Turning the plugin back on continues to throw the “cannot_instantiate” error
So I’m guessing I’ll have to dig into the database and clear the plugin’s preference setting?
Thanks
Mike
Last edited by maverick (2009-06-15 13:29:21)
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
maverick
One other issue I’m having with themes (in general, not the plugin) is when I’m working on a theme and it pulls an error in the php.
Yes, TXP bails out. I’ve had that and it’s not very nice. It would, as you say, be good when — if a theme dies for whatever reason — it is just struck from the record until it’s fixed/plays nice again.
No idea if that’s possible. Will give it some thought but I think it would have to be a core feature. It is supposed to failover to classic, but it only does it if there are files missing or something obvious like that. Any syntax errors, or a missing dependency and it’s game over for your admin side.
_“cannot_instantiate_theme: aro_marine, …
Interesting. That happens if the aro_marine.php file is badly formed or missing. From r3209 onwards any attempt to initialize a non-available theme should drop back to classic. If the theme dir is readable but the class definition is somehow mangled you’ll see that error. Perhaps I need to verify the return value and bomb out if it fails; I’m probaby not doing that because I’m a dunce; I’ll check.
Out of interest, how did you remove the theme? Via FTP? Did you get rid of the whole directory or just the contents of the aro_marine folder?
So I’m guessing that the plugin is not changing the actual preference in admin->preferences but setting its own preference that overrides the actual preference?
Yes, sometimes. Because I’m not technically permitted to create a txp_pref called ‘theme_name’ for each user (all vars should be prefaced with my plugin prefix) I’m using smd_skin as a surrogate to keep track of the current theme per user. That is simply read on every page visit. Like a doughnut I’ve missed out the ‘what if the theme is missing’ check from here too. Will fix that, thanks for spotting it. Go into txp_prefs and remove smd_skin for your user (or set to classic) and it’ll return.
I do, however, update TXP’s theme_name under two conditions:
- if you delete the theme that is currently designated as global (the asterisked one in the list)
- save the admin_theme prefs
I’ll review the policies I’ve chosen and try to make the plugin more robust when themes generate errors. Thanks for your patience. In the meantime, don’t make any mistakes :-p
The smd plugin menagerie — for when you need one more gribble of power from Textpattern. Bleeding-edge code available on GitHub.
Hire Txp Builders – finely-crafted code, design and Txp
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
maverick wrote:
With no automatic failover to a “safe” theme” I can see potential for client panic if something goes wrong.
In fact, the core falls back onto the classic theme at certain conditions, e.g. the theme file is not readable, or does not contain a class following the naming convention.
We can add more error handling based on your suggestions. NB: We will handle errrors which might affect theme users – theme developers are knowledgable enough to handle typical under-development errors and would simply overwrite the theme_name prefs in the database in case something goes really belly-up.
Offline
Re: smd_admin_themes: Manage, edit, switch and share admin-side themes
Sorry wet and bloke – I didn’t mean to imply there was no fall back. I knew that in past efforts I could move the offending theme out and fall back to classic.
Here’s the actual process/details. (I’m typing quick — I’ve got another meeting, so hopefully its clear :D )
The actual error that the aro_marine port threw was
“Fatal error: Call to undefined method aro_marine_theme::messenger() in /home/.jabot/maverick/foundtrue.com/textpattern/theme/aro_marine/aro_marine.php on line 56”.
I’m pretty sure I can fix that easily enough when I have time (now watch me have to eat my words :D )
I used ftp to move the aro_marine folder out of the textpattern/theme directory
(actually, I have my “in progress” ports in an folder w/in the theme directory so I can easily move them in and out while working on them; therefore I actually moved it into a sub directory within textpattern/theme)
- W/ smd_admin_themes disabled, and
- aro_marine selected using textpattern->admin->preferences->advanced,
- I received the fatal error above.
- I move aro_marine back to my in progress folder via ftp
- I refresh the tab and receive the “cannot_instantiate_theme: aro_marine”
- I refresh the tab a second time and the theme falls back to classic as it should and has in the past.
The process is same with smd_admin_themes except that the second refresh doesn’t fall back to the classic theme. The “cannot_instantiate_theme:” is the on-going status.
I agree – you don’t have to plan for a fail safe for developers who should know what to do with errors.
Thinking Aloud
My thought is “what if a theme goes bad” and a client cannot ftp in to manually pull the bad theme and allow the fall back to the classic?”
Also, once the offending theme is removed, and they refresh, they initially get another error – “cannot_instantiate_theme:”. I imagine some clients would be in a panic and give up at this point. Would a client think to refresh a second time when they get the “cannot_instantiate_theme:”, so it falls back to the classic theme?
However, perhaps the likelihood of a working theme going bad is too low to worry about it? (possible causes: Corruption of the data? Changes in textpattern or a plugin?)
I did a quick check in the database for smd_skin, but didn’t see it yet. I’ll look when I have more time. And I’ll re-read your posts follow up on anything I missed.
Thanks!
Mike
Last edited by maverick (2009-06-15 20:37:59)
Offline
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.
Hire 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.
Hire 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.
Hire Txp Builders – finely-crafted code, design and Txp
Offline