- CSS Reference Referência das diretivas do CSS
- HTML Reference
- Mozilla Developer Network Excelente documentação
- jQuery
- Bootstrap
- Front-End Handbook 2017 Referência e guia de estudos de tecnologias Web
- Developer Roadmap Guia de tecnologias e estudos
Last active
August 28, 2017 13:07
-
-
Save varlen/c593dea4dfbd65b1cb7d4b80f522a496 to your computer and use it in GitHub Desktop.
Exemplos para o Minicurso de Desenvolvimento Web
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 | |
/** | |
* Formulário simples utilizando método POST | |
*/ | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Minha Página</title> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
<? | |
if ($_POST['nome']) | |
{ | |
?> | |
<h1> Olá, | |
<? echo $_POST['nome']; ?> | |
</h1> | |
<? | |
} | |
?> | |
<form action="/" method="POST"> | |
<label for="nome">Digite seu nome</label> | |
<input type="text" name="nome" /> | |
<input type="submit" value="Enviar" /> | |
</form> | |
</body> | |
</html> |
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 | |
/** | |
* Sessão | |
*/ | |
session_start(); | |
if (! $_SESSION['todoList']) | |
{ | |
$_SESSION['todoList'] = array(); | |
} | |
if ($_POST['remove'] != "") | |
{ | |
unset($_SESSION['todoList'][ $_POST['remove'] ]); | |
} | |
else if ($_POST['item'] != "") | |
{ | |
array_push($_SESSION['todoList'], $_POST['item']); | |
} | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Minha Lista</title> | |
<script | |
src="https://code.jquery.com/jquery-3.2.1.slim.min.js" | |
integrity="sha256-k2WSCIexGzOj3Euiig+TlR8gA0EmPjuc79OEeY5L45g=" | |
crossorigin="anonymous"></script> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
<h4> Lista de Tarefas </h4> | |
<ul> | |
<? foreach ($_SESSION['todoList'] as $key => $value) | |
{ | |
?><li data-id="<? echo $key ?>"><? echo $value; ?></li><? | |
} | |
?> | |
</ul> | |
<form action="/" method="POST"> | |
<input placeholder="Novo item..." type="text" name="item" /> | |
<input type="hidden" name="remove" /> | |
<input type="submit" value="+" /> | |
</form> | |
<script> | |
$(document).ready(function () { | |
$("li[data-id]").click(function (evt) { | |
var id = $(evt.target).data("id"); | |
$("input[name='remove']").val(id); | |
$("form").submit(); | |
}); | |
}); | |
</script> | |
</body> | |
</html> |
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 | |
/** | |
* Sessão | |
*/ | |
session_start(); | |
if (! $_SESSION['todoList']) | |
{ | |
$_SESSION['todoList'] = array(); | |
} | |
if ($_POST['remove'] != "") | |
{ | |
//array_splice($_SESSION['todoList'], $_POST['remove']); | |
} | |
else if ($_POST['item'] != "") | |
{ | |
array_push($_SESSION['todoList'], $_POST['item']); | |
} | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Minha Lista</title> | |
</head> | |
<body> | |
<h4> Lista de Tarefas </h4> | |
<ul> | |
<? foreach ($_SESSION['todoList'] as $key => $value) | |
{ | |
?><li data-id="<? echo $key ?>"><? echo $value; ?></li><? | |
} | |
?> | |
</ul> | |
<form action="/" method="POST"> | |
<input placeholder="Novo item..." type="text" name="item" /> | |
<input type="hidden" name="remove" /> | |
<input type="submit" value="Enviar" /> | |
</form> | |
</body> | |
</html> |
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 | |
/** | |
* Tabela | |
*/ | |
$dados = [ | |
["Igor", "121212121"], | |
["Varlen", "123123123"], | |
["Carla", "124123122"] | |
]; | |
?> | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Minha Página</title> | |
<meta charset="UTF-8"> | |
</head> | |
<body> | |
<table> | |
<thead> | |
<td>Nome</td> | |
<td>DRE</td> | |
</thead> | |
<? | |
foreach($dados as $linha) | |
{ | |
?> | |
<tr> | |
<td><? echo $linha[0]; ?></td> | |
<td><? echo $linha[1]; ?></td> | |
</tr> | |
<? | |
} | |
?> | |
</table> | |
<style type="text/css"> | |
table, td { | |
border: solid 1px; | |
} | |
</style> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment