Re: How to call different methods in one PHP file?
From: Paulus Magnus (paulus.magnus_at_loves-spam.com)
Date: 10/07/03
- Next message: Anthony Whitehead: "Re: Unable to use $_SERVER['HTTP_REFERER']"
- Previous message: 127.0.0.1: "Re: Idea for PHP Enhancement: register_globals_manual"
- In reply to: Bruce W...1: "How to call different methods in one PHP file?"
- Next in thread: Bruce W...1: "Re: How to call different methods in one PHP file?"
- Reply: Bruce W...1: "Re: How to call different methods in one PHP file?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 7 Oct 2003 11:10:52 +0000 (UTC)
"Bruce W...1" <bruce@noDirectEmail.com> wrote in message
news:3F824383.328B780@noDirectEmail.com...
> I'm a PHP newbie coming from experience with ASP.NET. I want to have a
separate
> PHP file to support each HTML PHP page. This would be the equivalent of
an
> ASP.NET code-behind file but using PHP.
>
> For one page to do a variety of different things I need to call different
> methods (or functions) in the PHP code file that is dedicated to this
purpose.
> How do you do this? How do you call just one method?
>
> Thanks for your help.
It isn't good programming style to use one PHP file per HTML page. Classes
should be based on functionality, as should PHP files. If all your pages
were to do with a membership system then you should have a Member class with
methods appropriate to that functionality.
If you've got a group of functions that perform similar actions you should
include them in a functions.member.inc.php file and include them where you
need them. You should group functions/methods by functionality rather than
per page as it will reduce the repetition element, imo.
Paulus
- Next message: Anthony Whitehead: "Re: Unable to use $_SERVER['HTTP_REFERER']"
- Previous message: 127.0.0.1: "Re: Idea for PHP Enhancement: register_globals_manual"
- In reply to: Bruce W...1: "How to call different methods in one PHP file?"
- Next in thread: Bruce W...1: "Re: How to call different methods in one PHP file?"
- Reply: Bruce W...1: "Re: How to call different methods in one PHP file?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|