Jump to content

ChadGregory

Members
  • Posts

    15
  • Joined

  • Last visited

ChadGregory's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Alright So I cam trying to create a currency detection script and I got it all ironed out except for one part. Basically how it is going works is, it grabs the page content of http://www.xe.com/symbols.php and searches for the currency symbol in the example of this post the symbol ( ¥ ). Now I think I can find that symbol by doing a preg_match of that content which in the variable $data, but im not sure how to get it to grab the currency code from that same row in the table. I was thinking I might have to grab the whole tr and then search that, but Im not sure how i would do that either. Here is a 3 row example of the structure of that page <tr class="row2"> <td>Chile Peso</td> <td>CLP</td><td class="cSmbl_imgCol"> <img src="http://s.xe.com/20100208/themes/xe/images/pages/curSymbols/curSymbol36.gif"> </td> <td class="cSmbl_Fnt_C2000">$</td> <td class="cSmbl_Fnt_AU">$</td> <td width="90px">36</td> <td>24</td> <td> <a href="javascript:void(0);" class="curInfo">info</a></td> </tr> <tr class="row1"> <td>China Yuan Renminbi</td> <td>CNY</td> <td class="cSmbl_imgCol"> <img src="http://s.xe.com/20100208/themes/xe/images/pages/curSymbols/curSymbol165.gif"> </td> <td class="cSmbl_Fnt_C2000">¥</td> <td class="cSmbl_Fnt_AU">¥</td> <td width="90px">165</td> <td>a5</td> <td> <a href="javascript:void(0);" class="curInfo">info</a></td> </tr> <tr class="row2"> <td>Colombia Peso</td> <td>COP</td> <td class="cSmbl_imgCol"> <img src="http://s.xe.com/20100208/themes/xe/images/pages/curSymbols/curSymbol36.gif"> </td> <td class="cSmbl_Fnt_C2000">$</td> <td class="cSmbl_Fnt_AU">$</td> <td width="90px">36</td> <td>24</td> <td> </td> </tr> So lets say $data is equal to that code above, How Would get the currency code when search for ( ¥ ) or how could I isolate that entire <tr> from the code.(I Could get the rest of it from there) Here is my code <?php if (!function_exists('bb_file_contents')) { function bb_file_contents($url) { if(function_exists('curl_init')) { $ch = curl_init(); $timeout = 0; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, TRUE); $file_contents = curl_exec($ch); if (!$file_contents) { print_r(curl_getinfo($ch)); die; } curl_close($ch); } else { $file_contents = file_get_contents($url); } return $file_contents; } } $price = '¥6.09'; $convertURL = 'http://www.xe.com/currencyconverter/convert/?Amount=6.09&From=CNY&To=USD'; $currencyURL = 'http://www.xe.com/symbols.php'; echo substr($price, 2, 1); $data = bb_file_contents($currencyURL); //Find Currency Code //Convert to other Currency ?>
  2. I guess I forgot to mention that it would be just the price that would be affected but also the language as well. But its not just the price actually its the actual name of the product to that could change, In the example of Yen as the currency Chinese is the language which would render the whole thing useless. For that I would have to have some way to auto detect the language and translate accordingly, or mock the geolocation of the requestion. But as well this is a plugin for wordpress that could be on a server in any part of the world, so the currency and language would change. I need a in-plugin solution to take this problem out of the equation. Even if you know of a way that use Javascript or java to retrieve the info without geolocation that can send the data to PHP would work as well. But again I have the question how?
  3. ok I developing a plugin for wordpress and I need to be able to set the location to US, so that when it grabs product information the page that is being requested it brings in US dollars. Currently it is bringing in prices as Yen. <?php if (!function_exists('bb_file_contents')) { function bb_file_contents($url) { if(function_exists('curl_init')) { $ch = curl_init(); $timeout = 0; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, TRUE); $file_contents = curl_exec($ch); if (!$file_contents) { print_r(curl_getinfo($ch)); die; } curl_close($ch); } else { $file_contents = file_get_contents($url); } return $file_contents; } } ?> Anyway of doing this? Or is there another way I can get the pages content for me to preg_match?
  4. Alright Im trying to grab product information from google play to display apps such as price, name, author, and app icon. The issue Im having is on my local server everything shows up fine but when uploaded to the server the price is in a different currency(Yen I think) and I want to display only in USD. Im using curl_init at the moment(it a part of a function) I visit the page and it is in the correct currency, but display Yen with the script) $ch = curl_init(); $timeout = 0; // set to zero for no timeout curl_setopt ($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout); curl_setopt ($ch, CURLOPT_FOLLOWLOCATION, TRUE); $file_contents = curl_exec($ch); if (!$file_contents) { print_r(curl_getinfo($ch)); die; } curl_close($ch); } else { $file_contents = file_get_contents($url); } return $file_contents; } Is there anything I can, or is there another way I could handle getting this information?
  5. I viewed it again today and it just fixed itself.
  6. <form role="search" method="get" id="searchform" action="http://papillonstudios.ca"> <div> <input type="text" value="" placeholder="Search..." name="s" id="s"> <input type="submit" id="searchsubmit" value="" width="26" height="28"> </div> </form> Live Link(WIndow Width must be 640px or less) - http://papillonstudios.ca
  7. I am creating a responsive website and I am coming across a strange problem with my search text box. I want the text box to span the full width parent element. Here are the css rules applied to the text box. #searchform input[type = text] { border: 0; padding: 8px 0; width: 100%; max-width: 640px; top: 0; margin:0; position: relative; } I have the view port setup correctly and every else works fine, but there is white space on the right side of the text box. After tinkering with the css properties in Chrome to get live updates using Chrome Developer Tools I stumbled across a very strange partial solution. If i disable the width: 100%; property and re-enable it the white space disappears. I reload the page and its back again. How can I fix this issue?
  8. I have a question about Responsive Web Design. We have devices that came out this year like the Galaxy SIII that support a 1280 x 720 display. My question is how do you separate the Galaxy SIII at resolution to a desktop of similar resolution?
  9. I fixed it by adding word-wrap: break-word; to the <p> Tag
  10. It didn't work for me, again when this code is present <?php $subs = new WP_Query( array( 'post_parent' => $post->ID, 'post_type' => 'page', 'meta_key' => '_thumbnail_id' )); if( $subs->have_posts() ) : while( $subs->have_posts() ) : $subs->the_post(); ?> <div class="product" style="width: 600px; border:1px solid black;"> <? echo get_the_post_thumbnail($post->ID, 'medium'); ?> <?php the_content(); ?> </div> <? endwhile; endif; wp_reset_postdata(); ?> Which is the code to generate the list product divs, the text exits the wrapper, if the code is not present then it works fine
  11. It's for a Wordpress template the &nbsp is from Wordpress
  12. I am making a wordpress template and im having a problem with the <p> tag of the "the_content()" syntax which wraps the content of a post or pages in a <p> overflowing or going through the parent/wrapper element. The image below illustrates the problem. If I put in static text without the <p> tag it doesn't go out of the parent/wrapper element. So i tried to remove the <p> tag but with many attempts i was unsuccessful. So i ask of you how do fix the p tag? html <div class="product"> <img width="300" height="186" src="-censored content" class="attachment-medium wp-post-image" alt="healthy" title="healthy"> <p>Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah Blah</p> </div> I have no current styles applied to any of the elements in the code above.
  13. Thanks for pointing out the obvious lol I should have thought of that
  14. I am creating my first responsive website. My site has a wrapper that has the following css: #wrapper { width: 100%; max-width: 1230px; margin: 0 auto; background: #e0dfdf; } and I would like to have this element have a padding of 15px but when i apply that style the width of the element increases by 15px when i want it to stay at for example the max-width of 1230px. Any suggestions?
×
×
  • 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.