Büyük projeler yaparken benim kod biryere almak gibi görünüyor. Siz nasıl kodunuzu organize?
Bir design pattern kullanarak olmalıdır; MVC ile başlayan düşünün.
Kesinlikle bir tasarım deseni takip (diğer yararları arasında) son derece kod tabanının okunabilirliği artıracaktır.
Ayrıca çerçeve kullanmak iyi bir fikir olduğunu (Symfony tavsiye: http://symfony-project.org). İyi dosyaları organizasyon zorlar.
Ben bütün projelerde web uygulaması oluşturmak için CodeIgniter kullanmak beri, ben sadece çerçevenin kılavuz izleyin.
Bir destek dosyası (css, js ve resim dosyaları) koymak için, ben genellikle 2 dizine bölmek. Küresel destek dosyaları için, ben kamu dir koydum:
public
|--> css
+--> images
`--> js
Bir sayfa şablonu için, ben genellikle bir ortağın bu var ya da benim müşteri bunu sağladı. I styles/front
içine tüm dosyaları koymak ve styles/admin
dizin olacaktır. Ben görüntüleri, js, ve bu dizin içinde css herhangi bir düzenleme değişen değilim, bu yüzden ona doğrudan herhangi güncellemeleri koyabilirsiniz.
Ben yapısı aşağıda kullanıyorum ve bu benim için çalışıyor ...
--> Class
--> Action
--> Middle
--> Js
--> Css
--> inc
Above is the folder structure i am using.
There will be four files for each file.
One file at root. in which all other files will include and other configuration files also included.
In Class Folder:
All the classes for any page will be here.
So all DB operation will be here.
In Action File
All the action and method calling will be here.
When any form post. First it will check for action in this file.
And based on action it will call the function which is in class file.
In middle File
All files in this folder will contain the dynamic HTML of the page. Based on action performed in class files HTML will be displayed from here.
In JS folder
All JS related to project will be here.
In CSS Folder
All CSS related to your project will be here.
In INC Folder
All the common files related to your project will be here.
Like
conf.php
sitefunction.php
constant.php