$connection = ftp_connect($server);
$login = ftp_login($connection, $ftp_user_name, $ftp_user_pass);
if (!$connection || !$login) { die('Connection attempt failed!'); }
$upload = ftp_put($connection, $dest, $source, $mode);
if (!$upload) { echo 'FTP upload failed!'; }
ftp_close($connection);
<?php
use Nette\Application\UI;
class FooControl extends UI\Control
{
public function __construct(...)
{
//predani parametru a zavislosti
}
public function attached($presenter)
{
parent::attached($presenter); //nezapomenout zavolat
if($presenter instanceof UI\Presenter) { //jelikoz to muze byt i necho jinyho
//tady nejdriv muzes pracovat s presenterem - vytvaret linky, plnit sablonu....
}
}
public function handleFoo($bar) //zpracovani signalu foo s parametrem bar
{
//...
}
public function render()
{
$this->template->...
$this->template->render();
}
/*
jeste existujou pohledy pro komponenty, ale ty nedoporucuju, nefungujou s ajaxem
vykreslujou se pomoci {control foo:view}
v {control} muzes i predavat parametry, {control foo $xx, $yy} ale taky nedoporucuju, stejny problem jako s view
*/
public function renderView()
{
}
}
}
<!DOCTYPE html>
<html>
<head>
<style>
form {height:1.2em;border:1px solid black; overflow:hidden; float:left; padding-right:0.5em;}
form:hover, form:active {height:5.2em; overflow:scroll; overflow-x:hidden;}
</style>
</head>
<body>
<form>
Komu poslat<br>
<input type="checkbox" name="names[]" value="Fero">Fero<br>
<input type="checkbox" name="names[]" value="Alena">Alena<br>
<input type="checkbox" name="names[]" value="Tomas">Tomas<br>
<input type="checkbox" name="names[]" value="Foreveryone">Foreveryone<br>
<input type="checkbox" name="names[]" value="Patres10">Patres10<br>
</form>
</body>
</html>
function pridatPopisky(el) {
var popisky = el.getElementsByTagName("th");
var radky = el.getElementsByTagName("tr");
for (var i = 1; i < radky.length; i++) {
var bunky = radky[i].getElementsByTagName("td");
for (var j = 0; j < bunky.length; j++) {
bunky[j].setAttribute("popisek", $(popisky[j]).html());
}
}
}
$.fn.toggleInputValue = function(){
return $(this).each(function(){
var input = $(this);
var defaultValue = input.val();
input.focus(function() {
if(input.val() == defaultValue) input.val("");
}).blur(function(){
if(input.val().length == 0) input.val(defaultValue);
});
});
}
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<title>jQuery Modal Demo</title>
<style>
* {
margin:0;
padding:0;
}
#overlay {
position:fixed;
top:0;
left:0;
width:100%;
height:100%;
background:#000;
opacity:0.5;
filter:alpha(opacity=50);
}
#modal {
position:absolute;
background:url(tint20.png) 0 0 repeat;
background:rgba(0,0,0,0.2);
border-radius:14px;
padding:8px;
}
#content {
border-radius:8px;
background:#fff;
padding:20px;
}
#close {
position:absolute;
background:url(close.png) 0 0 no-repeat;
width:24px;
height:27px;
display:block;
text-indent:-9999px;
top:-7px;
right:-7px;
}
</style>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script>
var modal = (function(){
var
method = {},
$overlay,
$modal,
$content,
$close;
// Center the modal in the viewport
method.center = function () {
var top, left;
top = Math.max($(window).height() - $modal.outerHeight(), 0) / 2;
left = Math.max($(window).width() - $modal.outerWidth(), 0) / 2;
$modal.css({
top:top + $(window).scrollTop(),
left:left + $(window).scrollLeft()
});
};
// Open the modal
method.open = function (settings) {
$content.empty().append(settings.content);
$modal.css({
width: settings.width || 'auto',
height: settings.height || 'auto'
});
method.center();
$(window).bind('resize.modal', method.center);
$modal.show();
$overlay.show();
};
// Close the modal
method.close = function () {
$modal.hide();
$overlay.hide();
$content.empty();
$(window).unbind('resize.modal');
};
// Generate the HTML and add it to the document
$overlay = $('<div id="overlay"></div>');
$modal = $('<div id="modal"></div>');
$content = $('<div id="content"></div>');
$close = $('<a id="close" href="#">close</a>');
$modal.hide();
$overlay.hide();
$modal.append($content, $close);
$(document).ready(function(){
$('body').append($overlay, $modal);
});
$close.click(function(e){
e.preventDefault();
method.close();
});
return method;
}());
// Wait until the DOM has loaded before querying the document
$(document).ready(function(){
$.get('ajax.html', function(data){
modal.open({content: data});
});
$('a#howdy').click(function(e){
modal.open({content: "Hows it going?"});
e.preventDefault();
});
});
</script>
</head>
<body>
<a id='howdy' href='#'>Howdy</a>
</body>
</html>