Page 2 of 2 FirstFirst 12
Results 16 to 23 of 23

Thread: Don't laugh! But this may be a stupid wordpress/php question...

  1. #16
    Join Date
    Feb 2010
    Ok, I cringe saying this but...

    Here is what I got for the first option which is not working. It actually seemed like it worked the first time and then stopped:

    PHP Code:
    <? ob_start(); ?>
    This is my test page content.
        $page_content = ob_get_flush();   
        $ipb_txt_file = "/myabosolutefilepath.com/footer-export-ipb.txt"; 
    if (!is_file($ipb_txt_file)) {     
    file_put_contents(/myabosolutefilepath.com/footer-export-ipb.txt", $page_content);  

    For the 2nd option

    PHP Code:
    <? ob_start(); ?>
    This is my test page content.
        $page_content = ob_get_flush();   
        $ipb_txt_file = "/myabosolutefilepath.com/footer-export-ipb.txt"; 
    if (isset($_GET['renew_ipb'])) {     
    file_put_contents(/myabosolutefilepath.com/footer-export-ipb.txt", $page_content);  
    Then after changing the file I typed the url in my browser http://mysite.com/?renew_ipb which did nothing

    I'm sure I look like a real idiot here but I would appreciate any further help in what I'm doing wrong. Thank you so much!
    Last edited by blue_vision; 07-17-2013 at 09:51 PM.

  2. #17
    Join Date
    Aug 2004
    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 <?php opening tags, not <?, in order to keep your code portable (some web hosts may have short_open_tags disabled).
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #18
    Join Date
    Feb 2010
    Quote Originally Posted by NogDog View Post
    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 <?php opening tags, not <?, 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 Code:
    <?php ob_start(); ?>

    or that other thing!

    $ipb_txt_file '/home/username/public_html/mydomain.com/wp-content/themes/my-theme/export-ipb.txt'
        if (!
    is_file($ipb_txt_file)) { 
    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 Code:
    <?php ob_start(); ?>

    now what?

    $ipb_txt_file '/home/username/public_html/mydomain.com/wp-content/themes/my-theme/export-ipb.txt'
        if (isset(
    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
    # 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]
    # 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.

     * 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 */
    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

  4. #19
    Join Date
    Feb 2010

    Would really appreciate the help. Thank you so much!

  5. #20
    Join Date
    Jul 2013
    In your WP .htaccess in the line
    RewriteRule . /index.php [L]
    change [L] to [L,QSA] which means QueryStringAppend and should tell apache to pass get parameters to the script as well.

    In case of checking deleted file, it would be regenerated on request to wordpress, not to ipb, keep this in mind. If your ipb is requested more frequently than wp, of course you will see errors until wp is requested.

  6. #21
    Join Date
    Jul 2013
    Also you may call clearstatcache() function before is_file() so that it checked the file on filesystem itself instead of filesystem cache.

  7. #22
    Join Date
    Feb 2010
    Ok, deleting the files and refreshing the blog page instead of the forum makes the one option immediate. I was refreshing the forum page waiting for the changes to take effect.

    I couldn't figure out how to include the clearstatcache function but I doubt it's a big deal now that I know to refresh the blog.

    The url isset thing still didn't work even with the htaccess file edited as instructed. Eitherway this is pretty simple as I have it. About the only thing that could be simpler is if the file auto updated the txt file IF the original file was altered so that we didn't have to bother deleting files for them to be regenerated. But it's no biggie doing it this way. At least it's not making a million saves to the file on every refresh like the original way. Especially since we are doing it for 3-4 different areas which was resaving 3-4 different files every time.

    I left one as the original way to resave each time. Reason why is that we have that one randomly showing 4 posts. So on the live blog it shows 4 different posts on each refresh. But if we did the text-file delete option like on the rest of them then it only would show the same 4 posts unless I deleted the file on every single refresh...LOL. But by regenerating the file each time it regenerates those posts at random as instructed so it shows 4 random posts at our forum each time. I'm not sure if there is a better way of doing that without all the resaving of the file but at least this makes it so that it works.

  8. #23
    Join Date
    Feb 2010
    Actually I guess the original way still doesn't re-generate the random images until the wordpress page has been refreshed by someone. So refreshing the forum page does nothing.

    Fortunately our blog is visited a fair amount of times making things random enough but in a perfect world i guess I would handle the header card system the same as the others with the delete file regeneration. But then have the txt file contain the randomize code. It can't do that as-is because we would need to run the wordpress environment at the forum to do so but I don't know... at some point I might figure out a way to randomize those 4 posts without the need for the WP loop to do it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center



X vBulletin 4.2.2 Debug Information

  • Page Generation 0.10384 seconds
  • Memory Usage 2,941KB
  • Queries Executed 15 (?)
More Information
Template Usage (38):
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_global_above_footer
  • (1)ad_global_below_navbar
  • (1)ad_global_header1
  • (1)ad_global_header2
  • (1)ad_navbar_below
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (1)ad_thread_first_post_content
  • (1)ad_thread_last_post_content
  • (3)bbcode_code
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)headinclude_bottom
  • (8)memberaction_dropdown
  • (1)navbar
  • (4)navbar_link
  • (1)navbar_moderation
  • (1)navbar_noticebit
  • (1)navbar_tabs
  • (2)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (8)postbit
  • (8)postbit_onlinestatus
  • (8)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available (6):
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files (26):
  • ./showthread.php
  • ./global.php
  • ./includes/class_bootstrap.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/functions_navigation.php
  • ./includes/class_friendly_url.php
  • ./includes/class_hook.php
  • ./includes/class_bootstrap_framework.php
  • ./vb/vb.php
  • ./vb/phrase.php
  • ./includes/functions_facebook.php
  • ./includes/functions_calendar.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_notice.php
  • ./packages/vbattach/attach.php
  • ./vb/types.php
  • ./vb/cache.php
  • ./vb/cache/db.php
  • ./vb/cache/observer/db.php
  • ./vb/cache/observer.php 

Hooks Called (74):
  • init_startup
  • friendlyurl_resolve_class
  • init_startup_session_setup_start
  • database_pre_fetch_array
  • database_post_fetch_array
  • init_startup_session_setup_complete
  • global_bootstrap_init_start
  • global_bootstrap_init_complete
  • cache_permissions
  • fetch_postinfo_query
  • fetch_postinfo
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • load_show_variables
  • load_forum_show_variables
  • global_state_check
  • global_bootstrap_complete
  • global_start
  • style_fetch
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • strip_bbcode
  • friendlyurl_clean_fragment
  • friendlyurl_geturl
  • forumjump
  • cache_templates
  • cache_templates_process
  • template_register_var
  • template_render_output
  • fetch_template_start
  • fetch_template_complete
  • parse_templates
  • fetch_musername
  • notices_check_start
  • notices_noticebit
  • process_templates_complete
  • friendlyurl_redirect_canonical
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • memberaction_dropdown
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • build_navigation_data
  • build_navigation_array
  • check_navigation_permission
  • process_navigation_links_start
  • process_navigation_links_complete
  • set_navigation_menu_element
  • build_navigation_menudata
  • build_navigation_listdata
  • build_navigation_list
  • set_navigation_tab_main
  • set_navigation_tab_fallback
  • navigation_tab_complete
  • fb_like_button
  • showthread_complete
  • page_templates