problema con paginazione articoli fatti con ctl module maker

La discussione sul CMS Made Simple in italiano.

Moderator: magallo

User avatar
protempore
Power Poster
Power Poster
Posts: 599
Joined: Mon Jan 14, 2008 9:08 pm

Re: problema con paginazione articoli fatti con ctl module maker

Post by protempore »

joinweb wrote: la query 11 praticamente prende il campo data (che è un campo che ho inserito io in piu perchè hanno bisogno di cambiare la data) e la ordina in ordine decrescente.
secondo me il problema sta in quella funzione addslashes() che ti ho segnalato...
se attivi il debug in config.php dovresti vedere se il problema è quello...
An eye for an eye will make the whole world blind
Mahatma Gandhi (1869-1948)
joinweb
Forum Members
Forum Members
Posts: 24
Joined: Mon Jun 22, 2009 8:32 am

Re: problema con paginazione articoli fatti con ctl module maker

Post by joinweb »

ancora non funziona!!! sto per tagliarmi le vene!!!
User avatar
protempore
Power Poster
Power Poster
Posts: 599
Joined: Mon Jan 14, 2008 9:08 pm

Re: problema con paginazione articoli fatti con ctl module maker

Post by protempore »

joinweb wrote: ancora non funziona!!! sto per tagliarmi le vene!!!
calma e gesso...
hai modificato la query con '2009-03-15 00:00:00' invece che solo '2009-03-15' come detto?

hai attivato il debug in config.php per vedere cosa restituisce la query?

hai modificato la funzione buildWhere() come detto?
An eye for an eye will make the whole world blind
Mahatma Gandhi (1869-1948)
joinweb
Forum Members
Forum Members
Posts: 24
Joined: Mon Jun 22, 2009 8:32 am

Re: problema con paginazione articoli fatti con ctl module maker

Post by joinweb »

ho modificato la data e la funzione build where

ma non so come attivare il debug del config.php
User avatar
protempore
Power Poster
Power Poster
Posts: 599
Joined: Mon Jan 14, 2008 9:08 pm

Re: problema con paginazione articoli fatti con ctl module maker

Post by protempore »

joinweb wrote: ho modificato la data e la funzione build where

ma non so come attivare il debug del config.php
credo di aver capito...
devi modificare una riga del modulo... nella funzione SetParameters()

Code: Select all

$this->SetParameterType("query",CLEAN_STRING);
deve diventare

Code: Select all

$this->SetParameterType("query",CLEAN_NONE);
il debug si attiva mettendo a "true" invece che "false"
la variabile $config['debug'] nel config.php

Code: Select all

$config['debug'] = true;
An eye for an eye will make the whole world blind
Mahatma Gandhi (1869-1948)
User avatar
protempore
Power Poster
Power Poster
Posts: 599
Joined: Mon Jan 14, 2008 9:08 pm

Re: problema con paginazione articoli fatti con ctl module maker

Post by protempore »

joinweb wrote: ho modificato... la funzione build where
probabilmente devi modificare anche la funzione getWhereFromParams() se utilizzi le query del modulo...

bisogna aggiungere un paio di righe...

Code: Select all

function getWhereFromParams($params, $htmlencoded=false){
		// used for query creation and frontend advanced search action
		// transforms parameters into $where - an array of criteria:
		// $where[] = array($fieldname, $searchvalue, $comparison_type)
		$db =& $this->GetDb();
		$where = array();
		foreach($params as $key=>$value){
			if(substr($key,0,6) == "field_" && trim($value) != ""){
				$key = substr($key,6);
				if(is_array($value) && count($value)==1)	$value = $value[0];
				$compare = isset($params["compare_".$key])?$params["compare_".$key]:0;
				if($value == "__date_field"){
					if($compare != "NA"){
						// The code is such that removing any part of the time input from the form will result in using the default value
						$timeinputs = array("Hour"=>"H","Minute"=>"i","Second"=>"s","Month"=>"n","Day"=>"j","Year"=>"Y");
						$parts = array();
						foreach($timeinputs as $inputname=>$datepart){	
							$parts[] = (isset($params["date_".$key."_".$inputname]))?$params["date_".$key."_".$inputname]:date($datepart);
						}
						$value = mktime($parts[0],$parts[1],$parts[2],$parts[3],$parts[4],$parts[5]);
						$value = str_replace("'","",$db->DBTimeStamp($value));
						
						if($compare == 5){
							$parts = array();
							foreach($timeinputs as $inputname=>$datepart){	
								$parts[] = (isset($params["date_".$key."_part2_".$inputname]))?$params["date_".$key."_part2_".$inputname]:date($datepart);
							}
							$value2 = mktime($parts[0],$parts[1],$parts[2],$parts[3],$parts[4],$parts[5]);
							$value2 = str_replace("'","",$db->DBTimeStamp($value2));
							$where[] = array($key, array($value,$value2), $compare);
						}else{	
							$where[] = array($key, $value, $compare);
						}
					}
				}else{
					if(is_array($value)){
						foreach($value as $onevalue)	$where[] = array($key, $onevalue, 1);
					}elseif($compare == 1){
						$keywords = $this->parsekeywords($value);
						foreach($keywords as $value){
							if($htmlencoded)	$value = html_entity_decode($value);
							$value = addslashes($value);
							$value = str_replace("\'","\\\\\\\\\'",$value);
							$where[] = array($key, $value, $compare);
						}
					}else{
						if($htmlencoded)	$value = html_entity_decode($value);
						$value = addslashes($value);
						$value = str_replace("\'","\\\\\\\\\'",$value);
						$where[] = array($key, $value, $compare);
					}
				}				
			}
		}		
		return $where;
	}
ma serve solo per le query registrate
An eye for an eye will make the whole world blind
Mahatma Gandhi (1869-1948)
joinweb
Forum Members
Forum Members
Posts: 24
Joined: Mon Jun 22, 2009 8:32 am

Re: problema con paginazione articoli fatti con ctl module maker

Post by joinweb »

mi sa che è successa la tragedia

ma se ti scrivo in privato user e password?
User avatar
protempore
Power Poster
Power Poster
Posts: 599
Joined: Mon Jan 14, 2008 9:08 pm

Re: problema con paginazione articoli fatti con ctl module maker

Post by protempore »

ma che è successo?
An eye for an eye will make the whole world blind
Mahatma Gandhi (1869-1948)
joinweb
Forum Members
Forum Members
Posts: 24
Joined: Mon Jun 22, 2009 8:32 am

Re: problema con paginazione articoli fatti con ctl module maker

Post by joinweb »

mi da tutta una seri di errori del tipo
Notice: Undefined property: stdClass::$values in /web/htdocs/www.maurorosati.it/home/modules/articol ... module.php  on line 1358
User avatar
protempore
Power Poster
Power Poster
Posts: 599
Joined: Mon Jan 14, 2008 9:08 pm

Re: problema con paginazione articoli fatti con ctl module maker

Post by protempore »

joinweb wrote: mi da tutta una seri di errori del tipo
Notice: Undefined property: stdClass::$values in /web/htdocs/www.maurorosati.it/home/modules/articol ... module.php  on line 1358
;)
tranquillo... è il debug... fa solo il suo lavoro
serve per lo sviluppo... poi se lo metti ancora a "false" spariscono tutti i messaggi
An eye for an eye will make the whole world blind
Mahatma Gandhi (1869-1948)
User avatar
protempore
Power Poster
Power Poster
Posts: 599
Joined: Mon Jan 14, 2008 9:08 pm

Re: problema con paginazione articoli fatti con ctl module maker

Post by protempore »

i "notice" non sono propriamente errori... soo notizie, appunto...
An eye for an eye will make the whole world blind
Mahatma Gandhi (1869-1948)
User avatar
protempore
Power Poster
Power Poster
Posts: 599
Joined: Mon Jan 14, 2008 9:08 pm

Re: problema con paginazione articoli fatti con ctl module maker

Post by protempore »

ma la query che ti interessa che risultato ti da nel debug?
An eye for an eye will make the whole world blind
Mahatma Gandhi (1869-1948)
joinweb
Forum Members
Forum Members
Posts: 24
Joined: Mon Jun 22, 2009 8:32 am

Re: problema con paginazione articoli fatti con ctl module maker

Post by joinweb »

(mysql): SELECT COUNT(A.id) ourcount FROM cms_mauro_module_articoli_articolo A, cms_mauro_module_articoli_categoria B WHERE A.active=1 AND A.data < '\\\'2009-03-13 17:58:09\\\'' AND A.parent='2'
Error (0):

dovrebbe essere questa no?
User avatar
protempore
Power Poster
Power Poster
Posts: 599
Joined: Mon Jan 14, 2008 9:08 pm

Re: problema con paginazione articoli fatti con ctl module maker

Post by protempore »

joinweb wrote: (mysql): SELECT COUNT(A.id) ourcount FROM cms_mauro_module_articoli_articolo A, cms_mauro_module_articoli_categoria B WHERE A.active=1 AND A.data < '\\\'2009-03-13 17:58:09\\\'' AND A.parent='2'
Error (0):

dovrebbe essere questa no?
si
il problema credo sia qui

Code: Select all

'\\\'2009-03-13 17:58:09\\\''
dovrebbe essere:

Code: Select all

'2009-03-13 17:58:09'
hai fatto tutte le modifiche che ti ho detto?

se vuoi mandami un msg in privato e consentimi di vedere il modulo...
Last edited by protempore on Fri Jul 09, 2010 11:16 am, edited 1 time in total.
An eye for an eye will make the whole world blind
Mahatma Gandhi (1869-1948)
User avatar
protempore
Power Poster
Power Poster
Posts: 599
Joined: Mon Jan 14, 2008 9:08 pm

Re: problema con paginazione articoli fatti con ctl module maker

Post by protempore »

eventualmente metti off-line il sito
così eviti di far vedere tutte le atività del debug


meglio che darmi l'accesso al sito, passami anche solo il file .dna che lo riproduco in locale e provo a fare le modifiche per farlo funzionare
Last edited by protempore on Fri Jul 09, 2010 11:18 am, edited 1 time in total.
An eye for an eye will make the whole world blind
Mahatma Gandhi (1869-1948)
Post Reply

Return to “Italian - Italiano”