Jump to content

felix

Members
  • Posts

    214
  • Joined

  • Last visited

  • Days Won

    8

Everything posted by felix

  1. I would love to have a possibility to embed videos via CKEDITOR the same way images are embedded (instead of shortcodes). This would be so much easier (i mean: after all video is just another html tag). Any plans on doing this? If you ain't got time / plans to do this I'd be happy to help you with it (I thought about building this as a module for quite a long time).
  2. Maybe this helps you. I'm using it in one of our sites for the exact same thing (you'll have to adjust the table names and get the coordinates of the given zip, though). The SQL Query uses the Haversine formula ( http://www.plumislandmedia.net/mysql/haversine-mysql-nearest-loc/ ) to find coordinates within the given radius. /** * Retrieves a list of address records residing within the given $radius of the given geo location * * @param float $lat * @param float $lng * @param int $radius * @return array */ private function proximitySearch($lat, $lng, $radius = 20) { $sql = <<<SQL SELECT * FROM ( SELECT *, ( ( 2 * 6378.2 ) * ATAN2( ( SQRT( POW( SIN( ( ( $lat * PI() / 180 ) - ( lat * PI() / 180 ) ) / 2 ), 2 ) + COS( lat * PI() / 180 ) * COS( $lat * PI() / 180 ) * POW( SIN( ( ( $lng - lng ) * PI() / 180 ) / 2 ), 2 ) ) ), ( SQRT( 1 - ( POW( SIN( ( ( $lat * PI() / 180 ) - ( lat * PI() / 180 ) ) / 2 ), 2 ) + COS( lat * PI() / 180 ) * COS( $lat * PI() / 180 ) * POW( SIN( ( ( $lng - lng ) * PI() / 180 ) / 2 ), 2 ) ) ) ) ) ) AS distance FROM field_address_team ORDER BY distance ) AS distributordistance WHERE distance <= $radius; SQL; $result = wire('db')->query($sql); if(!function_exists('mysqli_fetch_all')) { $retVal = []; while ($row = $result->fetch_assoc()) { $retVal[] = $row; } } else { $retVal = $result->fetch_all(MYSQLI_ASSOC); } return $retVal; } Usage (in this specific example the radius is extended by the factor 3 until at least 3 locations are found or the radius has been extended 3 times which would be 540km [(((20*3)*3)*3)] with default radius settings ): public function getTeamsInRadius() { $teamsArr = new \PageArray(); $searchCount = 0; while (count($teamsArr) < 3 && $searchCount <= 3 ) { try { // extend search radius by factor 3 as long as result set counts less than 3 hits // $teams = $this->proximitySearch($this->latitude, $this->longitude, $this->radius * pow(3, $searchCount)); foreach( $teams as $team ) { $teamsArr->append( wire('pages')->get($team['pages_id']) ); } $searchCount++; } catch (\Exception $e) { break; } } return $teamsArr; } A good idea when using this is to cache the results (see this blog entry for examples) for each entered ZIP until new entries are added to the database as the SQL Queries are pretty performance intensive. The benefit of this method is: You don't have to query Google Maps (or another GeoService) every time you're searching for locations.
  3. RT @Vayur: Padloper - Easy and flexible eCommerce platform, built on the ProcessWire framework. https://t.co/xFuzMBvneM

  4. I think he is talking about delivering different ressources (and propably markup) depending on the device that is accessing the application. Have a look at: http://www.smashingmagazine.com/2013/10/responsive-website-design-with-ress/
  5. RT @benhowdle: “Slack really helps me communicate with my team on a collaborative level”no you just like the way it lets you send GIFs ea…

  6. RT @hij1nx: HTMLX is like JSX, but you put the JS inside the HTML instead of the HTML inside the JS. Equally as dumb, but its been around l…

  7. RT @Pundamentalism: *Zebra walks past a tree*Monkey: Beep!Zebra: Really? The barcode scanner joke AGAIN?! Monkey: Never gets old!Ze…

  8. RT @brad_frost: New post: Living with Bullshit http://t.co/y39q7oDikX In which I discuss balance, bullshit, and bottom lines.

  9. As I've already commented under the article: It seems like there was an internal job called "write something about processwire" and somebody decided to give it a go because there was nothing else to do and he was bored or something. All his other (wordpress) articles are packed up with images, code examples and so on. It's a shame :/
  10. RT @zeitonline: Angetrunkene Demonstranten, pöbelnder Mob: Die Ereignisse in #Heidenau sind schlimmer als in Freital. (nd) http://t.co/5Ifi…

  11. RT @TorsunBurkhardt: 23 Jahre später: The return of the Hasspisser! #Heidenau http://t.co/sk7uzI6xd3

  12. RT @Notanotherdev: @processwire awesome work on the drafts module!

  13. RT @codepo8: The Wrong Debate About Native And Web. http://t.co/gF8Aa2GAWq

  14. I'd recommend www.getpostman.com the next time you're trying to test api requests.
  15. RT @bastianallgeier: Today is “central-hosting-for-webfonts-might-not-be-a-good-idea-day”

  16. RT @codinghorror: Welcome to the Internet of Compromised Things http://t.co/lBMwljmQTq http://t.co/3DZJAqYCOv

  17. RT @lmorchard: "The web is awesome" - or, I wanted to write about what doesn't suck for my next post http://t.co/DS7Odn8xHL

×
×
  • Create New...