Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#31 2009-03-22 21:26:28

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Admin Side Theming! (r3149)

Mmm. Downloaded latest SVN version via Transmit, but I don’t see the theme changer in Admin > Preferences > Advanced? Using MAMP on localhost, don’t know if that has something to do with it..

BTW, what is the preferred SVN URL? I always get problems with the app I use (SCPlugin) and this URL: svn checkout http://textpattern.googlecode.com/svn/development/4.0 dev

Offline

#32 2009-03-22 21:35:33

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,424
Website GitHub

Re: Admin Side Theming! (r3149)

jstubbs wrote:

I don’t see the theme changer in Admin > Preferences > Advanced?

Does this help?


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

#33 2009-03-22 23:02:40

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Admin Side Theming! (r3149)

Finally managed to get “A Bit Blue” working with this. :)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#34 2009-03-22 23:22:38

the_ghost
Plugin Author
From: Minsk, The Republic of Belarus
Registered: 2007-07-26
Posts: 907
Website

Re: Admin Side Theming! (r3149)

When the community wll select site/portal for sharing admin themes?
I hope, admin-theming will add more txp-lovers to our Planet-of-Txp


Providing help in hacking ATM! Come to courses and don’t forget to bring us notebook and hammer! What for notebook? What a kind of hacker you are without notebok?

Offline

#35 2009-03-23 02:29:30

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,416
Website GitHub Mastodon

Re: Admin Side Theming! (r3149)

mrdale wrote:

So In layman’s (pixel-pusher) terms, I can use a php file to replace the functions that contain markup in the head library? or could I dynamically replace the entire head library non-destructively?

Yes, you could. Dig into the Remora theme as an instance of how to change the navigation menu’s markup and include custom JS.

Though, in the most simple case when your custom theme involves only styling and custom images, you don’t even need to write a single line of code:

1. Choose a name for your theme. For illustration purposes, I’ll use foobar.

2. Create a new folder: /textpattern/theme/foobar/

3. Create a new file in this folder named foobar.php:

<?php
if (!defined('txpinterface')) die('txpinterface is undefined.');
theme::based_on('classic');
class foobar_theme extends classic_theme{}
?>

4. Create a file named textpattern.css in this folder and apply all your custom styles. You might choose to build your modifications on the ‘classic’ groundwork CSS, or start with a blank file – whatever seems more appropriate:

/* 
Foobar Theme for Textpattern CMS
*/

@import url("../classic/textpattern.css");

body{font-size: 7px;}

5. Done.

Offline

#36 2009-03-23 02:52:11

mrdale
Member
From: Walla Walla
Registered: 2004-11-19
Posts: 2,215
Website

Re: Admin Side Theming! (r3149)

Thanks wet!

Actually the Facelift changes the navigation to use a more semantic nested unordered list structure, so in the case it’d require markup to change.

I’ll dig in. check it out.

Offline

#37 2009-03-23 06:57:26

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,416
Website GitHub Mastodon

Re: Admin Side Theming! (r3149)

Bloke wrote:

Now, I would argue that a plugin is the right place for all this paraphernalia, but in order to work the core would have to check for the existence of a cookie first and try to find that theme — of course, dropping back to global/classic if not found. Once something like this (or an equivalent) is in place,

I elected to make something equivalent which delegates the actual implementation onto the strong shoulders of imaginative plugin authors while the TXP core suffers from a very low overhead for vanilla installs ;-)

You could start like so, and work your way upwards:

if (@txpinterface == 'admin') {
	register_callback('foo_theme_name', 'admin_side', 'theme_name');
}

function foo_theme_name($event, $step, $extra='')
{
	global $txp_user;
	return ($txp_user) ? 'classic' : 'remora';
}

Offline

#38 2009-03-23 07:03:42

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Admin Side Theming! (r3149)

Bloke wrote:

Does this help?

Yeah, tried that and it affected 0 rows, so it did not work. I don’t see any option for the theme switching in Advanced prefs.

Offline

#39 2009-03-23 07:09:29

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,416
Website GitHub Mastodon

Re: Admin Side Theming! (r3149)

jstubbs wrote:

I don’t see any option for the theme switching in Advanced prefs.

This is probably the odd case of a SVN checkout being younger than the modify date of the _update_xxx.php script. Try this:

UPDATE txp_prefs SET val= '0' WHERE name = 'dbupdatetime' ;

Offline

#40 2009-03-23 07:19:26

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Admin Side Theming! (r3149)

Thanks Robert – that query affected one row so it worked, but still not theme drop down select box (assuming that’s what it is).

Offline

#41 2009-03-23 07:25:24

wet
Developer Emeritus
From: Vöcklabruck, Austria
Registered: 2005-06-06
Posts: 3,416
Website GitHub Mastodon

Re: Admin Side Theming! (r3149)

Well, then we’d have to beat this stubborn thing into submission:

INSERT into txp_prefs SET prefs_id = 1, name = 'theme_name', val = 'classic', type = '1', event = 'admin', html = 'themename', position = '160';

Offline

#42 2009-03-23 08:46:42

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 12,424
Website GitHub

Re: Admin Side Theming! (r3149)

wet wrote:

I elected to make something equivalent which delegates the actual implementation onto the strong shoulders of imaginative plugin authors

Sweet as. You da man! I’ll have a play with this at some point, thanks.


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

#43 2009-03-23 14:47:10

variaas
Plugin Author
From: Chicago
Registered: 2005-01-16
Posts: 402
Website

Re: Admin Side Theming! (r3149)

If I accidentally activate a theme that isn’t working properly (i.e. causing a fatal error), is there anyway to revert back to the original theme through TXP? Right now I’m just going into the DB and changing the entry manually. Let me know if I’m missing something.

Offline

#44 2009-03-23 14:53:35

thebombsite
Archived Plugin Author
From: Exmouth, England
Registered: 2004-08-24
Posts: 3,251
Website

Re: Admin Side Theming! (r3149)

Amit – You can delete the offending theme files then do a refresh which should bring back the Classic theme. Then re-upload your theme files and start again.

Last edited by thebombsite (2009-03-23 14:54:03)


Stuart

In a Time of Universal Deceit
Telling the Truth is Revolutionary.

Offline

#45 2009-03-23 18:33:30

jstubbs
Member
From: Hong Kong
Registered: 2004-12-13
Posts: 2,395
Website

Re: Admin Side Theming! (r3149)

wet wrote:

INSERT into txp_prefs SET prefs_id = 1, name = 'theme_name', val = 'classic', type = '1', event = 'admin', html = 'themename', position = '160';

Thanks for the SQL. I entered it and now see a text option for the theme:

theme_name classic

Its not a drop down box. Should be, correct?

Offline

Board footer

Powered by FluxBB