Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9022135
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:25:46+00:00 2026-06-16T05:25:46+00:00

Recently, I wrote a small and functionally CMS, without OOP logic, and with the

  • 0

Recently, I wrote a small and functionally CMS, without OOP logic, and with the famous bad practice to include the header, the content and the footer:

<?php
     require_once("header.php");

     //Content

     require_once("footer.php");
?>

Now, I’m trying to setting up a new CMS, based on the template engine. I read a lot of articles about Smarty & CO. but I think it’s not completly clear because you need to learn this specific language.
So how can I do this?
I’ve been searching for this and just can’t seems to find anything that would fit the bill….

Thanks in adavance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T05:25:47+00:00Added an answer on June 16, 2026 at 5:25 am

    What you need to do is separate the bits of code that generate the content’s data and the bits of code that display the data. In MVC-land the data part would be handled Model/Controller, and the display by the View. To paraphrase your code:

    <?php
    require('data.php');
    require('header.php');
    require('display.php');
    require('footer.php');
    

    Which logically simplifies to:

    <?php
    require('data.php');
    require('display.php');
    

    Your data.php will do nothing but generate the data into particular variables that your display.php will then take and turn into displayable content. It’s best to do all of the content-related work before outputting anything in case you want to go back and change something in an HTML header [ie: page title] or perform an HTTP redirect or other header() operation.

    It’s a good idea to look into the MVC-style of coding for something like this, I’ve found the following two pages to be extremely useful in understanding, and then creating an MVC app.

    http://www.onextrapixel.com/2012/03/14/a-detailed-overview-of-the-model-view-controller-mvc-coding-structure/

    http://www.phpro.org/tutorials/Model-View-Controller-MVC.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently wrote a small C code which uses sockets to listen on a
I recently wrote a small AJAX-based chat program. The clients ping the server occasionally
I recently started working on a small CMS. I usually develop .NET applications in
I recently wrote a Java playing card game and have all the game logic
I recently wrote a small script that made a simple show/hide manipulation to an
I recently wrote a small app which will grab contacts from microsoft Outlook and
I recently wrote a small tool to generate a class for each tier I
I recently wrote a small number-crunching program that basically loops over an N-dimensional grid
I wrote a small jQuery application recently to practise the language and got some
I recently wrote code that didnt work as i would expect, it was: message

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.