Jump to content

Managing Web Applications


Cobby

Recommended Posts

Hi all,

 

I have been doing procedural all my PHP life, and have just grasped the basics of OOP and Smarty (template engine). I know want to utilize these in my projects.

I have been looking at how phpBB forums work, and the way I understand it, every page is made up from 5 different pages:

-A config file

-PHP code file

-Header template

-Content template

-Footer template

 

Is this the best way to do it?

I also noticed that in some places they have used OOP, how do I integrated procedural and OOP?

 

Cheers,

Cobby

Link to comment
Share on other sites

Another questions, when referring to another page, is there a better alternative to:

<?php
header("Location: <web address>");
?>

 

Because as you well know, you cant have started rendering html to call that function, which means:

<?php
if($page == "refer"){
   header("Location: <web address>");
}elseif($page == "page"){
  include 'header.php';
  echo "Page.";
  include 'footer.php';
}else{
  include 'header.php';
  echo "Another page.";
  include 'footer.php';
}
?>

 

Instead of having:

<?php
include 'header.php';

if($page == "refer"){
   header("Location: <web address>");
}elseif($page == "page"){
  echo "Page.";
}else{
  echo "Another page.";
}

include 'footer.php';
?>

 

Is there a way to do this?

 

Cheers,

Cobby

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.