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 8302637
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:20:14+00:00 2026-06-08T17:20:14+00:00

I have the following data flow for a simple login form. User access controller

  • 0

I have the following data flow for a simple login form.

User access controller PHP file. Controller includes model.php and view.php

User submits form, controller sends POST data to model methods, and gets a result back.

User is logged in, and forwarded to a different view (login success message) by the controller.

Currently my views are static HTML (no PHP), so here is my question. What is the correct way to then pass the user a welcome message, e.g “Hello, Craig!”?

Is the view allowed PHP snippets, e.g

<?php echo $username; ?> 

since the model is loaded before it in the controller file?

Thanks!

Edit: Is it better practice then to allow the view to access specific class methods e.g

<?php $user->getUsername(); ?>

as opposed to just variables?


Based on other answers, I have found a very useful article, which you may also be interested in.

http://www.nathandavison.com/posts/view/7/custom-php-mvc-tutorial-part-5-views

  • 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-08T17:20:15+00:00Added an answer on June 8, 2026 at 5:20 pm

    You can really put anything in a view that you’d like, but to better adhere to the MVC way of doing things you should restrict PHP in the view to simple echos or prints (possibly really small loops as well, although even those can be pre-calculated in the controller/model). Since that is the only way to get dynamic content, it would be a little silly to say that they are not allowed.

    The idea of the view is to let it have a more HTML look-and-feel, so that front-end developers or people who don’t know PHP can easily be able to work with the file without getting confused.

    Update

    To learn more about MVC in general, you can see any of these (there’s a ton of tutorials out there):

    http://blog.iandavis.com/2008/12/09/what-are-the-benefits-of-mvc/

    http://php-html.net/tutorials/model-view-controller-in-php/

    http://www.tonymarston.net/php-mysql/model-view-controller.html

    To see concrete examples of PHP using MVC, I suggest downloading some of the more prevelant frameworks (such as CodeIgniter, Symfony or Drupal) and just looking through the code. Try to figure out how it works and then recreate the functionality for a simple article-based system.

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

Sidebar

Related Questions

I have following data to save in database using php my data is :
I have following data in a file called binFile 78 1 79 4 80
I have a data flow component, comprise of the following : 1.) Read Excel
I have a very simple SSIS package where I take data from a view
I have the following Data Flow task in my SSIS package: alt text http://img228.imageshack.us/img228/358/ssis1.png
I have an SSIS package which reads an Excel File (Data Flow Source) and
I have following data frames > head(elo) date elo 1 1921-12-18 1597 2 1922-05-14
I have following data structure (simplified): A giant list of the class TestClass public
I have following data in my table. alt text http://img26.imageshack.us/img26/3746/productfield.png I want to extract
I have following data in excel table r1 r2 r3 r4 r5 v1 v2

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.