Technical Discussion
  >> Web Design / HTML / Web hosting Forum


Register (or login) on our website and you will not see this ad.


These posts have been archived and can no longer be replied to or modified.
Pages in this thread: 1 | [2] | (show all)   Print Thread
Standard User camieabz
(legend) Wed 24-Nov-10 15:42:59
Print Post

Re: Recommend an Apache server for Windows


[re: deleted] [link to this post]
 
Still getting problems due to some files being on different levels to the index.php (thus the calling of the header, and thus the css is wrong).

It occurred to me that all of my pages will use 'header.php'. Equally, I only plan to have one stylesheet, so I'm wondering if it would be easier all round if I include the css code in the head section of header.php

In that sense, there would be no stylesheet, and one less http request. The argument for a stylesheet is that the called for file gets cached. I assume the header.php with the style code would get cached too?

Standard User camieabz
(legend) Wed 24-Nov-10 16:30:08
Print Post

Re: Recommend an Apache server for Windows


[re: deleted] [link to this post]
 
Right. Tis fixed.

The Apache server created a folder called xampp within htdocs. I had dumped all my design pages into this folder, so was not operating from the root folder.

Since moving all to root, all I had to do was add some ../ code to each image line to ensure all relative links moved to root before progressing down their path.

Still not sure whether it's a good idea to keep the css in the header.php or not. One could argue that if header.php were to fail, then I'd lose navigation and styling. That's the only drawback as far as I can see.

Standard User deleted
(deleted) Wed 24-Nov-10 20:24:29
Print Post

Re: Recommend an Apache server for Windows


[re: camieabz] [link to this post]
 
There is a way to do this with php using:

Text
1
$_SERVER["DOCUMENT_ROOT"];


I can check this out at home (I have used it on another website), but basically (I think) it sets the path that your html is in so you can easilly go back and forth using relative links...


Register (or login) on our website and you will not see this ad.

Standard User camieabz
(legend) Wed 24-Nov-10 22:44:52
Print Post

Re: Recommend an Apache server for Windows


[re: deleted] [link to this post]
 
Yes, I spotted that in my php googling, but have never used, so was a little unsure of it.

I might look into it later on. Now that my paths are working, I'm keen to move onto other aspects for now. It's definitely one to ponder on before going live.

Standard User deleted
(deleted) Thu 25-Nov-10 11:05:08
Print Post

Re: Recommend an Apache server for Windows


[re: camieabz] [link to this post]
 
There are endless possibilities on how you can organise your code and I am unsure how you are doing yours. When I look back at the coding I did when I first started learning php I am somewhat horrified. Even in the beginning I used templates but I used to cram all sorts into it and still ended up duplicating code (and that defeats the point of templates!).

I still only code php for my own interest really but now I have torn to pieces part of a site I was working on a while ago and use that now as a basis for my coding and I also use smarty which is a template engine that seperates your php and html code.

Nowadays some of my php pages are tiny:

Text
1
23
45
67
89
10
<?php
 include_once("include_files.php");
 //load templates
$smarty->display(TEMPLATE_SITE_LAYOUT);$smarty->display(TEMPLATE_INDEX);
$smarty->display(TEMPLATE_SITE_FOOTER); 
?>


Each page calls include_files.php which defines where everything is and in turn includes many other files. By the time a page has displayed my script will have easily accessed over 20 php files and 3 template files smile

If my 'header' files failed then the whole site would fail but I can't think why it would just fail and losing css is generally an irrelevance to whatever else stops working smile
Standard User camieabz
(legend) Thu 25-Nov-10 14:11:31
Print Post

Re: Recommend an Apache server for Windows


[re: deleted] [link to this post]
 
Do you find that increased requests decrease response times at all?

Standard User deleted
(deleted) Thu 25-Nov-10 14:29:58
Print Post

Re: Recommend an Apache server for Windows


[re: camieabz] [link to this post]
 
No, well certainly nothing perceivable. If you were to look at any CMS (joomla, drupal etc.) or something like phpbb you will see that they all use millions of files all over the place. My setup is very similar to phpbb - i do wonder if someone stripped that down for the site I worked on... and I then took it and stripped it down further! So, I imagine that many people who are more knowledgable than me and create professional products seem to think it has no effect on performance but can lead to much more efficent coding (as long as you remember where everything is! tongue ).

Edited by deleted (Thu 25-Nov-10 14:30:38)

Pages in this thread: 1 | [2] | (show all)   Print Thread

Jump to