Highlighting fly-out menu items

Hello, Is there an easy way to highlight text or background of text within the fly-out menu? What I was trying to do was to either change the font color of the text or change the background color for a portion of my Tropical Storms menu item indicating there is an active storm.

Thank you,
Paul


Screen shot 2010-07-22 at 9.55.16 PM.png

Really easy, no, but it is possible.

make a copy of your flyout-menu.xml to flyout-menu-test.xml
edit flyout-menu-test.xml and change the line

	<item caption="Tropical Storms" link="wxTropical.php" title="Tropical Storm Activity"/>

to

	<item caption="Tropical Storms &lt;span style=&quot;color: red&quot;&gt;*Active Storm*&lt;/span&gt" link="wxTropical.php" title="Tropical Storm Activity"/>

save flyout-menu-test.xml

decide how you want to signal that a storm is active … maybe by adding a variable in Settings.php like

$SITE['stormactive'] = true; // =false when no storm

Edit menubar.php

 if (isset($SITE['flyoutmenu']) and $SITE['flyoutmenu']) {
   global $FlyoutMenuText;

and change to be

 if (isset($SITE['flyoutmenu']) and $SITE['flyoutmenu']) {
   global $FlyoutMenuText;
   if(isset($SITE['stormactive']) and $SITE['stormactive']) { $_REQUEST['menu'] = 'test'; }

which will cause the flyout-menu-test.xml to be loaded instead of the flyout-menu.xml as long as $SITE[‘stormactive’] == true;

Not so hard after all :slight_smile:

Best regards,
Ken

How would one know if there is tropical activity? Does someone have an idea based on the current common scripts?

It would probably be easier to trigger something like that for warnings than tropical activity, right?

Ken, thank you for showing me the way, much appreciated.

Mike and Tony, For now I was looking for a way to manually set this in motion, although a trigger would be great. I think Tony’s idea of utilizing the warnings, or maybe advisories would be a good starting point, having the ability to choose between Atlantic or Pacific advisories as the trigger. I am not good with php so I am unable to contribute to any possible creation of such a script. I truly appreciate the work that is provided by all you who know php scripting and are so willing to share it - thank you.

Add: Mike, how do you generate the warning symbol in your Storms item of the fly-out menu?

Maybe this link will help with that…

Thank you Mark!

Hi Ken, I made the changes you suggested and I am not seeing the expected results. I believe I set everything properly, would you mind taking a look when time allows?

Thank you,
Paul

Oops… I had typed two XML errors. :oops: #-o

The line should read

	<item caption="Tropical Storms &lt;span style=&quot;color: red&quot;&gt;*Active Storm*&lt;/span&gt;" link="wxTropical.php" title="Tropical Storm Activity"/>

Try that instead in flyout-menu-test.xml

Sorry!

Best regards,
Ken

Also… see this topic about a newer flyout-menu.php that supports target=“…”, img=“…” in the menu defs.

Hi Ken, no change. Possibly I have not set the variable properly in Settings.php? Here is where I placed it:

#############################################
$SITE[‘flyoutmenu’] = true; // set to false to use classic menubar.php instead

$SITE[‘stormactive’] = true; // =false when no storm

$SITE[‘clientrawfile’] = ‘./clientraw.txt’; // relative FILE location of clientraw.txt

Configurable Carterlake/WD/PHP template Site Settings

############################################################################

I have not had a moment yet to download your new fly-out script, maybe that will be the answer :wink:

Thank you,
Paul

Hmmm…

It does show with http://www.medfieldweather.com/?menu=test

Did you make the change to menubar.php also? Please copy menubar.php to menubar.txt and attach it to a post.

Your Settings.php entry looks fine.

You can change flyout-menu.xml from

	<item caption="Tropical Storms *Active Storm*" link="wxTropical.php" title="Tropical Storm Activity"/>

to

	<item caption="Tropical Storms" link="wxTropical.php" title="Tropical Storm Activity"/>

so the Active Storm will show better.

Did you make the change to menubar.php also? Please copy menubar.php to menubar.txt and attach it to a post.

It looks good looking at it in the menu=test view.
Here is the menubar.txt


menubar.txt (11.4 KB)

Ah… silly me. The

   if(isset($SITE['stormactive']) and $SITE['stormactive']) { $_REQUEST['menu'] = 'test'; }   

doesn’t go in the menubar.php, but in the top.php. By the time menubar.php is loaded, top.php has already invoked the script and it’s a done-deal which menu is used.

So remove that line from menubar.php, and edit top.php

  global $FlyoutCSS, $FlyoutMenuText;
  include_once('flyout-menu.php');

to be

  global $FlyoutCSS, $FlyoutMenuText;
  if(isset($SITE['stormactive']) and $SITE['stormactive']) { $_REQUEST['menu'] = 'test'; }   
  include_once('flyout-menu.php');

Sorry about that… :oops: #-o

Best regards,
Ken

That did it Ken! :smiley: Thank you.

Now, if I download the newer fly-out script you just made available does any of this change?

Thanks again,
Paul

Paul,
Yes, you can just replace the flyout-menu.php on your site with the correct version (English-only or multilingual) based on your template type. Nothing else needs to change :slight_smile:

Sorry for the miscue about updating menubar.php when what was needed was to update top.php instead.

But… I’m glad it’s working for you!

Best regards,
Ken