Reply to Re: Is there a more efficient way to do this?

Your name:

Reply:


Posted by Rik on 08/16/06 10:01

Chung Leong wrote:
> Rik wrote:
>> Chung,
>> I can follow you to a certain point here, but according to your
>> logic the use of more then 1 file is always useless. just one big
>> >200K index.php, functions at the start, huge nested if statements
>> further on. If you page changes you can just change that file("If
>> that becomes a requirement, then you can change the function").
>> Basic programming.
>
> If you can't back up your own argument, go change the other person's,
> right?
>
> Let us examine your suggestions again. Here's the first:
>
> --page.php------------
> include('head.html');
> /* generate content */
> include('foot.html');
> ----------------------

Which is fine and perfectly allright for a static head.

> Now, the OP wants each individual page to have its own
> title--reasonable enough. How would we do it in this scheme? It's
> doable here since an include is used instead of readfile.

Look here, if you'd replied to THAT particular post it's another story,
admittedly, as soon as the head section isn't static anymore it's highly
debatable wether or not the include is a good way of doing it. You replied
to a post however, that still assumed a static head.

> As simple as it is, this method is not terrible convinient. Because
> head.html and foot.html are not valid HTML files, you can't preview
> them in the browser (or Window Explorer). If you try to edit them with
> editor like Dreamweaver, it won't work. You end up having to maintain
> a separate file, then spliting them into head/foot.html everytime you
> make a change.

Nope, a html textarea suits loading the HTML content suits just fine.
Previewing heads/closing tags is nonsense to begin with, they will display
very little on you page.

> Your second suggestion is even worse:
>
> --.htaccess------------
> php_flag auto_prepend_file head.html
> php_flag auto_append_file foot.html
> -----------------------
>
> A. You're locked into using Apache for no good reason. B. You need to
> maintain a hash table in head.html with all the page titles. C. To get
> the right title you'd need to regexp the request URI for something
> unique--ugly to say the least. D. You can't redirect form these pages.
> E. These pages end up with different URLs (their own and relative ones
> inside them) just because they have the header/footer while others do
> not.


One again, ig the HTML files are totally static, this method is allright,
and will save you a lot of hassle. Once it goes dynamic it's not that
attractive anymore I admit. It is however usefull for functions / class
declarations in environments < PHP5 (in which the autoload option has my
preference).

I'd say my argument stands:
- Static? => including works just fine.
- Dynamic? => better of in classes/objects/functions/whatever.

Grtz,
--
Rik Wasmus

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация