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

  • Home
  • SEARCH
  • 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 8690861
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T23:59:52+00:00 2026-06-12T23:59:52+00:00

I have built an MVC php application and was wondering, if instead of having

  • 0

I have built an MVC php application and was wondering, if instead of having to write out a large amount of html and set the data, could I not just have all this html (with some php) in a separate file and just require it?

For example:

$test = '<div>
         Test content
         <div>More content</div>
         </div>';
$APP->Template->setData('test', $test, FALSE);

Instead could I not just use:

$test = require("includes/content.php");
$APP->Template->setData('test', $test, FALSE);

Would this be considered as bad practice? It just seems that by requiring files, it can shorten the length of controllers.

Would be good to get anybodies advice on this matter.

  • 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-12T23:59:53+00:00Added an answer on June 12, 2026 at 11:59 pm

    It depends on where you do the includes: if you do them in your Model, that would be wrong. However, in the view it would be alright.

    It is a matter of separation of concerns: the model is the backbone of your application, while the view is responsible for displaying results from the model.

    I do not see, how includes would shorten the length of the controller.

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

Sidebar

Related Questions

I have a PHP application that is built around the MVC architecture without any
All, I have a PHP Web application built using Zend Framework and MVC with
I have a PHP web application built with CodeIgniter MVC framework. I wish to
I have a layered web application that I built with ASP.NET MVC 4, WebAPI
I have a custom-built MVC PHP framework that I am in the process of
I am using codeigniter php MVC framework to develop a web application. I have
This is my problem, I have a tiny PHP MVC framework i built. Now
I have been asked to build a PHP application that inserts data into a
I am thinking to refactor some code in a MVC application built in PHP
We have an a PHP application that we are converting to MVC. The goal

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.