Re: Redirecting between PHP Pages
From: Justin Wyer (justin_at_isogo.co.za)
Date: 05/20/04
- Next message: Justin Wyer: "Re: Redirecting between PHP Pages"
- Previous message: Tomislav Petrovic: "Re: Content-Disposition: attachment; filename='' suggestst wrong filename"
- In reply to: Rob Tweed: "Re: Redirecting between PHP Pages"
- Next in thread: Tim Van Wassenhove: "Re: Redirecting between PHP Pages"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 20 May 2004 09:52:29 +0200
Rob Tweed wrote:
> Very interesting and very helpful, thank you - I can see how this
> approach answers my original questions.
>
> A follow-up question: In a very large web application you may have
> hundreds of "pages" and so the conditional logic that determines at
> run-time which ones get displayed within the container index.php at
> any specific time could get pretty complex, particularly if you had
> multiple forms and/or multiple submit buttons that cause different
> actions and transitions to different "pages".
>
> Doesn't this begin to become difficult to manage with this approach?
>
> What techniques do people tend to use to keep the mechanics both
> manageable and maintainable? Do people tend to use database-driven
> decision-tree logic for this, or does it tend to be coded into each
> "page" - I can envisage either approach working.
>
>
> PHP is now my prefered platform for web development by the way - its
> power and flexibility never fails to impress me, and there's always a
> new trick or technique lurking in there to make life easier - I love
> it!
>
>
>
> On Wed, 19 May 2004 16:08:22 +0200, Justin Wyer <justin@isogo.co.za>
> wrote:
>
>
>
>>Rob you can do all of this in one page say index.php, you are mistaking
>>displaying output with requiring multiple files
>>
>>if ($_POST['postform'] == "login")
>>{
>> ..... Validate the user details however u like
>>}
>>
>>if ($uservalidated == true)
>>{
>> ..... Display page here
>>}
>>else
>>{
>> ..... Display login form
>>}
>>
>>Now in your html you display for the login form
>>
>><form action="index.php" method="post">
>><input type="hidden" name="postform" value="login"/>
>>......... rest of form
>>
>>Most sites only run off of their index.php and just call functions from
>>other php files, you should never need a redirect your page except to
>>reload index.php before any output for some reason, you can dump any
>>varibles u need to carry over in a rediect into your session, try
>>running your index.php like the void main() of a c app you will find
>>life becomes much easier.
>
>
> ---
> Rob Tweed
> M/Gateway Developments Ltd
>
> Global DOMination with eXtc : http://www.mgateway.tzo.com
> ---
That is the main reason I use a template engine so I can seperate my
design from my implementation, smarty really helps with this, I normally
run an index.php and a few other php files I have written which I use
like modules, my sessions.php, db.php and stats.php along with a
functions.php which I dump any functions I write for that specific site
in. Then I will normally store the actual page data in a database in say
a blog or news style site, then I just grab that from the database and
pass it on to smarty which then displays it as html for me.
My code style is to seperate things as much as possible, thats why I use
smarty, and if you see how I do html, I dump all my html effects into
a css file to unclutter my html as much as possible aswell. I guess it
all comes down to whats easiest for you.
I fully agree with you in that php is an awesome web development tool.
It is infact the best solution for the web, and I to always seem to be
able to find a solution to any problem I encounter, and the php manual
is the best reference any programming language has ever had.
I can truly say "Viva PHP!"
- Next message: Justin Wyer: "Re: Redirecting between PHP Pages"
- Previous message: Tomislav Petrovic: "Re: Content-Disposition: attachment; filename='' suggestst wrong filename"
- In reply to: Rob Tweed: "Re: Redirecting between PHP Pages"
- Next in thread: Tim Van Wassenhove: "Re: Redirecting between PHP Pages"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]