Stoppt die Vorratsdatenspeicherung! Jetzt klicken &handeln! Willst du auch an der Aktion teilnehmen? Hier findest du alle relevanten Infos und Materialien:

Archived entries for PHP

PHP Built-in Web Server

Nett PHP 5.4.0 bringt einen eigenen Web Server mit.

This web server is designed for developmental purposes only, and should not be used in production.

URI requests are served from the current working directory where PHP was started, unless the -t option is used to specify an explicit document root.

If a URI request does not specify a file, then either index.html or index.php in the given directory are returned. If neither file exists, then a 404 response code is returned.

If a PHP file is given on the command line when the web server is started it is treated as a “router” script for the web server. The script is run at the start of each HTTP request. If this script returns FALSE, then the requested resource is returned as-is. Otherwise the script’s output is returned to the browser.

Gestartet wird er auf der Kommandozeile mit:

$ php -S localhost:8000

LESS Compiler für PHP

lessphp implementiert LESS in PHP:

lessphp is a compiler that generates css from a small superset language that adds many additional features seen in other languages. It is based off an original Ruby implementation called LESS. For the most part, lessphp is syntactically compatible with LESS, with the exception of a few things noted below.

Find Broken Images Using jQuery AJAX

So was in der Art hatte ich hier schon mal, aber da ich die Idee ganz gut finde poste ich das noch mal:

It’s usually best to repair broken image paths as soon as possible because they can damage a website’s credibility. And even worse is having a user tell you about it. Using jQuery and PHP, you can have your page automatically notify you of broken images.

jQuery:

$(document).ready(function() {
$('img').error(function() {
$.post('ajax-image-error-jquery.php', {
image: $(this).attr('src'),
page: window.location.href
}, function() {
//hide the image?
});
});
});

PHP:

if(isset($_POST['image']))
{
$to = 'errors@yourdomain.com';
$from = 'automailer@yourdomain.com';
$subject = 'Broken Image';
$content = "The website is signaling a broken image!\n\nBroken Image Path: ".stripslashes($_POST['image'])."\n\nReferenced on Page: ".stripslashes($_POST['page']);
$result = mail($to,$subject,$content,'From: '.$from."\r\n");
die($result);
}

Ruby for PHP Developers

Ein Ruby Crash Course für PHP Entwickler:

We could say PHP and Ruby (plus a framework) are the most used language in the Internet. There are many reasons, but the best one for our purpose is they are very similar in some points. So we are going to learn Ruby using those points as a support, and, trust me, if you know a little bit more about PHP than echo, it’s going to be pretty easy to learn the basis of Ruby.

Drupal 7: Anlegen und Aktualisieren von Nodes via Code

Group 42 erklärt wie man mittels node_save() Nodes aus Code heraus anlegen und aktualisieren kann.

A quick note for those of you familiar with Drupal 6. You’ll notice two changes in Drupal 7:
Body Field Is No Longer Special
In Drupal 6 the body field was special. Specifically, it had a different data structure than other fields and it always existed, even if it wasn’t used. With Drupal 7 the body field is a standard field provided by core and is truly optional.
Language
Language specification is required for the node and some fields.



Copyright © 2004–2009. All rights reserved. – Impressum

RSS Feed. This blog is proudly powered by Wordpress and uses Modern Clix, a theme by Rodrigo Galindez.