Posts by José Neto • 907 points
21 posts
-
40
votes3
answers13710
viewsA: What is a Polyfill?
Explaining in a practical way, so that anyone understands: You want to use a very good javascript feature, for example fetch() or Promise(). But some browsers, like Internet Explorer, do not have…
-
11
votes3
answers9049
viewsA: What is a Transpilation?
It would be a conversion from one language to another. When, for example, you program in Typescript, you need a transpiler to convert it to Javascript. When you use React and write to Jsx, you need…
-
-2
votes3
answers134
viewsA: Why do libraries use "! function_exists('function')" always when there is a statement of a function?
This causes such a function to be defined only if it does not yet exist. Interesting if you need to overwrite any of them, you define yours, and then the framework "question": This function here…
-
1
votes3
answers363
viewsA: Print values from the same variable via GET PHP
Variable cod_depto is repeated. Then, only the last one will be displayed. In case, you need to turn it into an array to pass via get, by placing the []:…
-
3
votes2
answers357
viewsA: Portable blade and performance
This only happens the first time. After that, a file already parsed and converted to php code is generated and stays there in the Storage folder. So this parsing is not done every time, except if…
-
1
votes1
answer357
viewsA: Run javascript function on AJAX calls to a specific page
Using or implementing some Lazy load library, which loads the scripts on demand. How about something like: myLib.load(['jquery', 'jquery-ui', 'fancybox'], function(){ // Isso aqui só vai rodar…
-
13
votes2
answers217
viewsA: Risk in allowing developers to upem files. Blade
{{var_dump(Config::get('database'))}} And it’s gone...
-
1
votes2
answers7296
viewsA: How do I get the files from a Github Restore?
Dynamically downloading the zip to your project via the above mentioned url https://github.com/contaUtilizador/nomeProjeto/archive/master.zip You can extract the zip and browse freely through the…
-
0
votes4
answers107
viewsA: How to use ' inside an array?
Use double quotes as delimiter, and feel free to use single quotes within the value of the same: <?php ":'(" => "choro.png", ?>
-
0
votes4
answers430
viewsA: PHP class for interaction with Mysql BD
If you are going to do it by hand, I advise you to use PDO, functions like mysql_connect and the like, are out of use. More current versions of php already trigger deprecated Warning when they…
-
0
votes4
answers425
viewsA: Query BD and show all results except the first
It is interesting to know how many records you want to return. Let’s say 10, you would do the following: $query = mysql_query("SELECT * FROM tbl_galeira ORDER BY id ASC LIMIT 10, 1");…
-
0
votes3
answers19918
viewsA: How to open a pop-up
You won’t get it with pure php. To open the popup, you’ll have to put a snippet of javascript code. Something like: <p> <a href="window.open('http://google.com', 'new-window');"><?php…
-
0
votes3
answers104
viewsA: I need to list a text field with values separated by ;
I would use str_replace: $str = '11 2222-3333;12 9 1111-2222;18 1111-2222;11 2222-3333'; echo str_replace(';', '<br />', $str);
-
1
votes4
answers3597
viewsA: json returns null with special characters
I would use json_encode directly. But if you are having problems with special characters, you can try using the functions: utf8_encode or utf8_decode in place of htmlentities
-
1
votes1
answer85
viewsA: Association between 2 tables
This is because you are echo an array variable. Since it is not "printable", php plays on the screen the "type of it". In the view, instead of echo $receitas Place var_dump( $receitas ); And you’ll…
-
1
votes2
answers298
views -
2
votes1
answer759
viewsA: Relationship in Laravel/Eloquent ORM
That FileClass::all()->fileServico It doesn’t work. In case to catch the fileServico of each FileClass, would have to be in an iteration: foreach( FileClass::all() as $item ){ var_dump(…
-
1
votes4
answers4165
viewsA: How to pass parameters through the URL in Wordpress?
Boy, natively, that’s how the Archives list works. For example, I want to see the June 2013 posts from Not Saved: http://www.naosalvo.com.br/2013/06/
-
0
votes4
answers3372
viewsA: Generate random numbers that result in a fixed sum
Math.ceil((Math.random()*50)); // Onde 50 é o valor máximo (vai gerar números entre 0 e 50)
-
0
votes2
answers1098
viewsA: How to create dependency validation between fields in Codeigniter?
Another alternative @Luiscoms, would be to do something like: public function index(){ // Se tal campo estiver marcado, adicionar a regra para validar a URL…
-
2
votes2
answers1098
viewsA: How to create dependency validation between fields in Codeigniter?
It is possible, but you will have to use the callback_XXX validators: public function index(){ $this->form_validation->set_rules('flag', 'Flag', '');…