Create Facebook applications with CodeIgniter
Learn how to incorporate the Facebook SDK into the CodeIgniter framework, using the available functions to create applications. …
Learn how to incorporate the Facebook SDK into the CodeIgniter framework, using the available functions to create applications. …
Interesante librería que hace uso de Google Translator para traducir un texto en un idioma a otro. Aunque el API de Google está solo en Java o Javascript, el autor de la librería ha creado un wrapper para que esté disponible desde PHP.
require_once('googleTranslate.class.php');
/* Initialize the class translate class */
$gt = new GoogleTranslateWrapper();
$sampleText = "Bonjour de cette partie du monde";
/* translate(string, to_language, from_language) */
echo $gt->translate($sampleText , "en", "fr");
Sencillo truco que nos puede ayudar a redireccionar nuestra web a la versión móvil cuando nos visite un usuario desde un iPhone, una Blackberry o una Palm
RewriteCond %{HTTP_USER_AGENT} ^.*iPhone.*$
RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*BlackBerry.*$
RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]
RewriteCond %{HTTP_USER_AGENT} ^.*Palm.*$
RewriteRule ^(.*)$ http://mobile.yourdomain.com [R=301]
Redirect iPhone, Blackberry, & Palm Requests With .htaccess
Vía / @jlantunez
neo4j es una base de datos de grafos que puede ser muy útil para aplicaciones tipo redes sociales. El problema para los que usamos PHP es que neo4j está en Java y para usarlo desde PHP o se una un bridge que conecte con Java o usar la versión REST de neo4j y acceder vía web.
Su uso es muy sencillo:
$graphDb = new GraphDatabaseService('http://localhost:9999/');
$node = $graphDb->createNode();
$node->message = "Hello, ";
$node->blah = "blah blah";
$node->save();
Se le puede añadir todas las propiedades que se quieran, que se transforman en un array de datos que luego se enviarán en json.
El único problema que tiene esta librería es que no genera índices, aunque es muy sencillo modificar, ya que tan solo es necesario añadir una llamada para generar el índice:
HTTPUtil::jsonPostRequest($this->_neo_db->getBaseUri().'index/node/clave/'.$this->_data['clave'], $this->_neo_db->getBaseUri().'node/'.$this->_id);
siendo ‘clave’ lo que queramos añadir como índice. También es necesario modificar HTTPUtil::jsonRequest para que cuando $data no sea un array no se codifique en JSON.
In object oriented programming, polymorphism is a powerful and fundamental tool. It can be used to create a more organic flow in your application. This tutorial will describe the general concept of polymorphism, and how it can easily be deployed in PHP. What is Polymorphism? Polymorphism is a long word for a very simple concept. Polymorphism descri…
Librería PHP que nos permite obtener los datos de Google Analytics tipo Visitas y Páginas Vistas de forma muy sencilla y cómoda:
//session_start for caching, if desired
session_start();
//get the class
require 'ga/analytics.class.php';
//sign in and grab profile
$analytics = new analytics('david@davidwalsh.name', 'myP@ssw0rd');
$analytics->setProfileByName('davidwalsh.name');
//set the date range for which I want stats for (could also be $analytics->setDateRange('YYYY-MM-DD', 'YYYY-MM-DD'))
$analytics->setMonth(date('n'), date('Y'));
//get array of visitors by day
print_r($analytics->getVisitors());
//get array of pageviews by day
print_r($analytics->getPageviews());
Google Analytics PHP API class
Vía / David Walsh Blog