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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T09:50:35+00:00 2026-06-03T09:50:35+00:00

I used PHP years ago but have since been developing in C#/VB.Net. In ASP.Net

  • 0

I used PHP years ago but have since been developing in C#/VB.Net.

In ASP.Net MVC 2, you can provide a master page which defines content areas eg:

<html>
    <head>
        <title>Overshare | <?=$Title?></title>              
        <ContentArea name="Head"/>
    </head>
    <body>
        <ContentArea name="Body"/>
    </body>
</html>

Your view would then have something like:

<Content name="Head">
    <!-- Some Head Content -->
</Content>
<Content name="Body">
    <h1>Some Body Here</h1>
</Content>

I don’t seem to be able to emulate the same functionality with Code Igniter. The options seem to be:

  • manually pre-set some associative array of variables (eg in the controller) and then simply substitute the values into a template file – This is a lot of code to repeat in each view and doesn’t belong in the controller. It also means it’s a real pain to put large bodies of html into one of the ContentAreas – It’s either string concatenation or something equally nasty with almost no chance of HTML intellisense in any IDE.
  • Use a templating library – I haven’t found one which doesn’t fundamentally work as described above

Now, I haven’t used CodeIgniter before and am about to start a large PHP project so want to make sure it’s the correct tool before actually starting work. Am I missing something obvious or is this templating functionality difficult to replicate?

Edit: Libraries tested:

  • Phil Sturgeon’s Template Library
  • CI Smarty
  • PHXView
  • 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-03T09:50:37+00:00Added an answer on June 3, 2026 at 9:50 am

    I ended up creating 3 files which represented the following

    OpenHeader:

    <html>
        <head>
            <Head Stuff/>
    

    OpenBody:

        </head>
        <body>
            <html>
                <Templating Stuff>
    

    Close:

                </Templating Stuff>
            </html>
        </body>
    </html>
    

    And then modified my views to include these three at the appropriate time.

    It’s inelegant but flexible and powerful so it’ll do for now – especially since I can pass varuables eg Page title into the files during the include if I use the CodeIgniter view engine to retrieve them

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

Sidebar

Related Questions

A few years ago I used to work with PHP and there've been many
I've been writing PHP for years, and have used every framework under the sun,
It's been several years since I have used regular expressions, and I was hoping
I've been developing simple PHP/MySQL web sites for some years. Never used a PHP
I have been working with PHP for years and gotten a very good grasp
10 years have ellapsed since I used COM/OLE, and I forget 90% of them.
About 4 years ago I used a php product called amember pro, it is
I've been coding php for years, and now i have to finally make my
I've been programming with PHP for about 6 years, and wanna start developing on
I have written this code having not used PHP for 2 years now to

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.