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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:07:08+00:00 2026-05-13T08:07:08+00:00

I was looking at templating systems for php, and I’ve come to believe that

  • 0

I was looking at templating systems for php, and I’ve come to believe that pure php code seems to be the solution I want to use.

I’m the lone developer, so there’s no designers who need a nerfed arena to work in. Template engines like smarty seem to suffer from the “Inner-platform effect”. If I stick with good practices ( pre-computed values, use only foreach ), I think this will work.

My goal is to have a single source for the string of the html shared by each page. My thought is that a separate php file, accessed via include, is a good way to meet this goal.

However, I’m concerned that that might pose a security hazard for the site — I can’t think of anything specific at the moment, but someone could guess the name of the template and request it directly, perhaps exposing something they needn’t see. (I suppose I could put in a check to see if it itself is the request.) I have a hunch this could be bad, so I don’t want to go ahead and do it, create what I feared would happen, and then throw that work away.

If a separate file is not the best idea, what else should I use to basically store a string for the whole site? A string constant in an include, that I could use in sprintf()? A function that returns the html string from arguments of the page-specific html parts?

  • 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-05-13T08:07:09+00:00Added an answer on May 13, 2026 at 8:07 am

    Files that should not be served via HTTP should be stored in a directory from which your webserver will not allow anything (not PHP, at least) to be served to the users.

    Two possibilities :

    • put those files outside of the DocumentRoot
    • or put those files in a sub-directory, from which Apache will not be able to serve any file.

    Such “not served” files generally include stuff like :

    • configuration files
    • libraries / frameworks
    • data files (like an SQLite database, for instance ; or i18n files)

    The first solution : your directories could look like this :

    • data/
      • i18n/
      • i18n/your-file-here.php
    • library/
    • www/            <- this is Apache’s DocumentRoot
      • index.php
      • another-php-file.php

    And for the second solution, just disable access to the directory containing your “data” or “libraries” files, putting in it a .htaccess (If your webserver is Apache) file containing something like

    Deny From All
    

    With that, Apache will not allow anyone to directly access via HTTP the files in that directory, but your executable PHP script (in another directory) will still be able to include them.

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

Sidebar

Related Questions

I'm looking for a secure templating language for Java that business users can use.
I'm looking for a templating language that I can use to generate html on
I am looking for a simple templating solution for ruby, i.e. something that will
I am looking at some good templating systems to be used alongwith an MVC
Looking at some of the code System.Linq I've come across some examples of Buffer<TSource>
I'm looking for a templating tool that allows powerful manipulation of data and report
In the Tridion templating manual (I'm looking at 2009 SP1) it explains that you
I wrote a small PHP application that I'd like to distribute. I'm looking for
I'm looking for something like Sencha Touch that isn't so heavy. I don't want
I am looking for a really simple PHP image gallery system that allows file

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.