function xml() { $min = $this->min_count(); $max = $this->max_count(); for($i = $min; $i <= $max; $i++) { if($i <= 5000) $ktora = 1; if($i >= 5000 and $i <= 10000) $ktora = 2; if($i >= 10000 and $i <= 15000) $ktora = 3; if($i >= 15000 and $i <= 20000) $ktora = 4; if($i >= 20000 and $i <= 25000) $ktora = 5; if($i >= 25000 and $i <= 30000) $ktora = 6; if($i >= 30000 and $i <= 35000) $ktora = 7; if($i >= 35000 and $i <= 40000) $ktora = 8; if($i >= 40000 and $i <= 45000) $ktora = 9; if($i >= 45000 and $i <= 50000) $ktora = 10; if($i >= 50000 and $i <= 55000) $ktora = 11; if($i >= 55000 and $i <= 60000) $ktora = 12; if($i >= 60000 and $i <= 65000) $ktora = 13; if($i >= 65000 and $i <= 70000) $ktora = 14; if($this->count($i) > 0) { $dane = ' <url> <loc>http://www.123.pl/'.$this->znaki($this->dane($i)).','.$i.'.html</loc> <lastmod>'.$this->data().'</lastmod> <changefreq>weekly</changefreq> <priority>1.0</priority> </url>'; } $this->zapis($ktora, $dane); }
Tu całość kodu: http://pastebin.com/aRFWqw9D
Teraz moje pytanie jak przerobić by zmienna "$ktora" tworzyła się automatycznie.
Próbowałem tak:
if($i%5000==0) $ktora = $i / 5000; elseif($i == $min) $ktora = 1;
I jeszcze takie pytanie, czy w miarę dobrze to jest napisane jeśli chodzi o oop
