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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T18:48:57+00:00 2026-06-01T18:48:57+00:00

I know a bit about PHP, but never studied in depth, but now I

  • 0

I know a bit about PHP, but never studied in depth, but now I will develop some real sites.

One doubt I have is about writing the common HTML elements like Doctype, head and fixed layout like menus or top. I always created a class called Layout to write these parts of the page, and so, in every page, I call the methods of Layout class to build the layout and basic HTML elements.

My question is if there is another way to do this without the need to call the Layout methods in every page, or maybe, no need for a Layout class. Something like a pattern file with the basic HTML for every page or something like that.

So, something like this exists or is needed to put calls in my code to generate the basic HTML content?

  • 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-01T18:48:58+00:00Added an answer on June 1, 2026 at 6:48 pm

    You could try to use a template engine like Twig or Smarty. In the other case if want keep it simple, you can make a file e.g. posts.php and include partials like header.php or footer.php which contains its data

    <!doctype html>
    <html class="no-js" lang="">
        <head>
            <meta charset="utf-8">
            <title>HEY</title>
            <meta name="description" content="">
            <meta name="viewport" content="width=device-width, initial-scale=1">
        </head>
        <body>
            <?php include_once('header.php'); ?>
    
            <?php $posts = ["a", "b", "c"]; ?>
            <?php foreach ($posts as $post): ?>
                <div><?php echo $post; ?></div>
            <?php endforeach; ?>
    
            <?php include_once('footer.php'); ?>
        </body>
    </html>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I know a bit about assembly programming in Microchip PIC micro controllers, but I
I don't know very much about css, but i'm a tid bit stuck. I
I need to delete some data from mysql. I know a bit of php
I am building a free WP theme but know next to nothing about PHP.
So I know javascript pretty well, but I'm not sure about this one. Tough
Yes, i know. I see a lot of questions about it. But no one
I know its a bit of a tricky question but like the information about
I know a little bit of regex, but not mutch. What is the best
I am new to Perl, but I know a little bit of C though.
This one is a huge issue: first off, while I know a little bit

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.