NogDog;1278763 wrote:Your file_put_contents() calls are missing an opening quote around the file path-name. (No guarantee that's the only problem, though.
)
PS: I highly recommend that you use [FONT=Courier New]<?php[/FONT] opening tags, not [FONT=Courier New]<?[/FONT], in order to keep your code portable (some web hosts may have short_open_tags disabled).
I updated the opening tags as suggested.
The opening quote on the path name was just a typo here I think. But playing around I got this to work for the is_file option:
<?php ob_start(); ?>
or that other thing!
<?php
$page_content = ob_get_flush();
$ipb_txt_file = '/home/username/public_html/mydomain.com/wp-content/themes/my-theme/export-ipb.txt';
if (!is_file($ipb_txt_file)) {
file_put_contents($ipb_txt_file, $page_content);
}
?>
But it seems to take 10-15 seconds or so after the file was deleted to regenerate. It just shows errors that the file is missing in the meantime which kinda sucks but is not a deal breaker I suppose since we won't update the file daily or anything.
I still can't get the version to work which was stated as optimal. I tried this:
<?php ob_start(); ?>
now what?
<?php
$page_content = ob_get_flush();
$ipb_txt_file = '/home/username/public_html/mydomain.com/wp-content/themes/my-theme/export-ipb.txt';
if (isset($_GET['renew_ipb'])){
file_put_contents($ipb_txt_file, $page_content);
}
?>
using the url: http://mydomain.com/?renew_ipb
I'm honestly not to sure if my php coding is wrong or our htaccess rewrites are messing it up. I don't know anything about those but here is what we have in the file:
RewriteEngine off
<IfModule mod_suphp.c>
suPHP_ConfigPath /home/username/public_html/mydomain.com/php.ini
<Files php.ini>
order allow,deny
deny from all
</Files>
</IfModule>
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
Which I didn't do, my developer did for whatever reason so I'd be afraid to have to change that. If it is messing it up maybe there is a way to do a non-index url that isn't being messed with in the htaccess?
This is our index.php file as well incase it's causing any issue? Not sure if it needs something in it to know about the _GET or isset or whatever.
<?php
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);
/** Loads the WordPress Environment and Template */
require('./wp-blog-header.php');
As far as the note on "calls" missing. I'm not quite sure what that is. I am no php person, just trying to get this thing to work.
Thanks for any additional help guys
