简体   繁体   English

构建网站页面

[英]Structuring a website's pages

I am new to the web development scene and recently I have started to wonder as what constitutes as a solid structure for organizing my web pages. 我是Web开发领域的新手,最近我开始怀疑是什么构成了组织网页的坚实结构。 I had picked up something that I felt was working for me but after consulting a friend we both ended up on different sides of an argument. 我得到了一些我认为对我有用的东西,但是在咨询了一位朋友之后,我们俩都陷入了争论的不同方面。 I'm hoping I am not asking a question that deems opinion but rather I hope I can get a straight forward answer. 我希望我不是在问一个认为观点的问题,而是希望我能得到一个直接的答案。

The original way my files were organized is as so: 我的文件的原始组织方式如下:

-- website
----- Index.php
----- projects
------------ index.php
------ about
------------ index.php
----- contact
------------ index.php
------ lib
------------ img
------------ js
------------ php
------------ css

The way I was told to structure: 有人告诉我组织的方式:

-- website
----- index.php
----- about.php
----- contact.php
----- projects
------------ index.php
------ lib
------------ img
------------ js
------------ php
------------ css

If someone could give me pointers as to why any is better or worse, that would be much appreciated. 如果有人可以给我指出为什么会有好还是坏的提示,那将不胜感激。 Thanks in advance. 提前致谢。

Is this website for you, open source or going to be on the market? 这个网站适合您使用,开放源代码还是即将上市? In my honest opinion the best file structure is what you are comfy with and can find what you are looking for painlessly. 坦白地说,最好的文件结构就是您所熟悉的文件,并且可以轻松找到所需文件。 If you are planning to make this available to the public either free or paid you can still find the previous usefull. 如果您打算免费或收费向公众提供此功能,您仍然可以找到以前的有用功能。 But if I had to choose between your 2 examples I like the first one since for me looking at folders looks better than a bunch of files. 但是,如果我不得不在您的两个示例之间进行选择,我喜欢第一个示例,因为对我而言,查看文件夹看上去比一堆文件更好。

If you do break it up by files you can in a way make it a bit more "modular" for lack of a better term and include particular assets to the page like its own stylesheet, images, etc 如果确实按文件将其分解,则可以通过某种方式使它更加“模块化”,因为缺少更好的术语,并且可以将特定资产(如其自己的样式表,图像等)包含到页面

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM