{% extends 'base.html.twig' %}
{% block body %}
<script>
{{ source('/absolute/path/') }}
</script>
{% endblock %}
assetic:
assets:
js:
inputs:
- '/path/to/libray'
output: 'output/path'
class Controller
{
public function proxyAssetFile($path)
{
$realpath = $this->blackMagic($path);
return new \Symfony\Component\HttpFoundation\BinaryFileResponse($realpath);
}
}
/**
* @Route("/articles")
* @Method("PUT")
*/
public function putArticlesAction(array $articles)
{
foreach ($articles as $article) {
$this->putArticleAction($article);
}
}
/**
* @Route("/articles/{article}")
* @Method("PUT")
*/
public function putArticleAction($article)
{
}
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
ini_set('xdebug.var_display_max_depth', -1);
$tests = [];
mb_internal_encoding('UTF-8');
foreach ([
'привет', // false
'5 - это число', // false
'- минус', // false
'Привет', // true
'П', // true
] as $index => $input) {
$input = trim($input);
$tests[] = (
// Only letter (No numeric)
preg_match('/^[\p{L}\p{Z}]/u', $input) &&
// and is equal?
0 === strcmp(
$input,
mb_strtoupper(mb_substr($input, 0, 1)).mb_substr($input, 1) // ucfirst
)
);
}
var_dump($tests);
// array(2) {
// [0] => bool(false)
// [1] => bool(false)
// [2] => bool(false)
// [3] => bool(true)
// [4] => bool(true)
// }
$input = 'привет';
if (0 === strcmp($input, mb_strtoupper(mb_substr($input, 0, 1)).mb_substr($input, 1))) {
// Сюда пройдут: "5 - это число", "- знак".
// Если всё это барахло считать за большие "буквы", то этой строчки хватит
}
<style>
.wrap {
background: -webkit-linear-gradient(top, #f00 0%, #00f 100%);
-webkit-background-clip: text;
-moz-background-clip: text;
background-clip: text;
}
.wrap > a {
color: transparent;
}
</style>
<div class="wrap">
<a href="#">Color link</a> Black text <a href="#">Color link</a> Black text <br>
<a href="#">Color link</a> Black text <a href="#">Color link</a> Black text <br>
<a href="#">Color link</a> Black text <a href="#">Color link</a> Black text <br>
</div>