Jump to content

Include Somtimes Doesn't Get Data


jeve
 Share

Recommended Posts

Hello,
I'm working  with the include& bootstrap API in order to include content from a different PW installation in my main website.

It seems to work correctly, but sometimes (once per week) the page doesn't receive data
from processwire (All the images and text are not showing)

The only way I found to solve this is... login to the processwire admin page.

Instantly the API starts to work again.

This is the code I use:

<?php 
                        function listPage($page, $level = 0) {
                            if($page->numChildren) {
                                foreach($page->children as $child) { 
                                ?>
                                <div class="6u">
                                    <div class="row">
                                        <div class="6u box240 boxtext bg-color-events">
                                            <h3><?php echo $child->title ?></h3>
                                            <p><?php echo $child->summary ?></p>
                                            <a class="scopri color-events" href="eventi?detail=<?php echo $child->name ?>"><span>scopri</span></a>
                                        </div> 
                                        <a href="eventi?detail=<?php echo $child->name ?>"> 
                                            <div class="6u box240 imghover color-events">
                                                <?php 
                                                    $cover = $child->cover->first();
                                                ?>
                                                <img src="/news<?php echo $cover->url;?>" alt="Vai al dettaglio dell'evento">
                                            </div>
                                        </a>
                                    </div>
                                </div>
                        <?php   }
                            }
                        }?> .....
<?php 
    {
        listPage($wire->pages->get("/eventi/")); 
    }
?>
 
Did it ever happen to you? Any ideas about the possible cause?
 
Link to comment
Share on other sites

Hi jeve and welcome to the forums.

I really don't have much advice for you, but it would be good to know what version of PW you are running and also your PHP and MySQL versions.

Also are you using any PW caching options?

Any change you have a isLoggedin() check in the bootstrapped file that is expiring?

Could you show us all the code from your bootstrapped file. There were some selector issues in a recent dev version of PW when bootstrapped, but these have been solved in the latest version.

I am sure we can figure this out with a little more information.

Link to comment
Share on other sites

In addition to what @adrian said above (it's true that without knowing how exactly your "include & bootstrap" code is set up this is very difficult to debug), you mentioned that logging in helps and things start working instantly. This really makes it sound like it could be related to caching, which is then disabled once you login.. or perhaps permissions, though those shouldn't matter at all for API use.

Just for the record, is this site hosted on your local machine or a remote server?

As a first step when debugging site issues you should always take a look at the error log files (/site/assets/logs/errors.txt) of both sites, in case that something went really wrong. Server logs (Apache logs mainly) may also uncover something of interest. Please let us know if there's anything strange there from roughly the times this has occurred.

Link to comment
Share on other sites

@jeve,

Thanks for posting the full code. I can't see anything in there that looks like it might be causing the issues you are having, although you might want to sanitize that $_GET :)

I am curious if it ever works if you are logged out - ie are these pages all visible to guest users?

Also don't forget to less us know the PW,PHP, and MySQL versions that you are running.

Link to comment
Share on other sites

Hi,
the bug is visible now on the page
http://www.fotosociality.it/eventi

this is a public page available to everyone.

As you see the page now looks empty. I'm not logged in into admin but if I do it the page will work again for everyone.

PHP version 5.3.3 and Mysql 3.5.8.2

the full phpini is here http://fotosociality.it/test14/info.php

Processwire version is 2.3

thanks

piero

Link to comment
Share on other sites

About guest, what Adrian meant is that have you by any chance disabled guest view of the pages within the templates of these pages? Look under Access for the templates of the pages that are not working properly...See screenshot below..

post-894-0-53270300-1406644254_thumb.png

Btw, normally not a good idea to publicly expose your php info like that :-)

  • Like 2
Link to comment
Share on other sites

I see that the html is not loaded fully since there are no </body> or </html> tags. The code seems to suddenly stop. Could it be that there is some error which is not visible on first sight, but it viewable in the source of the html?

Also the minimum requirements are: PHP 5.3.8 and MySQL 5.0.15.

  • Like 2
Link to comment
Share on other sites

Hi,

@kongondo - thanks but the guest access is checked.

If I'd log in now, the page would be visible to everyone.

@arjen you are right: the page is not completely loaded, but the error log is empty. 

There are some javascript errors, I'm working to correct them.

The same errors occur when the page works correctly.

Link to comment
Share on other sites

Please log-in so we can see the full page. If you want to share your details in a PM I'd be happy to take a look. From our POV it is only guessing to why the page stops loading.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...