javascript - Display text after empty RSS feed -


i new php , hoping can help.
have been able rss feed , running pulling different code on internet.
trying achieve is, if rss feed empty, display message "there no current warnings"
if there items in rss feed, display item, along div below set hidden.

<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" dir="ltr" lang="en"> <head> <title>weather warnings queensland - issued bureau of meteorology</title></head> <link type="text/css" href="rss-style.css" rel="stylesheet"> </head> <script type="text/javascript">     window.setinterval (blinkit, 500);     var color = "#0000ff";     function blinkit () {         var blink = document.getelementbyid ("blink");         color = (color == "#fa000c")? "#0000ff" : "#fa000c";         blink.style.color = color;     } </script>  <body bgcolor="#999"> <h1>weather warnings queensland - issued bureau of meteorology</h1> <hr>  <br>  <!-- display current weather warnings -->  <fieldset class="rsslib"> <?php require_once("rsslib.php"); $url = "http://www.bom.gov.au/fwo/idz00056.warnings_qld.xml";     echo rss_display($url, 3, false,  true)      //if there no warning, display text saying "there no current warnings"     // if there warnings, display rss, , display below wrapper blinking text. ?> </fieldset>   <!---------------------------- echo "there no current weather warnings" ---------------------------------->   <!-- put blinking text, not set display when there warning-->       <div id='wrapper' style="display: none">     <div id="blink">         current weather warning!     </div>      <div id="direction">         please go www.bom.gov.au more details.     </div> </div>  </body>     </html> 

any appreciated, can copy in rsslib.php if need be??

when call rss_display, instead of displaying immediately, store return value in variable. can test whether it's empty string (nothing display) or not, , act accordingly:

$rss = rss_display($url, 3, false, true); if ($rss == '') {     // nothing shown, whatever want } else {     // display     echo $rss;     // can add other stuff here } 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -