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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:51:39+00:00 2026-05-26T06:51:39+00:00

In a simple PHP caching (with ob_start and files), I need parts (more -or

  • 0

In a simple PHP caching (with ob_start and files), I need parts (more -or equal- than 3 per page) where don’t caching (.PHP dynamic content or .PHP file context-user based).

+-----------------+
| CACHING CONTENT |
|                 |
+-----------------+
|   NO CACHING    |
+-----------------+
| CACHING CONTENT |
+-----------------+
|   NO CACHING    |
+-----------------+
|                 |
| CACHING CONTENT |
+-----------------+

In “no caching” parts I want include dynamic content. I can caching in three cached.html files (option 1), but I prefer have only one file per cached page (instead 3 pages, option 2). What is the best option for caching?

  1. Caching in several files (head_tag.html, body_part1.html, body_part2.html, body_part3.html…) and intermediate dynamic content (files.php).
  2. Caching to unique file, with some tag for replace with dynamic content (And… How?)
  3. Other

NOTE: Please, no third systems solutions (memcached, APC…). I need it from PHP-based option.

  • 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-26T06:51:40+00:00Added an answer on May 26, 2026 at 6:51 am

    You can use placeholders for the non-caching parts of the page, and cache the whole page. For example, the whole cached page could look like:

    <html>
    ... (static content)
    #DYNAMIC-CONTENT-NAME#
    ... (static content)
    #SECOND-DYNAMIC-CONTENT-PLACEHOLDER#
    ... (static content)
    </html>
    

    Then in PHP, you would simply obtain this cached page and replace all placeholders with the dynamic content.

    // obtain the cached page from storage
    $cached_page = get_cached_page();
    
    // generate the HTML for the dynamic content
    $dynamic_content = get_dynamic_content();
    
    // replace the placeholders with the actual dynamic content
    $page = str_replace('#DYNAMIC-CONTENT-NAME#', $dynamic_content, $cached_page);
    
    // display the resulting page
    echo $page;
    

    This way, you can place as many named placeholders as you like, for as many pieces of dynamic content as you like, then you simply replace them with the actual content.

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

Sidebar

Related Questions

How to create simple PHP COMET server page displaying current time? I need code
I'm building a fairly simple PHP script that will need to send some emails
I'm writing a simple file-caching engine in PHP that needs to be able to
I am wondering what other simple-to-use caching mechanisms exist for PHP, except APC cache,
I have a simple page in a PHP/MySQL web application that lets admin users
I try to do some simple Ajax call with refresh of page content with
I'm using PHP to make a simple caching system, but I'm going to be
I'm caching each page in its own directory rather than in a common directory:
I have a simple php script on a server that's using fsockopen to connect
I have this simple php script <?php echo '<pre>'; // Outputs all the result

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.