You are here: Re: Is there a more efficient way to do this? « PHP Programming Language « IT news, forums, messages
Re: Is there a more efficient way to do this?

Posted by Rik on 08/16/06 00:27

Chung Leong wrote:
> Rik wrote:
>> Well, the template file can also be reused as easily :-). But this
>> is just a sidetrack, I understand you want the same function to
>> apply to different pages, even projects, and keep them alike. If one
>> only plans on doing one project (someone only doing his own
>> homepage, something like that), you CAN make your code as reusable
>> as hell, but it probably isn't worth the hassle.
>
> I didn't say the method doesn't work. I said it's hamfisted.
>
>> Let's say I have an included file with all my functions. One blurts
>> out a header, another one a footer, and another a tablecell, an
>> anchor, you name it. I'd have a hell of a time to make an interface
>> where people couldn't change the functions, but can change the HTML,
>> and only the HTML.
>
> That's a non-issue. If that becomes a requirement, then you can change
> the function. And if that's a requirement from the start, doing an
> include on the file is a crappy method as it basically allows the
> end-user to blow away the server.
>
>> So to sum it up: you have a point from a developers standpoint. For
>> someone doing one page in his spare time it could well be overkill.
>
> Writing a function is not an overkill--it's basic programming.

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.

Just have functions like:
page1(){
?>
the actual HTML content of page 1
<?php
}

etc. etc.

Yep, that will be good coding, and easily maintainable.
--
Rik Wasmus

 

Navigation:

[Reply to this 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

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