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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T07:38:23+00:00 2026-06-14T07:38:23+00:00

I’m in a weird place with this new project: I have a client with

  • 0

I’m in a weird place with this new project: I have a client with a working Javascript application and they want to manage the text elements with a CMS. The native JS environment would be leading.

Ideally, EE would manage content and then render to static files in a content directory. I’m not a PHP guy and my experience with EE content has always been dynamic, using it’s tags. Now I need to pre-render the content to a file or url, outside the template directory…so I could use some guidance.

Something like this works:

{exp:channel:entries
    channel="content"
    disable="categories|category_fields|member_data|pagination|trackbacks"
    status="Open"
    dynamic="no"
    limit="1"
}

<?php 
 $File = "./articles/YourFile.html"; 
 $Handle = fopen($File, 'w');
 $Data = "<h1>{title}</h1>\n<hr /><p>{base_body}</p>\n"; 
 fwrite($Handle, $Data); 
 print "Data Written"; 
 fclose($Handle); 
 ?>

{/exp:channel:entries}

But I actually have to manually view the page to render content… is there a way around this? Can I use EE as an service? An example on how to render the above content would be helpful..I’m getting my head around services today too..

  • 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-14T07:38:24+00:00Added an answer on June 14, 2026 at 7:38 am

    This is what I’ve set up previously to get a static file of an EE template.

    I setup my EE template like normal. Then set up a PHP script which uses CURL to call the template URL and write the contents to a static file. I set up a cron to run the file at the interval I need.

    The PHP script file and the output PHP or TXT file (or whatever you need it to be named) are in the same directory. Make sure the output file has 777 permissions.

    This is what you would put in the php script file. Just change the $site and $filename variables to what you want to use:

    set_time_limit(3450);
    
    #GRAB  DATA
    $site = "http://www.domain.com/template-group/template";
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_URL,$site);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
    $result=curl_exec ($ch);
    curl_close ($ch);
    
    #WRITE  DATA TO FILE
    $filename = 'static-file-name.php';
    if (is_writable($filename)) {
        if (!$handle = fopen($filename, 'w')) {
             echo "Cannot open file ($filename)";
             exit;
        }
        if (fwrite($handle, $result) === FALSE) {
            echo "Cannot write to file ($filename)";
            exit;
        }
        echo "Success, updated the accordion file";
        fclose($handle);
    } else  echo "The file $filename is not writable";
    

    Your EE template would look like this:

    {exp:channel:entries channel="content" disable="categories|category_fields|member_data|pagination|trackbacks" status="Open" dynamic="no" limit="1" }
          <h1>{title}</h1>
          <hr />
          <p>{base_body}</p>
    {/exp:channel:entries}
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
For some reason, after submitting a string like this Jack’s Spindle from a text
this is what i have right now Drawing an RSS feed into the php,
I have a small JavaScript validation script that validates inputs based on Regex. I
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into
I want use html5's new tag to play a wav file (currently only supported
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
This could be a duplicate question, but I have no idea what search terms

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.