Textpattern CMS support forum
You are not logged in. Register | Login | Help
- Topics: Active | Unanswered
Pages: 1
Admin Theme : How to
Hello all,
I’m working on my first admin theme – and I’m in need of a small bit of PHP help.
Just beneath my navigation I’m looking for a way to output the name of the current sub-tab.
ie: <h1>Write</h1>
I’m a bit out of my depth, so any help would be much appreciated.
P.S. Devs, any plans on extending the pluggable_ui to the articles tab?
—
Tom
Offline
Re: Admin Theme : How to
Hi Tom,
I wanted to do something similar a few months back and Stef showed me a way to do what you are asking, though it wasn’t quite what I was trying to do. In your theme php file where the menu is being generated, you need to check if the current tab is active and if so place its label into a string, e.g. the if ($item['active'])
section in the middle of this snippet from remora:
$out[] = '<ul>';
foreach ($tab['items'] as $item)
{
$class = ($item['active']) ? 'tabup active' : 'tabdown2 inactive';
if ($item['active']) {
$current_page = $item['label'];
}
$out[] = "<li class='secondary {$class}'><a href='?event={$item['event']}'>{$item['label']}</a></li>";
}
$out[] = '</ul>';
and then you can output that variable, for example, if it is to be at the top of the pane, then place it beneath the messagepane:
$out[] = '<div id="messagepane">'.$this->announce($this->message).'</div>';
$out[] = '<h1>'.$current_page.'</h1>';
—————
FWIW I was trying to do almost exactly the same thing, except that I wanted to show $pagetitle
(what you see in the page title tag / window bar) which is more informative than the tab label. I couldn’t find a way to do this without a (very simple) hack that passes $pagetitle to the theming functions:
In txplib_head.php
add $pagetitle to set_state to pass it to make it available for theming (around line 182 just before pluggable_ui is echoed):
$theme->set_state($area, $event, $bm, $pagetitle, $message);
In txplib_theme.php
add $pagetitle to the corresponding set_state function and define it:
function set_state($area, $event, $is_popup, $pagetitle, $message)
{
$this->is_popup = $is_popup;
$this->message = $message;
$this->pagetitle = escape_title($pagetitle);
...
In your theme’s php file in function header, you just need to add $pagetitle to the line beginning global.
function header()
{
global $sitename,$txp_user,$pagetitle;
...
and then you can use $pagetitle whereever you like:
$out[] = n.'<h1 class="pagetitle">'.$this->pagetitle.'</h1>';
And a sample of how it looks:
Maybe the Devs would entertain adding the ability to pass $pagetitle for theming.
Or: some clever person can show me another way to do the same…
Last edited by jakob (2010-06-02 20:38:13)
TXP Builders – finely-crafted code, design and txp
Offline
Re: Admin Theme : How to
Jakob,
You are insanely helpful – as always. :)
You’re right $pagetitle
would be great. For now you have helped me a ton as I’m trying to build admin themes that don’t require any hacking – although it’s really tempting. :)
On that note – have you had any luck creating a 2 column layout on the write tab using the pluggable_ui?
I’d like to implement some of the ideas I’ve been working on for the xpat theme
http://www.tomrenodesign.com/development/xpattern
Thanks again.
:)
Offline
Re: Admin Theme : How to
You are insanely helpful
BTW: I found the source from which the above was extracted in one of Stef’s posts on a breadcrumb theme.
On that note – have you had any luck creating a 2 column layout on the write tab using the pluggable_ui?
Aside from using css to hide one column or jquery dom-relocation trickery after page render, when I last asked this was not yet possible but may be in future – see this thread topic.
http://www.tomrenodesign.com/development/xpattern
nice, I’d forgotten about that.
TXP Builders – finely-crafted code, design and txp
Offline
Re: Admin Theme : How to
renobird wrote:
P.S. Devs, any plans on extending the pluggable_ui to the articles tab?
Depends. What would you propose?
Last edited by wet (2010-06-03 10:15:17)
Offline
Re: Admin Theme : How to
Hi Wet,
I’d love to have to ability to make an interface switcher (via jquery tabs probably).
Maybe the current view could be “classic mode” so that any plugins that rely on that markup would still work correctly.
My goal would be to create a view of articles that is similar to what stm_article_order does.
Essentially a sortable list of articles by section. True – that can already be done (sort of) with a plugin – but I’m sure there are a lot of other options out there for creating an alternate view of articles.
Just my 2 cents. :)
—
Tom
Offline
Re: Admin Theme : How to
Bump. Any thoughts on letting us get our grubby little mitts on the article tab?
Offline
Re: Admin Theme : How to
renobird wrote:
I’d like to implement some of the ideas I’ve been working on for the xpat theme
http://www.tomrenodesign.com/development/xpattern
A lot of nice fantastic stuff in that theme… if we could only get that in txp.
Last edited by JanDW (2010-06-11 15:58:05)
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
Re: Admin Theme : How to
Thanks Jan,
I’m hard at work on a TXP theme that incorporates as much of that stuff as I can. It’s a bit of a “head to desk” process.
—
Tom
Offline
Re: Admin Theme : How to
Cool – Isn’t webdev usually about wanting to bludgeon your own skull? If you’d need a beta tester at some point, I’m up for it.
TXPDream – A Textpattern Tag Library for Adobe Dreamweaver. (updated for 4.2.0) | jdw_if_ajax – Only serve certain parts of a page when requested with AJAX
Offline
Pages: 1