Posts by Marcelo Aymone • 3,366 points
97 posts
-
1
votes2
answers459
viewsA: Access peripheral devices through the browser
It is possible, just define a print layout and send the document as any other, to the equipment printer, whether thermal or not, who manages the printer is the machine, you will only generate a kind…
-
1
votes3
answers596
viewsA: Conditions in Javascript
In php has something similar too, but look at this. $x = (3 > 1); $y = (1 > 2); var_dump($x); //boolean true var_dump($y); //boolean false echo $x; //1 echo $y; //(imprime nada) However this…
-
9
votes3
answers12215
viewsA: Calculate distances between two coordinates
Haversine formula applied in PHP function distancia($lat1, $lon1, $lat2, $lon2) { $lat1 = deg2rad($lat1); $lat2 = deg2rad($lat2); $lon1 = deg2rad($lon1); $lon2 = deg2rad($lon2); $dist = (6371 *…
-
10
votes3
answers1556
viewsA: Filter word in text with php
Try it this way: $string = "ID : 123123 Nome : Elvis Costelo da silva Endereço : Totis bla florianópolis"; $id = preg_split('#(?<!\\\)ID :|Nome :|Endereço :#', $string, -1, PREG_SPLIT_NO_EMPTY |…
phpanswered Marcelo Aymone 3,366 -
0
votes2
answers1147
viewsA: How to Inherit Models in Laravel 4
Consider that relationship is not the same thing as inheritance, when you define relationship between models, it has nothing to do with inheritance of methods and attributes. To create inheritance…
-
1
votes3
answers42780
viewsA: How to change date format in bootstrap from mm/dd/yyyy to dd/mm/yyyy
It may not be good practice, but rather adding other JS files. I edited the original file and kept the references of the plugin creator. Take a look, if you find it convenient, copy the will, no…
-
8
votes1
answer27672
viewsA: Is it possible to replace my car alarm control with an app?
This is not possible because electromagnetic waves emitted by alarms are encoded at very low frequencies (+- 430Mhz) relative to a smartphone, it would not be possible to reproduce this type of wave…
-
1
votes1
answer927
viewsA: Bootstrap: Navbar + list
The grids system is organized into rows and columns, for one item not overlapping another, you must declare it within different rows by marking <div class="row">. At first it seems that your…
-
1
votes1
answer1190
viewsA: Default route controller/action and links to css/js do not work cakephp
You need to call the views from PagesController in this way: http://localhost/teste/pages/home The method display does not return view, you direct request in the url the view you want to display,…
-
3
votes2
answers1096
viewsA: Change the value of a select in Cakephp
Within your ops model, assign the following variable: public $displayField = 'nome'; And the cake itself will adjust to select to display the names correctly... Source:…
-
1
votes1
answer1865
viewsA: How to create a dynamic form in php
Try this way: <?php $tipo_info = 0; echo "<fieldset>Selecione, qual o tipo da informação que deseja cadastrar.<br />"; $query = $con->query("SELECT * FROM…
-
1
votes3
answers1577
viewsA: Embed for my website content
It seems to me that your idea is to provide content to other sites, so I would use a cross-Omain solution. http://davidjbradshaw.github.io/iframe-resizer/ This library uses the method…
-
5
votes1
answer167
viewsQ: Doubt with relational modeling
I’m setting up a land registry, where these properties belong to an address, which belongs to a neighborhood that belongs to a city. Ex tables: Imoveis: id, endereco_id, etc... Enderecos: id, nome,…
-
2
votes1
answer204
viewsA: Controllers in Cakephp Subfolders
Try this way: App::build(array( 'Controller' => array( ROOT . 'app/Controller/Admin/Adm/' ) )); There is also the possibility to use a plugin to do this automatically:…
-
5
votes1
answer227
viewsQ: How to avoid duplicity with Canonical link?
I have a question about the use of Link Canonical. Canonical link is a tag element <link> which aims to decrease the amount of Urls with duplicate content. Sometimes we see some Urls with the…
-
1
votes1
answer167
viewsA: How to create a login page with registration?
Change this line: <?php echo $this->Form->submit('Login', array('id' => 'login-bt')); ?> To: <?php echo $this->Form->end('Login', array('id' => 'login-bt')); ?> The…
cakephpanswered Marcelo Aymone 3,366 -
3
votes2
answers133
viewsA: When using div+selector in CSS
When preceded by "point" refers to a class and when preceded by sharp, the famous "#" refers to an id. Class should always be used when you want to define properties for a group of elements and id…
-
1
votes3
answers229
viewsA: Good practices to avoid broken page display?
Display html after loading - Js body.onload=function(){document.getElementsByTagName('body').style.display='none';};…
uxanswered Marcelo Aymone 3,366 -
1
votes2
answers1308
viewsA: Passing Appcontroller variables to Elements in Cakephp
Researching a little more, I found a way to solve: The function requestAction() allows the views and even elements cakephp request information from any controller/action that you define, in true MVC…
cakephpanswered Marcelo Aymone 3,366 -
0
votes2
answers1308
viewsQ: Passing Appcontroller variables to Elements in Cakephp
You can pass variables originating from Appcontroller’s callback through the method set for Cakephp layout Elements?
cakephpasked Marcelo Aymone 3,366 -
1
votes1
answer127
viewsQ: Performance in dynamic menus
I’m building a cakephp and mysql application, and would like to display some menus and items dynamically through the database. Better example: Display latest updates, latest entries in the database,…
-
3
votes1
answer613
viewsQ: Is it possible to extend the bootstrap css using Less?
I use twitter bootstrap for some things, and came across the ease of using Less, as I can, to use the bootstrap Less variables in a second css file? For example, calling media querys with bootstrap…
-
5
votes1
answer627
viewsQ: Do one page websites appear in search engines?
One page sites are listed normally in search engines? There are several articles and it seems that One page sites are not very friendly to searchers, this is a reality? In which cases? Only in…
-
2
votes2
answers313
viewsA: How to set up cronjobs in cakephp?
From the cakebook itself */5 * * * * cd /full/path/to/app && Console/cake myshell myparam # * * * * * command to execute # │ │ │ │ │ # │ │ │ │ │ # │ │ │ │ \───── day of week (0 - 6) (0 to 6…
-
1
votes1
answer133
viewsA: It’s a bug in Cakephp - Sort Aliases?
The correct thing is to combine the model with the field. array( 'conditions' => array('Model.field' => $thisValue), //array of conditions 'recursive' => 1, //int //array com os campos…
-
0
votes2
answers1124
viewsA: How to organize by proximity using PHP?
First you need to know your location in coordinates. Then you calculate the distances between the starting point(you) and the other points, using the haversine formula, or some PHPGEO resource if it…
phpanswered Marcelo Aymone 3,366 -
2
votes1
answer433
viewsA: Pagination always shows 20 images
Try this: public $paginate = array( 'maxLimit' => 10, //Registros por página 'limit' => 100 //Registros por consulta 'paramType' => 'querystring' //Esta linha analisa o parâmetro fornecido…
-
0
votes1
answer76
viewsQ: How to reload config.json in bootstrap
I’m trying to generate a gist with config.json to re-load bootstrap without losing the changes I’ve already made. So I created a gist: https://gist.github.com/aymone/dba37043a860d4f0abb1 But when…
-
1
votes3
answers1020
viewsQ: Good practices with bootstrap grid system
It would be good practice to declare grids within grids using twitter bootstrap and this can affect code responsiveness? Example: <div class="container"> <div class="row clearfix">…
-
4
votes1
answer281
viewsA: How to make a Slug pagination in Cakephp?
app/config/Routes.php Router::connect('/noticias/:slug', array('controller' => 'noticias', 'action'=>'listar', 'slug'=> '[0-9a-zA-Z]+')); Router::connect('/noticias/:slug/:pagina',…
-
4
votes3
answers2200
viewsQ: How to group mysql results by foreign keys in a single array through a single query?
Let’s say I have 2 tables, one with phone numbers, and one with sectors: Ex. tb_extensions: id, branch, group_id(fk). id | ramal | grupo_id 01 | 1234 | 01 02 | 2345 | 01 03 | 3456 | 02 04 | 3457 |…
-
1
votes2
answers438
viewsQ: How to improve code workflow without using synchronous ajax?
How to improve this script? The function copiaArea() should take the first return of the array and send to the windows clipboard, detail: I am developing for IE, works exclusively in it this…
-
1
votes2
answers150
viewsQ: Formatting JSON in cakephp
I’m generating a json from a find in Cakephp. Controller: public function listar() { $this->layout = 'ajax'; $this->set('resultados', $this->Sala->listarSala()); } Model: public function…
-
-1
votes1
answer87
viewsQ: Suggestions for printer manager application
I’m more set up with webdev, and I’d like suggestions on how I could implement an idea. Note, that I am not asking for any script, nor how to do it, but I would like tips on what tools/language is…
printerasked Marcelo Aymone 3,366 -
1
votes1
answer46
viewsQ: Problem in effect acordion simple in paragraphs
Is this practicable? Or have any suggestions without jQuery UI plugins? HTML CODE: <div class="minhaclasse"> <p class="titulo">Título<br>resumo<br></p> <p…
-
2
votes3
answers16948
viewsA: Mysql SELECT searching for value in another table
If I understand, it’s more or less like this... SELECT nome FROM paginas_categorias INNER JOIN paginas ON (paginas_categorias.id = paginas.id_categorias)
mysqlanswered Marcelo Aymone 3,366 -
1
votes1
answer798
viewsA: Cakephp Auth Component Does Not Work Properly
Try it like this: if ($this->User->save(array( 'name' => $this->request->data['name'], 'username' => $this->request->data['email1'], 'password' =>…
-
-3
votes8
answers7818
viewsA: Check if variable contains a well formatted PHP email address
You can mount a function using regular expressions... function validaEmail($email) { $conta = "^[a-zA-Z0-9\._-]+@"; $domino = "[a-zA-Z0-9\._-]+."; $extensao = "([a-zA-Z]{2,4})$"; $pattern =…
-
1
votes1
answer91
viewsA: Count results from a select in Kohana
Try this after $session = Session::instance(); var_dump($result); And see if $codCliente appears set, if not, for which variable the resulting Id is being set, probably the id is set with a…
-
0
votes4
answers1768
viewsA: Create infinite menu with PHP+CSS+JS
The problem is with your CSS and Jquery. If you remove the property ul ul {display: none;} displays the submenu.
-
0
votes2
answers244
viewsA: Jquery iframe transport plugin works on IE10 cross Domain
This plugin has some compatibility issues... http://cmlenz.github.io/jquery-iframe-transport/#Section-17 I suggest translating and reading to see where your problem possibly fits. Also, check in…
-
0
votes2
answers506
viewsA: Onchange event not working when placed on the body
Hello, you have placed your scripts within some load check function? From what you’ve said, it only works when you put it in the footer, after the page loads. Try with Document.ready, so it checks…
-
0
votes2
answers147
viewsA: HABTM problem in Cakephp 2.x
There on your controller I saw you use this: $options = array('conditions' => array('Setor.' . $this->Setor->primaryKey => $id)); Just call it that: $options = array('conditions' =>…
-
4
votes1
answer378
viewsA: Invalid login message always appears in Cakephp
It is because your action is trying to authenticate as soon as it loads. // Verifica o tipo de requisição, se for POST(form submit) tenta logar. if($this->request->is('post')) { if…
-
1
votes3
answers845
viewsA: How to view alphabetically - Cakephp
It wouldn’t be because you’re assigning value to the array without declaring index? In this case, the interpreter automatically aggregates index 0 at the beginning of the array. foreach ($bairros as…
-
1
votes2
answers1038
viewsA: How to use databases in Cakephp without complying with naming conventions?
Complementing the @bfavaretto response, don’t forget to call the model in the controller. QualquerController extends appController { // $uses atribui o model 'MEU'. public $uses = 'Meu'; } This…
-
0
votes4
answers264
viewsA: Why does Cakephp set _method to PUT instead of POST?
When using put or delete, the form will be post, but when submitted, the HTTP request method will be replaced by PUT or DELETE, respectively. This allows Cakephp to emulate REST support in web…