Jump to content

calivw78

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

calivw78's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. I've been posting at the support forums for the Magic Fields plugin, but have not had much luck. The Magic Fields plugin for Wordpress let's users create custom fields that can be displayed in a page template. What I am trying to do, is wrap the contents of a field in an href tag, to make it clickable. Here is how the data is currently retrieved and displayed in the page template: <?php echo get('field-name'); ?> What I would like to do, is wrap the content of "field-name" in an href tag so it may be clickable. Anyone have any thoughts? Thanks in advance...
  2. Oh, and the XML parsing didn't want to play nice until I upgraded from PHP version 5.2.4-1 to 5.2.11-1
  3. For future reference, I fixed it by adjusting the code in my initial post to use value="(-?[0-9\.]+)" This allowed the negative character to be displayed. In the end though, I found an easier way to get the values via XML #!/usr/bin/php #query weather data from wunderground xml for use with mrtg / rrdtool graphing utilities <?php //Get the XML document loaded into a variable $ch = curl_init("http://api.wunderground.com/auto/wui/geo/WXCurrentObXML/index.xml?query=80013"); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $url = curl_exec($ch); curl_close($ch); $xml = new SimpleXMLElement($url); echo $xml->temp_f."\n"; echo $xml->windchill_f."\n"; ?>
  4. Hello all, I am currently working with some code that I found online to query the temperature from wunderground.com. The problem that I am running into, is that the code does not appear to allow negative values. Actually, I think it is simply not allowing the "-" to appear before the number. I am not very fluent in php, but am reading plenty of resources. None of those have helped me out yet though and my messing around with with the "value=" section of the below code has not resulted in the desired results. Anyone have some thoughts? Here is what I am currently using: if (preg_match('#pwsvariable="tempf" english="°F" metric="°C" value="([0-9\.]+)">#', $page, $matches)) { $current_temp = $matches[1]; Thanks in advance.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.