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

The Archive Base Latest Questions

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

I’m working on a project using CodeIgniter. Surely, it’s very useful to have an

  • 0

I’m working on a project using CodeIgniter. Surely, it’s very useful to have an helper like language as the string you’re going to print can change depending on the language you loaded. So, instead of writing pure php code, you can use the helper.

However, it’s not clear to me which is the sense of helper function like:

echo doctype();

that expands to:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

Of course, the first one it’s easier to write, but that code has to be processed every time. You save few seconds of coding at the cost of infinite executions of the same code that has always the same output on each page (and there are many helper like that one, for example the Form Helper is plenty of valid examples where the functions produce static HTML code).

So, the question is: why should I use an helper if I don’t have any dynamic code/variable to add?

  • 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-12T18:52:07+00:00Added an answer on June 12, 2026 at 6:52 pm

    For some things it might not make sense. Possible excuse for doctype() would be if you wanted to change your doctype for several pages, you could do it by changing the output of the function. Personally I use a single master template with the doctype, but different people will do things differently.

    Same excuse applies to something like heading('My Title', 1), some day you might need to change the output from <h1>My Title</h1> to <h1><span>My Title</span></h1>, and if you had used the heading function throughout your application, it would be trivial. You could even add extra parameters to make it more flexible.

    Of course as you surely know, do whatever works best for you for the given situation. Sometimes HTML helpers can save you time, other times they will just get in the way. I wouldn’t worry too much about how long it takes to execute, because it is hardly significant.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
I would like to count the length of a string with PHP. The string
I have thousands of HTML files to process using Groovy/Java and I need to
I have a .ini file as follows: [playlist] numberofentries=2 File1=http://87.230.82.17:80 Title1=(#1 - 365/1400) Example
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but

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.