Jump to content

How is this site doing the Memorial Day thing at the top?


socceronly
 Share

Recommended Posts

I agree, it's striking and can't be missed.

One line of text and pick the color of text & background.

Oh and just for the hell of it,  the ability to make it blink in different colors for specific members groups or users just to bug the hell out of them.

Edited by socceronly
Link to comment
Share on other sites

open global template

before: 

 

<div id='ipsLayout_header' class='ipsClearfix'>
 
add:
<div id="top_message">this is a test message.</div>
you then add this to custom css
#top_message{background:#f5ceaf;padding:10px;font-size:14px;color:#573418;text-align:center;}
Edited by Dermot
Link to comment
Share on other sites

open global template

before: 

 

<div id='ipsLayout_header' class='ipsClearfix'>
 
add:
<div id="top_message">this is a test message.</div>
you then add this to custom css
#top_message{background:#f5ceaf;padding:10px;font-size:14px;color:#573418;text-align:center;}

​Will this add a section in the admin CP where you can turn it off and on? Or will this have to be edited each time? 

Link to comment
Share on other sites

​Will this add a section in the admin CP where you can turn it off and on? Or will this have to be edited each time? 

​edited each time, you could also use font awesome to add a pre icon to message

like..

<div id="top_message"><i class="fa fa-lightbulb-o"></i> this is a test message.</div>

this adding a lightbulb to front of message

you can find more font awesome icons to use at http://fortawesome.github.io/Font-Awesome/icons/#new

Link to comment
Share on other sites

Install topmessage.xml as plugin and njoy:)

 

http://screencast.com/t/uW4ou0niQ

 

 

Howto for plugin coders:

 

  1. Create plugin
  2. Create a setting to save the text (plugin devcenter => settings tab). I'm using daniel_topmessage as name. Try to use something unique!
  3. Rename settings file from settings.example.php to settings.php and create your settings form
    //<?php
    
    $form->add( new \IPS\Helpers\Form\Editor( 'daniel_topmessage', \IPS\Settings::i()->daniel_topmessage, FALSE, array( 'app' => 'core', 'key' => 'Admin', 'autoSaveKey' => 'daniel_topmessage') ) );
    
    if ( $values = $form->values() )
    {
    	$form->saveAsSettings();
    	return TRUE;
    }
    
    return $form;
  4. Create theme hook for the globalTemplate and add your custom code to top of the body 
     
    {{if \IPS\Settings::i()->daniel_topmessage != ''}}
    <div id='top_message'>{{ $var = \IPS\Settings::i()->daniel_topmessage; }}{$var|raw}</div>
    {{endif}}
  5. create a css file in your plugin/dev/css directory
    my code:

    #top_message {
    	background: #f5ceaf;
    	padding: 10px;
    	font-size: 14px;
    	color: #573418;
    	text-align: center;
    }
    
    #top_message :first-child  {
    	margin-top: 0 !important;
    	margin-left: 0 !important;
    	margin-bottom: 0 !important;
    }

    The first-child part isn't really necessary, but it's just a quick unofficial plugin, so i didn't want to spend too much time with this...
    The problem is, that the editor is saving the text in an paragraph, that's why I'm using the :first-child selector to remove the margin.. :D

enjoy your cool plugin

Edited by Daniel F
Link to comment
Share on other sites

  • 6 months later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...