вам нужно использовать javascript, чтобы получить значение. Я не уверен, что такое данные $ etc, но в основном вам нужно создать функцию javascript и передать значение в функцию onclick image.
Пример:
PHP
for($i=0;$i<count($certificazioni);$i++){
$etc=certificazioni[$i];
....
?>
<img src="/cubo/addDocument.png"/ height="24" width="24" data-toggle="modal" data-target="#addEvento" onclick="return viewImage(<?php echo $etc; ?>)">
<?php
}
HTML-модал
Добавить дополнительный div к модалу код
<div id="outputHere"></div>
JavaScript
<script>
function viewImage(image) {
// do what you need with the data, which is in this case to append to the modal
document.getElementById('outputHere').innerHTML = image;
// this example is only to append the value. you can modified it to suit your needs (html code or anything)
}
</script>
"else" is just a synonym for "true". The way to read cond is as a series of tests, where the first test that's true causes that form to be evaluated.
(cond ( (test) (do this) )
( (test) (do this) ) )
Here's your first one
(cond ((eq? x 0) (display "zero\n"))
(display "whatever\n")))
cond looks at (eq? x 0)
and determined that's false. The next clause is (display "whatever\n")
. It looks at display
, and since display
is not nil
, it's true. It then evaluates the string "whatever\n"
, which simply evaluates to itself. So the value of the cond is then "whatever\n"
.
Now, here's you second one:
(cond ((eq? x 0 ) (display "zero\n"))
(else (display "whatever\n"))))
Here, the first test is false, and it goes on to the second one, which is else
and which evaluates to true. (If you think about it, that's what the "else" means in a normal if-then-else: "true for all the cases where none of the previous tests were true.")
Now, the form following it is (display "whatever\n")
. That's a function that sends the string argument to the console and returns nothing because that's what display happens to do. In another scheme, it might return its string value as well as printing it, in which case you'd see
whatever
"whatever\n"
В функции foo
оператор cond
оценивает отобразить
как условие для проверки. Так как действительно есть символ, называемый display
, он оценивается как true, поэтому "независимо от \ n"
затем оценивается как результат (foo 2)
.