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
File created in webroot. | |
<?php | |
error_reporting(E_ALL); | |
require_once 'includes/bootstrap.inc'; | |
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL); | |
drupal_flush_all_caches(); | |
$results = db_query('select nid from node where type="store"'); |
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
My .gitignore YII | |
#editors | |
*.swp | |
.buildpath | |
.project | |
.settings | |
nbproject | |
.idea | |
*.sublime-project | |
*sublime-workspace |
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
/* Suponiendo que hemos creado nuestro CRUD. creamos un componente - Obviamente lo guardamos como ZHtml.php dentro de nuestra carpeta components, no hace falta inicializarlo si en nuestro main.php tenemos el autoload | |
'import'=>array( | |
'application.models.*', | |
'application.components.*', | |
), | |
..... | |
*/ | |
<?php |
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
1. Suponiendo que ya sabemos como manejarnos con GII, pasamos a crear un modulo: | |
Module Generator > Module ID * (Aca le ponemos el nombre que queramos) | |
2. Activamos el modulo desde nuestro main.php en este caso he creado un modulo llamado test. | |
'modules'=>array( | |
'test', | |
...... | |
3. Creamos un model, suponiendo que tengo una tabla llamada testlist: |
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 | |
// uncomment the following to define a path alias | |
// Yii::setPathOfAlias('local','path/to/local-folder'); | |
// This is the main Web application configuration. Any writable | |
// CWebApplication properties can be configured here. | |
return array( | |
'basePath'=>dirname(__FILE__).DIRECTORY_SEPARATOR.'..', | |
'name'=>'My Web Application', |
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
DirectoryIndex index.php | |
Options +FollowSymLinks | |
IndexIgnore */* | |
RewriteEngine on | |
# if a directory or a file exists, use it directly | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{REQUEST_FILENAME} !-d |
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
/* Usamos directamente la API de drupal. field_get_items() | |
Si antes hacias esto echo $node->field_subtitle['und'][0]['value']; | |
Aunque funciona olvidate de volver a hacerlo! | |
*/ | |
/* | |
Tomamos como referencia un field creado en la entidad user. | |
*/ | |
$user = user_load(1); |
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
$.fn.vCenter = function(){ | |
this.each(function(){ | |
parent_height = $(this).parent().height(); | |
image_height = $(this).height(); | |
top_margin = (parent_height - image_height)/2; | |
}); | |
return this.each(function() { | |
$(this).css( 'margin-top' , top_margin); | |
}); |
NewerOlder