Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#121 2009-06-11 22:43:55

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

Re: Admin Side Theming! (r3149)

Can’t find where in Remora current author is placed… If it’s not yet, than would be useful if author name is wrapped by some tag, like <span id="author">ghost</span>.


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

#122 2009-06-18 17:13:45

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: Admin Side Theming! (r3149)

It is possible to put breadcrumb navigation in a theme?

I’d like to edit the remora theme to include breadcrumbs as i’ve added a new dashboard tab. So it would put like this.

Dashboard > Content > Images

The breadbrumb would ideally be links to. I’m no PHP expert so any help is much appreciated.

Offline

#123 2009-06-18 17:52:11

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Admin Side Theming! (r3149)

FireFusion wrote:

It is possible to put breadcrumb navigation in a theme?

Yes. I made a theme called breadcrumb and put this code in breadcrumb.php:

<?php

if (!defined('txpinterface')) die('txpinterface is undefined.');

theme::based_on('classic');

class breadcrumb_theme extends classic_theme
{
	function html_head()
	{
		$js = <<<SF
			$(document).ready( function() {
				$("#nav li").hover( function() { $(this).addClass("sfhover"); }, function() { $(this).removeClass("sfhover"); } );
			});
SF;
		return parent::html_head().n.script_js($js).n;
	}

	function header()
	{
		global $txp_user;
		$out[] = '<div id="masthead"><ul id="nav">';
		$crumb = array();
		foreach ($this->menu as $tab)
		{
			$class = ($tab['active']) ? 'tabup active' : 'tabdown inactive';
			if ($tab['active']) {
				$crumb[0] = array("lbl" => $tab['label'], "evt" => $tab['event']);
			}
			$out[] = "<li class='primary {$class}'><a href='?event={$tab['event']}'>{$tab['label']}</a>";
			if (!empty($tab['items']))
			{
				$out[] = '<ul>';
				foreach ($tab['items'] as $item)
				{
					$class = ($item['active']) ? 'tabup active' : 'tabdown2 inactive';
					if ($item['active']) {
						$crumb[1] = array("lbl" => $item['label'], "evt" => $item['event']);
					}
					$out[] = "<li class='secondary {$class}'><a href='?event={$item['event']}'>{$item['label']}</a>";
				}
				$out[] = '</ul>';
			}
			$out[] = '</li>';
		}
		$out[] = '<li id="view-site" class="primary tabdown inactive"><a href="'.hu.'" target="_blank">'.gTxt('tab_view_site').'</a></li>';
		if ($txp_user) $out[] = '<li id="logout" class="primary tabdown inactive"><a href="index.php?logout=1" onclick="return verify(\''.gTxt('are_you_sure').'\')">'.gTxt('logout').'</a></li>';
		$out[] = '</ul></div>';
		$out[] = '<div id="messagepane">'.$this->announce($this->message).'</div>';

		// Breadcrumb output start
		$crumbout = array();
		foreach($crumb as $critem) {
			$crumbout[] = '<a href="?event='.$critem['evt'].'">'.$critem['lbl'].'</a>';
		}
		array_unshift($crumbout, '<a href="?event=dashboard">Dashboard</a>');
		$out[] = '<div class="crumbnav">'.join(' &raquo ', $crumbout).'</div>';
		// Breadcrumb output end

		return join(n, $out);
	}

	function footer()
	{
		return '<div id="end_page">'.n.
			'<a href="http://textpattern.com/" id="mothership"><img src="theme/classic/carver.gif" width="60" height="48" border="0" alt="" /></a>'.n.
			graf('Textpattern · '.txp_version).n.'</div>';
	}

	function manifest()
	{
		global $prefs;
		return array(
			'author' 		=> 'Team Textpattern',
			'author_uri' 	=> 'http://textpattern.com/',
			'version' 		=> $prefs['version'],
			'description' 	=> 'Textpattern Remora Theme',
			'help' 			=> 'http://textpattern.com/admin-theme-help',
		);
	}
}
?>

It’s a bit convoluted and there’s undoubtedly a better way. Just decide where you want the nav to sit (move the bit between breadcrumb output start and breadcrumb output end.


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

#124 2009-07-01 10:04:20

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: Admin Side Theming! (r3149)

I’m having a problem in Firefox 3.5 with Remora. If you move off the dropdown menu at certain angles (or maybe speeds) they don’t close until you rehover and move off again. It’s very annoying.

Offline

#125 2009-07-01 19:25:59

Bloke
Developer
From: Leeds, UK
Registered: 2006-01-29
Posts: 11,271
Website GitHub

Re: Admin Side Theming! (r3149)

FireFusion wrote:

with Remora. If you move off the dropdown menu at certain angles (or maybe speeds) they don’t close until you rehover and move off again.

I noticed that. I think it’s a speed thing and it is a bit of a pest. I tried to implement a theme that delayed the onset of the dropdown by a couple of hundred milliseconds (a bit like hoverintent) but I couldn’t get it to work properly :-( If anyone knows a neat way of doing this it’d be cool.


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

#126 2009-07-03 19:55:46

FireFusion
Member
Registered: 2005-05-10
Posts: 698

Re: Admin Side Theming! (r3149)

Wet you’ll need to turn the z-index up on the dropdowns of the remora theme. Plugin’s like Rah_sitemap show content over the top of them.

Offline

#127 2009-07-04 00:45:27

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

Re: Admin Side Theming! (r3149)

If we all really wish with all our might, maybe there won’t be any more MS browsers.

Offline

#128 2009-07-04 04:53:30

TheEric
Plugin Author
From: Wyoming
Registered: 2004-09-17
Posts: 566

Re: Admin Side Theming! (r3149)

I’ve been looking at the code, and I’m a little concerned – It looks like there is different markup between themes and that’s actually pretty bad for consistency and plugin compatibility. Am I going to have to write different a different plugin “hook” for each theme?

How is this being handled?

Offline

#129 2009-07-04 05:40:26

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: Admin Side Theming! (r3149)

I think we’ve got most of the bases covered with register_tab(), the various events sent by all pluggable_ui() instances, and the admin-side events from pre-4.2.0. What additional hook would you suggest? All ears…

Offline

#130 2009-07-04 05:44:21

TheEric
Plugin Author
From: Wyoming
Registered: 2004-09-17
Posts: 566

Re: Admin Side Theming! (r3149)

I mean DOM style hooks. If there isn’t consistent HTML between admin pages, creating plugins that use JS to manipulate the html is going to prove problematic.

Offline

#131 2009-07-15 23:23:54

TheEric
Plugin Author
From: Wyoming
Registered: 2004-09-17
Posts: 566

Re: Admin Side Theming! (r3149)

….any thoughts on the above?

Offline

#132 2009-07-24 10:00:59

wet
Developer Emeritus
From: Schoerfling, Austria
Registered: 2005-06-06
Posts: 3,323
Website Mastodon

Re: Admin Side Theming! (r3149)

r3255 introduces theme-independent events for header and footer. Theme-independent DOM hooks were a contradiction per se, as the purpose of themes is to render specific HTML.

Offline

Board footer

Powered by FluxBB