|
just another regularban.info web blog |
| MEMBERS: | Reusing Code in Web Sites and Applications Part 1 - Using Include() and Require()
Reusing pieces of HTML code is a common way of making web sites (or web applications) more consistent, reliable, and more manageable. Even a small web site consisting of perhaps 20 or 30 web pages can benefit from reusing code for header and footer sections, for example. If the same header or footer is used across all the pages on the site, it makes sense to put the header and footer code in separate files, and then call those files to insert their contents where required. PHP offers two statements that can be used for inserted the contents of one file inside another: include() and require(). These two statements are virtually identical, with the only real difference being that if require() fails, it gives a fatal error, whereas if include() fails it just gives a warning. For this reason I tend to use the include() statement as it just seems slightly more friendly. So, to include the contents of a file called header.inc inside a web page called index.php, you would just need to insert the following line of code (wrapped in PHP opening and closing tags) inside index.php. Include 'header.inc'; As PHP takes no notice of the extension used for the included file, you can use whatever extension you want to. Be careful though, if you put passwords inside an include file with a .inc extension, they will be visible. You can get around this by putting include files that contain sensitive information outside the document tree to prevent people from browsing to them. In Part 2 we'll look at the use of functions when developing web sites and applications.
How To Build A Site That Attracts Visitors
When it comes to building a website you need to build it with one thing in mind and that is your visitors. Your website needs to be structured in a way that makes sense to those that visit it. While visiting your website if they become confused they will merely hit the back button and you will be left with nothing. Your site needs to make sense and as a consequence you need to lay out the content of the site in a clear concise manner. Avoid clutter and make sure that your navigational structure is easy to follow so that they can find what they are looking for quickly and easily. Structure it in a way that they will follow the path that you desire them to follow. Not only do you need to cater to your human visitors but you also need to take care of your robotic visitors. You want to ensure that the search engine spiders can read and understand the content on your site. This will enable your site to become indexed within the search engines faster for your desired keywords. To ensure this happens you need to focus on relevancy as this will help all your visitors. To conclude search for things that you like using the search engines and make note of the sites that you find are helpful in providing the information that you are looking for then use this as an example. This will help you stay focused and provide a good site with good layout and content for your visitors.
Simple Principles To Help You Build An Effective Website
You know when it comes to doing anything in life its all about implementation. Sure at this juncture you may be overwhelmed and a little confused about what to do. You may have lots of ideas but you just do not know where to start. As a result you do not implement anything you just get confused and overwhelmed and then nothing happens. The first thing you need to do is identify your strengths. This is where you are going to begin. When it comes to building a website you know that its core value is based upon the information it provides. Secondly that information needs to be organized logically. Then that information needs to make sense to your readers and also needs to be understood by the search engines. So having good site structure will benefit all parties concerned. At this point you probably have something in mind about what you want to do online - in other words a subject that you want to build your site around. If not you have some reason for wanting to build a site in the first place and that may be just to share it with friends and family or to make money. Identify your ideas and write them down. Once you have cleared your mind then you will be in a far better position to move onto the next task. The main thing is to understand the main structure of the internet and that is to provide information which can be delivered through multiple mediums such as video, audio, or straight content. Then just make sure that you can deliver this effectively and you will have a solid foundation to build on.
|
* About Archives
Categories:
Last Updated: |
| regularban.info
is proudly powered by WordPress MU running
on regularban.info.
Create a new blog and join in the fun! Entries (RSS) and Comments (RSS). |