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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:18:03+00:00 2026-06-11T02:18:03+00:00

I have admin panel in which I can create categories. When I create categories

  • 0

I have admin panel in which I can create categories. When I create categories I auto create folders in htdocs… for example… categorie/first , categorie/second and so on

And what I want to do, is that when I create these folders I auto create index.php with code I need… First variant is using file functions… but then how do I put in string php commands?
second.. and I guess the right one, is to create this template.. and when I create these folders it copies to directory I created…

So what you think?

edit…
BUT I need to store in this code variable with current categorie opened.

  • 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-11T02:18:04+00:00Added an answer on June 11, 2026 at 2:18 am

    One solution is to write your code like that :

    // Creates a template of category
    $page = <<< EOT
    
    <html>
        <head>
            <title>Category {$category_name}</title>
            (...)
    
        </body>
    </html>
    EOT;
    
    $f = fopen($new_directory . "/index.php", 'w');
    fwrite($f, $page);
    fclose($f);
    

    Remeber to put EOT; at the very left side of your document. See the heredoc syntax for details.

    This code is a sample, you need of course to check if fopen/fwrite have succeeded.

    Another solution could be to have a template in another file with template tokens.

    In such way, you will have a file named template_category.txt which contains :

    <html>
        <head>
            <title>Category %category_name%</title>
            (...)
    
        </body>
    </html>
    

    Then, in your PHP script, you’ll do replace template tokens by your values :

    $template = file_get_contents("template_category.txt");
    
    $to_replace = array(
        '%category_name%',
        (...)
    );
    
    $replace_by = array(
        $category_name,
        (...)
    );
    
    $page = str_replace($to_replace, $replace_by, $template);
    

    And you write $page on index.php like above.

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

Sidebar

Related Questions

Let's say I have a site where Users can add Entries through admin panel.
I have wrote a Windows Service and I have a admin panel which I
I would like to have django admin panel with tornado backends, which will process
In my project, have setup an admin panel under a folder inside controllers folder
I have a log function on my admin panel that checks user input for
I have integrated CKeditor with my admin panel (php) I have writtien a function
I am using my admin panel login script where i have created a global.php
I tried to make admin panel and I am using sessions , but have
I'm working on an app in CodeIgniter, and I want to have admin pages
Okay so I'm working on an admin panel, in which everything should always be

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.