adsense

23 Ağustos 2013 Cuma

PHP Ile Bir Style.css Dosyasını Düzenleme

<?php
/**
 * Created by JetBrains PhpStorm.
 * User: WebDeveloper
 * Date: 23.08.2013
 * Time: 15:10
 * To change this template use File | Settings | File Templates.
 */
if(file_exists("style.css"))
{
    if(!$_POST["cssGuncelle"]){
        $dosya  = fopen("style.css","r");
        $css = fread ($dosya,filesize("style.css"));
        echo '
        <form action="index.php" method="POST">
        <textarea name="csscode" cols="90" rows="40">'.$css.'</textarea>
        <input type="submit" name="cssGuncelle" value="Güncelle">
        </form>
        ';
        fclose($dosya);
    }else{
        $dosya  = fopen("style.css","w");
        fwrite($dosya, $_POST["csscode"]);
        fclose($dosya);
        header('Location: index.php');
    }
}
?>


Bu style.css dosyasını (aynı dizindeki, dizin değiştirilebilir) çağırıp, içindekileri bir textarea'ya aktarıp, siz orada düzenleme yapıp güncelle butonuna bastığınızda css dosyanızı günceller.

Hiç yorum yok:

Yorum Gönder