1 of 3
1
Extension: Add Site Name (to Control Panel header) The original! ;-)
Posted: 25 June 2007 07:18 PM   [ Ignore ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1578
Joined  03-26-2006

I finally got the urge to read the Extension development docs and sift through a billion forum posts to find out how to do an extension. Go easy on me, please - this is my first extension!

Reason For Being:

I found that I am often in more than one website control panel at a time, in different tabs, and that I get a bit confused sometimes because the name of the site isn’t jumping out at me. Occasionally I’m on the wrong tab, etc. Anyway, I wrote this extension to put the name of the site at the upper left of the Control Panel header.

Again, this is my first extension, so any advice from seasoned pros would be more than welcome.

Version 1.1.5 (Mar 21 2008):
Updated to account for sites using .png instead of .ico for the favicon. Good to know this will no longer be needed in 2.0 - but not everyone is going to update immediately, so there is still a need!

Version 1.1.4 (Nov 18 2007):
Changed $siteurl variable. Favicon path seemed to be not working in certain cases. Let me know if it’s not working for you.
111 downloads

Version 1.1.3 (Sep 15 2007):
Added the ability to make the text italic. (Thanks Hambo)
59 downloads

Version 1.1.2 (Jul 15 2007):
Added the ability to show a site’s favicon next to the text.
111 downloads

Version 1.1.1 (Jul 13 2007):
Added setting for overriding the default site name. You can make the text say whatever you want. Might be handy to designate “development” sites, shorten a real long name, play a prank, or whatever you like.

Version 1.1.0 (Jul 08 2007):
Added settings for font-size, making the site name a link to your site’s homepage, color, font-weight, font-family, and padding on the top and the bottom (in case changing the size of the text messes the layout up at all).

Version 1.0.2 (Jul 06 2007):
Added ‘stripslashes’ for site names with apostrophes.

Version 1.0.1 (Jun 25 2007):

- I’ve only tested this on Firefox and Safari for Mac. I was too lazy to fire up Parallels and test in IE. Any bugs or problems with the styles in other browsers? Just let me know, and I’ll update.

- I haven’t tested this on a Multi-Site managed installation, but I imagine it would work fine.

- Not sure what would happen if you had a ton of extra links at the right, but I’ll cross that bridge when I get to it.

See the attached pic to see what it actually looks like in Firefox.

The download for this is now located at its designated page over at masugadesign.com: http://www.masugadesign.com/the-lab/scripts/add-sitename/

Image Attachments
ext_sample.pngversion115.png
Click thumbnail to see full-size image
 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 25 June 2007 07:46 PM   [ Ignore ]   [ # 1 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  298
Joined  01-20-2006

Works like a charm for me buddy o pal.

 Signature 

AJ Penninga
Pretty Squares, LLC - http://www.prettysquares.com

Profile
 
 
Posted: 25 June 2007 08:33 PM   [ Ignore ]   [ # 2 ]  
Research Scientist
Avatar
RankRankRankRankRankRank
Total Posts:  6026
Joined  08-04-2002

This looks useful, I’m always getting confused when multiple sites are open.

Profile
 
 
Posted: 25 June 2007 09:29 PM   [ Ignore ]   [ # 3 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  298
Joined  01-20-2006

A few notes after having in my CP for the evening.
It’s nice, and readable, but doesn’t really stand out.

If/when you add settings to it, allow an option to make it clickable to your {site_url}
An image to “brand” the CP easily.
Font-size, bold, and other style changes to it?
Maybe some other simple CSS rules to easy brand the header without creating a theme?

 Signature 

AJ Penninga
Pretty Squares, LLC - http://www.prettysquares.com

Profile
 
 
Posted: 25 June 2007 09:37 PM   [ Ignore ]   [ # 4 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1578
Joined  03-26-2006

Keep those ideas coming. I could use some practice with extension settings.

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 26 June 2007 12:24 AM   [ Ignore ]   [ # 5 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  106
Joined  04-14-2004

Nice, Thank you

Works well in 1.6.

But see the picture what happens in 1.5.2. There is a white space.

Image Attachments
add_sitename_screen.gif
Click thumbnail to see full-size image
 Signature 

Werner Gusset | http://www.octave2media.ch

Profile
 
 
Posted: 26 June 2007 01:59 AM   [ Ignore ]   [ # 6 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1516
Joined  01-05-2007

What a great idea!

I tested it in EE 1.6 using IE6 for you and it works fine.

PS. I second the ability to add a logo there. Perhaps you can add some size rules?

 Signature 

 
Steven Hambleton | ExpressionEngine Development for Web & Graphic Design Agencies

Profile
 
 
Posted: 26 June 2007 02:04 AM   [ Ignore ]   [ # 7 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  106
Joined  04-14-2004

Using FF on XP.

Any hint where to size?

 Signature 

Werner Gusset | http://www.octave2media.ch

Profile
 
 
Posted: 26 June 2007 11:12 AM   [ Ignore ]   [ # 8 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1578
Joined  03-26-2006
Werner Gusset - 26 June 2007 02:04 AM
Using FF on XP. Any hint where to size?

You want to size the text? I’m thinking of adding a few settings (never tried those yet…). I should note that I’ve never tested this with any CP theme other than 31three or the new default in EE 1.6 - hence the line you were seeing.

Does anyone know of a hook for the login page? It would be nice to have this show up at the top of the login page as well as once inside the CP.

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 26 June 2007 06:00 PM   [ Ignore ]   [ # 9 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  123
Joined  05-25-2002

Iam running EE 1.6 Build: 20070622 but I can’t see any Site Name in Control Panel header. What’s strange? I’ve installed extension properly.

 Signature 

Caleydon Media

+ CM Strange URL Interpreter
+ CM Textarea Resizer
+ CM Template Editor (EditArea)

Profile
 
 
Posted: 26 June 2007 06:03 PM   [ Ignore ]   [ # 10 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  123
Joined  05-25-2002

Somewhere this script extension but somewhere not…

 Signature 

Caleydon Media

+ CM Strange URL Interpreter
+ CM Textarea Resizer
+ CM Template Editor (EditArea)

Profile
 
 
Posted: 26 June 2007 08:27 PM   [ Ignore ]   [ # 11 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1578
Joined  03-26-2006
Gabriel - 26 June 2007 06:03 PM
Somewhere this script extension but somewhere not…

Don’t quite understand that part, sorry! What should the site name be? All this Ext does is take what is found in this field:
CP Home > Admin > System Preferences > General Configuration > Name of Your Site

and put it in the header. Is yours blank for some reason? grin

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 27 June 2007 10:05 PM   [ Ignore ]   [ # 12 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1516
Joined  01-05-2007
mdesign - 26 June 2007 08:27 PM
Gabriel - 26 June 2007 06:03 PM
Somewhere this script extension but somewhere not…

Don’t quite understand that part, sorry! What should the site name be? All this Ext does is take what is found in this field:
CP Home > Admin > System Preferences > General Configuration > Name of Your Site

and put it in the header. Is yours blank for some reason? grin

It shouldn’t be as EE won’t let you setup a site without a site name.

 Signature 

 
Steven Hambleton | ExpressionEngine Development for Web & Graphic Design Agencies

Profile
 
 
Posted: 06 July 2007 03:56 AM   [ Ignore ]   [ # 13 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  130
Joined  06-10-2006

Thanks Ryan, smart plug!

Do you think you could add some styling to it? My prefs would be simply to have the same font size as the EE version title..

 Signature 

He who thinks he knows, doesn’t know but he who knows he doesn’t know, knows.
J.C.

Profile
 
 
Posted: 06 July 2007 07:38 AM   [ Ignore ]   [ # 14 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1578
Joined  03-26-2006

I do have a version 1.0.2 that strips slashes on site names with apostrophes (just updated that in the first post - not a critical update). I am planning on trying my hand at extension settings with this one, but I’m a little jammed with projects at the moment. I could probably add a preference for everything you might want to style, with the defaults set like it is now. Some things you could probably tweak:

font-family (dropdown)
font-size (number)
font-weight (bold, normal)
color (hex value)
link (yes/no - would link the text to your site’s homepage)
logo (this would be tricky and would probably have a lot of constraints, but I think it would be cool!)

While I’m at it, if anyone knows how I could get these changes into the top of the Control Panel login page (is there a hook or something?) that would be helpful. I’d like the top of the login page to be similar to the top of the Control Panel if this extension is installed. Is that not possible? Or should I do a SAEF or something?

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 07 July 2007 06:21 AM   [ Ignore ]   [ # 15 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  123
Joined  05-25-2002
mdesign - 26 June 2007 08:27 PM
Gabriel - 26 June 2007 06:03 PM
Somewhere this script extension but somewhere not…

Don’t quite understand that part, sorry! What should the site name be? All this Ext does is take what is found in this field:
CP Home > Admin > System Preferences > General Configuration > Name of Your Site

and put it in the header. Is yours blank for some reason? grin

I’m disabled Clone Entries (v.1.0) extension, and Site Name shown. Could you check both extension where is the conflict? Thank you.

 Signature 

Caleydon Media

+ CM Strange URL Interpreter
+ CM Textarea Resizer
+ CM Template Editor (EditArea)

Profile
 
 
Posted: 07 July 2007 08:34 AM   [ Ignore ]   [ # 16 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1578
Joined  03-26-2006
Gabriel - 07 July 2007 06:21 AM
I’m disabled Clone Entries (v.1.0) extension, and Site Name shown. Could you check both extension where is the conflict? Thank you.

Ahh! My first extension conflict. I’ll take a look at that other extension and see what I might have done incorrectly. Thanks for pointing it out.

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 08 July 2007 02:33 PM   [ Ignore ]   [ # 17 ]  
Lab Technician
Avatar
RankRankRankRank
Total Posts:  1578
Joined  03-26-2006

I just updated this extension to version 1.1.0 (see top of thread), which now has settings for font-size, making the site name a link to your site’s homepage, color, font-weight, font-family, and padding on the top and the bottom (in case changing the size of the text messes the layout up at all). I attached a pic showing a sample modified site name in bold, light green Trebuchet at 16px.

I looked a little bit at the extension conflict with Cloner, and all I could see was that where they’re using the same hook as I am, it doesn’t look like they used the last call code you’re supposed to use:

if($EXT->last_call !== false)
{
  $out
= $EXT->last_call;
}


I could be totally wrong though, as I’m still new at writing extensions. If I figure out anything, I’ll let you know.

UPDATE: As far as I could tell in Cloner, around line 181 is this:

$DB->query($DB->insert_string('exp_extensions',
                array(
                
'extension_id'    => '',
                
'class'            => "Cloner",
                
'method'        => "remove_entryid",
                
'hook'            => "show_full_control_panel_end",
                
'settings'        => "",
                
'priority'        => 10,
                
'version'        => $this->version,
                
'enabled'        => "y"
                
)
            )
        );


Changing the ‘priority’ line from 10 to 9 works for me:

'priority'        => 9,


I’m not entirely sure what that did though, but it does get them to play nice together.

 Signature 

ryan masuga
—————
Masuga Design | Member, EE Pro Network
My EE Add-Ons | {devot:ee}
Twitter: masuga | masugadesign | devot_ee

Profile
 
 
Posted: 08 July 2007 05:15 PM   [ Ignore ]   [ # 18 ]  
Lab Assistant
Avatar
RankRank
Total Posts:  123
Joined  05-25-2002

mdesign: yeah, either works fine. Great job!

What’s about possibility adding the graphic logo of the site before the name or allowing show logo alone?

 Signature 

Caleydon Media

+ CM Strange URL Interpreter
+ CM Textarea Resizer
+ CM Template Editor (EditArea)

Profile
 
 
   
1 of 3
1
 
Post Marker Legend
New Topic New posts Hot Topic Hot Topic with new posts New Poll New Poll Moved Topic Moved Topic Sticky Topic Sticky topic
Old Topic No new posts Hot Old Topic Hot Topic with no new posts Old Poll Old Poll Closed Topic Closed Topic Announcement Announcements
Theme
Change Theme
Visitor Statistics
The most visitors ever was 1149, on July 16, 2007 10:33 AM
Total Registered Members: 62588 Total Logged-in Users: 22
Total Topics: 77048 Total Anonymous Users: 8
Total Replies: 416157 Total Guests: 120
Total Posts: 493205    
Members ( View Memberlist )