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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T19:53:46+00:00 2026-05-28T19:53:46+00:00

How can I convert a HTML template into a live php-editable template? I’d like

  • 0

How can I convert a HTML template into a live php-editable template? I’d like to be able to set the title, description, add images and links. (something like the behance uploading system)

Can someone link me to a tutorial?
Thanks a lot!

  • 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-28T19:53:47+00:00Added an answer on May 28, 2026 at 7:53 pm

    To do this in a simple way, you should follow this 3 steps :
    1- Add custom tags in your HTML template
    2- Create a class to make your HTML template writable
    3- Load the class, write your template, display the page

    1. First, insert some custom tags in your HTML template (template.html), like this :

    2. Then, create a quick class (class.php) to make your custom tags writable :

          class Template { var $contents;
      
      
          function load($file) {
              if ($fp = fopen($file, "r")) {
                  $this->contents = fread($fp, filesize($file));
                  fclose($fp);
              }
          }
      
          function replace($str,$var) {
              $this->contents = str_replace("<".$str.">",$var,$this->contents);
          }
      
          function show() {
              $search = array(
                      '/\t/', //Remove Tabs
                      '/<!--[^\[-]+?-->/', //Remove Comments
                      '/\n\n/' //Remove empty lines
                      );
                  $replace = array(
                      '',
                      '',
                      ''
                      );
              $this->contents = preg_replace($search, $replace, $this->contents);
              echo $this->contents;
          }
      }
      

    Once this is done, you must create a function to write inside your tags. In my example, to be able to write your <page_title> tag, add the following code to your class.php file :

    function writetitle($s) {
        $GLOBALS['writes']++;
        $GLOBALS['page_title'] .= $s;
        return;
    }
    
    1. Finally, all you need is to do is to create your page.php. Load the class, write what you want, and display the result.

    Something like :

    <?php
        require_once('class.php');    //Load Class
        $template = new Template;    
        $template->load("template.html"); //Load HTML template
    
        //Some query :
        $query = mysql_query('SELECT...');
        $res = mysql_num_rows($query);
    
        writetitle('my page title went live!, '.$res.'');  //write your content
    
    
        $template->show(); //Generate the page
    ?>
    

    writetitle now acts as an echo, so you can make queries and everything you want.

    In the end you have 3 files :
    tempalte.html : your template
    class.php : your template engine
    page.php : an example page usging your template.

    hope it helps. 😉

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

Sidebar

Related Questions

How can I convert markdown into html in .NET? var markdown = Some **bold**
how can i convert xpath like /html/body/div[3]/ul/li[1]/a[5] html > body > div[3] > ul
Is there a way to convert HTML into XAML? I noticed that you can
can I convert a string to a html object? like: string s = '<div
Possible Duplicate: Convert .doc to html in php I want to know how can
How i can convert to c# code files to html files?Is there any generation
How can I convert PDF files to HTML with Python? I was thinking something
You can convert a negative number to positive like this: int myInt = System.Math.Abs(-5);
I am looking forward to an api that can convert html to mobi/epub format
Does anybody know how I can convert html to plain text with Ruby. Well

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.