if you try to change any file from your theme, to see any changes you must go to Backoffice–>performance–>Force compile and change this to YES.
Now all change that you make is visible.
Good luck
Filed under: prestashop | Leave a Comment
Etichete:prestashop
fresh install of magento and 404 error when click on magento connect manager.
To solve this you must set:
Directory /downloader/ set to 755
file /downloader/index.php set to 644
Filed under: magento | Leave a Comment
Etichete:magento
yii rules numerical float
if you want to validate a float number you can use this:
public function rules()
{
// NOTE: you should only define rules for those attributes that
// will receive user inputs.
return array(array(‘price’, ‘numerical’, ‘integerOnly’=>FALSE,’numberPattern’=>’/^\s*[-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)?\s*$/’,'message’=>’erroreeeeee’),
);
}
Example: 19.32
Filed under: Yii | Leave a Comment
Etichete:yii
yii image resize include(CArray.php) [function.include]: failed to open stream: No such file or directory
I installed a image extension that do resize. On localhost I had the following error when I try to do $image->save($path,100):
include(CArray.php) [function.include]: failed to open stream: No such file or directory
To fixed it go to:
http://www.yiiframework.com/forum/index.php?/topic/6392-fancyupload/
or if that location doesn’t work put these code into /protected/components/CArray.php
<?php
/**
* Array helper class.
*
* $Id: arr.php 3769 2008-12-15 00:48:56Z zombor $
*
* @package Core
* @author Kohana Team
* @copyright (c) 2007-2008 Kohana Team
* @license http://kohanaphp.com/license.html
*/
class CArray {
/**
* Return a callback array from a string, eg: limit[10,20] would become
* array('limit', array('10', '20'))
*
* @param string callback string
* @return array
*/
public static function callback_string($str)
{
// command[param,param]
if (preg_match('/([^\[]*+)\[(.+)\]/', (string) $str, $match))
{
// command
$command = $match[1];
// param,param
$params = preg_split('/(? $value)
{
$value = ($keep_keys === TRUE) ? $value : array_values($value);
foreach ($value as $k => $v)
{
$new_array[$k][$key] = $v;
}
}
return $new_array;
}
/**
* Removes a key from an array and returns the value.
*
* @param string key to return
* @param array array to work on
* @return mixed value of the requested array key
*/
public static function remove($key, & $array)
{
if ( ! array_key_exists($key, $array))
return NULL;
$val = $array[$key];
unset($array[$key]);
return $val;
}
/**
* Extract one or more keys from an array. Each key given after the first
* argument (the array) will be extracted. Keys that do not exist in the
* search array will be NULL in the extracted data.
*
* @param array array to search
* @param string key name
* @return array
*/
public static function extract(array $search, $keys)
{
// Get the keys, removing the $search array
$keys = array_slice(func_get_args(), 1);
$found = array();
foreach ($keys as $key)
{
if (isset($search[$key]))
{
$found[$key] = $search[$key];
}
else
{
$found[$key] = NULL;
}
}
return $found;
}
/**
* Because PHP does not have this function.
*
* @param array array to unshift
* @param string key to unshift
* @param mixed value to unshift
* @return array
*/
public static function unshift_assoc( array & $array, $key, $val)
{
$array = array_reverse($array, TRUE);
$array[$key] = $val;
$array = array_reverse($array, TRUE);
return $array;
}
/**
* Because PHP does not have this function, and array_walk_recursive creates
* references in arrays and is not truly recursive.
*
* @param mixed callback to apply to each member of the array
* @param array array to map to
* @return array
*/
public static function map_recursive($callback, array $array)
{
foreach ($array as $key => $val)
{
// Map the callback to the key
$array[$key] = is_array($val) ? arr::map_recursive($callback, $val) : call_user_func($callback, $val);
}
return $array;
}
/**
* Binary search algorithm.
*
* @param mixed the value to search for
* @param array an array of values to search in
* @param boolean return false, or the nearest value
* @param mixed sort the array before searching it
* @return integer
*/
public static function binary_search($needle, $haystack, $nearest = FALSE, $sort = FALSE)
{
if ($sort === TRUE)
{
sort($haystack);
}
$high = count($haystack);
$low = 0;
while ($high – $low > 1)
{
$probe = ($high + $low) / 2;
if ($haystack[$probe] = $low_distance) ? $haystack[ceil($low)] : $haystack[floor($low)];
}
return $high;
}
/**
* Emulates array_merge_recursive, but appends numeric keys and replaces
* associative keys, instead of appending all keys.
*
* @param array any number of arrays
* @return array
*/
public static function merge()
{
$total = func_num_args();
$result = array();
for ($i = 0; $i $val)
{
if (isset($result[$key]))
{
if (is_array($val))
{
// Arrays are merged recursively
$result[$key] = arr::merge($result[$key], $val);
}
elseif (is_int($key))
{
// Indexed arrays are appended
array_push($result, $val);
}
else
{
// Associative arrays are replaced
$result[$key] = $val;
}
}
else
{
// New values are added
$result[$key] = $val;
}
}
}
return $result;
}
/**
* Overwrites an array with values from input array(s).
* Non-existing keys will not be appended!
*
* @param array key array
* @param array input array(s) that will overwrite key array values
* @return array
*/
public static function overwrite($array1)
{
foreach (array_slice(func_get_args(), 1) as $array2)
{
foreach ($array2 as $key => $value)
{
if (array_key_exists($key, $array1))
{
$array1[$key] = $value;
}
}
}
return $array1;
}
/**
* Fill an array with a range of numbers.
*
* @param integer stepping
* @param integer ending number
* @return array
*/
public static function range($step = 10, $max = 100)
{
if ($step < 1)
return array();
$array = array();
for ($i = $step; $i $value)
{
if (is_array($value))
{
// Convert the array to an object
$value = arr::to_object($value, $class);
}
// Add the value to the object
$object->{$key} = $value;
}
return $object;
}
} // End arr
Filed under: Uncategorized | Leave a Comment
SQL change table name
Often I googled how to change the name of a table in sql.
Maybe this help you too:
alter table Old_Name rename to New_Name
Filed under: sql | Leave a Comment
yii criteria SQL
$criteria = new CDbCriteria;
$criteria->condition = “salariu=:salariu_val”;
$criteria->order = “name ASC”;
$criteria->limit = 10;
$items = Item::model()->findAll($criteria);
Filed under: Uncategorized | 2 Comments
slug for nice url
iata o functie foarte ok pentru a crea “Slug”:
public function slug($str, $replace=array(), $delimiter=’-') {
setlocale(LC_ALL, ‘en_US.UTF8′);if( !empty($replace) ) {
$str = str_replace((array)$replace, ‘ ‘, $str);
}$clean = iconv(‘UTF-8′, ‘ASCII//TRANSLIT’, $str);
$clean = preg_replace(“/[^a-zA-Z0-9\/_|+ -]/”, ”, $clean);
$clean = strtolower(trim($clean, ‘-’));
$clean = preg_replace(“/[\/_|+ -]+/”, $delimiter, $clean);return $clean;
}
Mie mi-a fost foarte utila , deoarece scap si de caracterele romanesti care imi faceau probleme.
Nu este facuta de mine, sursa este aici: http://cubiq.org/the-perfect-php-clean-url-generator
Filed under: php | Leave a Comment
yii CListView change pager
Daca doriti sa modificati etichetele de la {pager} , adica “Go to page” “Previous” sau “Next”, adaugati la widget liniile cu rosu si boldate :
$this->widget(‘zii.widgets.CListView’, array(
‘dataProvider’=>$items,
‘itemView’=>’_view’,
‘pager’=>array(
‘class’=>’CLinkPager’,
‘header’=>’Pagina ‘,
‘firstPageLabel’=>’<<’,
‘prevPageLabel’=>’<’,
‘nextPageLabel’=>’>’,
‘lastPageLabel’=>’>>’,
)
));
the configuration for the pager. Defaults to array('class'=>'CLinkPager').
Filed under: Yii | Leave a Comment
Etichete:CListView, pager, yii, yii framework
CListView emptyText
daca Folositi CListView si in urma interogarii nu aveti date de afisat, default va afiseaza:
“No results found”
Pentru a modifica acest lucru puteti folosi in pagina de view – emptyText:
$this->widget(‘zii.widgets.CListView’, array(
‘dataProvider’=>$items,
‘itemView’=>’_view’,
‘emptyText’=>’Momentan nu sunt articole in aceasta categorie’,
));
the message to be displayed when dataProvider does not have any data.
Filed under: Yii | Leave a Comment
Etichete:CListView, yii, yii framework
modificare CListView summaryText
Daca doriti sa modificati modul cum apare CListView:
cu
1-4 din 4 rezultate
In partea de view modificam widget-ul CListView adaugand linia cu rosu boldata.
$this->widget(‘zii.widgets.CListView’, array(
‘dataProvider’=>$items,
‘itemView’=>’/_view’,
‘summaryText’ => ‘{start}-{end} din {count} rezultate’,
));
the summary text template for the view. These tokens are recognized and will be replaced with the corresponding values:
- {start}: the starting row number (1-based) currently being displayed
- {end}: the ending row number (1-based) currently being displayed
- {count}: the total number of rows
- {page}: the page number (1-based) current being displayed, available since version 1.1.3
- {pages}: the total number of pages, available since version 1.1.3
Filed under: Yii | Leave a Comment
Etichete:CListView, summaryText, yii framework
Inregistrari recente
- prestashop modify header no changes
- magento connect manager 404 error
- yii rules numerical float
- yii image resize include(CArray.php) [function.include]: failed to open stream: No such file or directory
- SQL change table name
- yii criteria SQL
- slug for nice url
- yii CListView change pager
- CListView emptyText
- modificare CListView summaryText
- Yii
Categorii
- chillout music (4)
- concursuri (3)
- filme (4)
- iphone (5)
- joomla (1)
- magento (4)
- muzica (67)
- my own thoughts (19)
- my projects (4)
- my trips (2)
- Networking (1)
- php (3)
- poze (6)
- prestashop (1)
- projects (6)
- retete mancare (13)
- sql (1)
- symfony2 (3)
- tenis (2)
- Uncategorized (23)
- web applications (4)
- wordpress (1)
- Yii (5)
Arhive
- ianuarie 2012
- decembrie 2011
- noiembrie 2011
- octombrie 2011
- septembrie 2011
- august 2011
- aprilie 2011
- martie 2011
- ianuarie 2011
- noiembrie 2010
- octombrie 2010
- septembrie 2010
- iulie 2010
- iunie 2010
- mai 2010
- aprilie 2010
- februarie 2010
- ianuarie 2010
- decembrie 2009
- noiembrie 2009
- octombrie 2009
- septembrie 2009



