This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOAD DATA local INFILE '/path/to/file.csv' | |
INTO TABLE name_scheme.name_of_table | |
FIELDS TERMINATED BY ',' | |
ENCLOSED BY '"' | |
ESCAPED BY '\\' | |
LINES TERMINATED BY '\n' | |
IGNORE 0 LINES | |
(field1,field2,field3,field4); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function getOrderedByCategory(){ | |
$sql = new Sql($this->tableGateway->getAdapter()); | |
$select = $sql->select('alb_album')->where('alb_album.activo = 1 ORDER BY alb_album.id_categoria ASC'); | |
$join = $select->join('alb_categoria','alb_album.id_categoria = alb_categoria.id_categoria',array('nombre_categoria'=>'nombre')); | |
$statement = $sql->prepareStatementForSqlObject($join); | |
$result = $statement->execute(); | |
$rows = array_values(iterator_to_array($result)); | |
return $rows; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function createThumbnail($source_folder, $thumbs_folder, $source_file, $extension, $thumbHeight){ | |
if ($extension == 'gif') { | |
$imgt = "ImageGIF"; | |
$imgcreatefrom = "ImageCreateFromGIF"; | |
}else if($extension == 'jpg' || $extension == 'jpeg'){ | |
$imgt = "ImageJPEG"; | |
$imgcreatefrom = "ImageCreateFromJPEG"; | |
}else if ($extension == 'png') { | |
$imgt = "ImagePNG"; | |
$imgcreatefrom = "ImageCreateFromPNG"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// ...the other options before..... | |
'home' => array( | |
'type' => 'Zend\Mvc\Router\Http\Literal', | |
'options' => array( | |
'route' => '/', | |
'defaults' => array( | |
'controller' => 'Application\Controller\Index', | |
'action' => 'index', | |
), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img src="[[getResourceField:phpthumbof=`w=444&h=284&zc=1`? &id=`[[*slide1_home]]` &isTV=`1` &processTV=`1` &field=`imagen_nota`]]" alt="Imagen1" /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$compare = "31-10-1991"; | |
// first validate the format...it could be: 24-05-2013,24/05/2013,24.05.2013,24-5-2013,24.5.2013,24/5/2013...or something like that(at this point we've just validated the format...not the date) | |
if(preg_match('/^(3[0-1]|[0-2]?[0-9])[\/.-](1[0-2]|0?[0-9])[\/.-][0-9]{4}$/',$compare)){ | |
$date_parsed = preg_split('/[\/.-]/', $compare); | |
//if the format is correct we're going to see if the date is valid....for example: 31-02-2013 should be invalid.... | |
if(!checkdate($date_parsed[1],$date_parsed[0],$date_parsed[2])){ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$adapter = $this->tableGateway->getAdapter(); | |
$select = new Select(); | |
$select->from('tax_tags') | |
->limit(5) | |
->where->like('tag', "%".$query."%"); | |
$statement = $adapter->createStatement(); | |
$select->prepareStatement($adapter, $statement); | |
$result = $statement->execute(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$adapter = $this->tableGateway->getAdapter(); | |
$select = new Select(); | |
$select->from('alb_imagen') | |
->columns(array('itemId' => 'id_imagen', | |
'value' => 'titulo')) | |
->limit(12) | |
->join(array('t' => 'alb_thumbnail'),'t.id_imagen = alb_imagen.id_imagen',array('imagen' => 'nombre')) | |
->where('t.tipo = \'MINI_ICON50X50\' and alb_imagen.activo =1') | |
->where(array(new PredicateSet(array(new Like('titulo', "%".$query."%"), | |
new Like('descripcion', "%$query%") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function ImageCreateFromBMP($p_sFile) | |
{ $file = fopen($p_sFile,"rb"); | |
$read = fread($file,10); | |
while(!feof($file)&&($read<>"")) | |
$read .= fread($file,1024); | |
$temp = unpack("H*",$read); | |
$hex = $temp[1]; | |
$header = substr($hex,0,108); | |
if (substr($header,0,4)=="424d") | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
----- git rm -r --cached <folder_name> | |
It discard of git index but not from local working copy...useful when by accident we pushed something to remote repository and then we have to remove it from that repo. | |
----- git remote set-url <remote_name> <new_url_here> | |
It can set a new url for the current repository, useful when we change the name of the repository on Github for example, as Github also change the url for this. | |
OlderNewer