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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T10:30:41+00:00 2026-05-23T10:30:41+00:00

I have dozens of .shtml files on the server which include this statement to

  • 0

I have dozens of .shtml files on the server which include this statement to include .inc files:

 <!--#include virtual="../v4/rightmenu.inc" -->

This is exactly how it shows on the source which is working just fine.

I am wondering whether I can run this on my php code without changing it since the current files has this kind of inclusion a lot and I don’t want to mess with a lot of code like this one.

I just don’t want to change it to something like <?php include "../v4/rightmenu.inc"; ?>

  • 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-23T10:30:42+00:00Added an answer on May 23, 2026 at 10:30 am

    Use mod_rewrite to route all requests to .shtml files through a single php file. For exapmle: _includeParser.php

    A very rough sketch of such a file could be:

    /**
     * This function should return the contents of the included file
     */
    function getIncludeFileContents($match) {
        list (, $file) = $match;
        // return something for $file
    }
    
    /**
     * This function should return a php-readable path for the initially requested .shtml file
     */
    function getRealpath($uri) {
      // return the real path of the requested uri
    }
    
    // Map the requested uri to file
    // 'REDIRECT_URL' could be something different for your configuration, have a look at the $_SERVER array
    // to get the correct value if something fails here
    $realpath = getRealpath($_SERVER['REDIRECT_URL']); 
    
    // parse each include statement
    // the regex pattern here could need some tweaking
    $output = preg_replace_callback(
      '@<!--#include virtual="(.+?)" -->@i',
      'getIncludeFileContents',
      file_get_contents($realpath)
    );
    
    // output the final contents
    echo $output;
    

    Of course a solution like this could be optimized by some caching or other methods.

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

Sidebar

Related Questions

How would you refactor this, keeping in mind that you have dozens more of
I have dozens of functions which are alternatives to each other. They take an
I have tried dozens of configuration settings trying to get this to work, but
I have dozens of perl script on linux server, and I want use some
I have several dozens Rails DB migrations which were written over a year. Is
In my career I have seen literally dozens of ways that people choose to
We have a few very large Excel workbooks (dozens of tabs, over a MB
We have a need to take dozens of different protocols from systems such as
In the example below I have a ListBox with dozens of font names in
I have a dozen configuration properties files for the ant script. These files are

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.