Jump to content
jeve

Include Somtimes Doesn't Get Data

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?
 

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By flydev 👊🏻
      Bootstrap-4 Minimal site profile for ProcessWire
      This profile is based on the "minimal site profile (intermediate edition)" and bundled with Boostrap v4.4.1
       
        Features
      Bootstrap SASS Font-Awesome SASS Render / helper functions for : Simple ul navigation Bootstrap Multi-level navbar Bootstrap Carousel Bootstrap Cards Bootstrap Jumbotron Boostrap Accordion Assets minification, files bundle   Dependencies
      jQuery Popper.js Bootstrap FontAwesome   Prequisites
       You'll want to install the following on your system before proceeding:
      Yarn / NPM How To Install
      Download the zip file at Github or clone directly the repo with git clone and skip the step 2. Extract the folder site-pwbs4-master into a fresh ProcessWire installation root folder. During the installation of ProcessWire, choose the profile "ProcessWire Bootstrap 4 profile".   After installation
      You can find the development file (CSS/SCSS/JS) in site/assets/dev/src
      The profile can be used as is only with $config->debug set to false. To use it in debug mode, you are required to install the dependencies with the package manager.
      Open a terminal in site/assets/dev and execute the following command-line: yarn Available commands :
      Rebuild, minify and bundle assets for release : yarn build   References
      Bootstrap v4 documentation ProcessWire documentation ProcessWire Forum: bootstrap tag ProcessWire Forum: bootstrap related posts   Credits
      The ProcessWire staff Inspiration from @gebeer and his Bootstrap 3 profile post Members who contributed in various post about Bootstrap navigation and code (see code-source for refs). Screenshots

    • By Atlasfreeman
      Hi!
      I want to make a small site, a one page site.
      And i have this idea about doing 2 to 3 diffrent template that i can load into the index / home page.

      I want to do this with an array so that i can keep creating more topics (with the template) id needed.
      <?php include('./head.inc'); // include header markup ?> <?php $children = $page->get('template=onecolmn|twocolumn, sort=sort'); foreach($children as $child) { include($child); } ?> <?php include('./foot.inc'); // include footer markup ?>  
      As you can see i have to template wish i want to control from the backend.
      I know include does not work this way, put what is my other option to make an array that loads the whole page on an other pages.
       
       
    • By iipa
      Hi fellow developers!
      I want to implement following action:
      Admin-priviledged user uploads a spreadsheet file (with many sheets) When page is saved, back end generates repeater items from the sheets We can render spreadsheet data from the repeater field. Profit! Currently I'm trying to find a way to read the uploaded spreadsheet file. ProcessWire doesn't seem to have modules suitable for my needs, but external PHP Library PhpSpreadsheet sounds like it could do the job. However, I can't even try it, because I simply don't understand how I can refer to an external library!
      Folder structure:
      templates _func.php > where I want to refer to the library libraries PhpSpreadsheet bunch of *.php > what I want to refer to I have tried different things varying from their documentation to forum posts and PW API with no luck. I would prefer not to use Composer, since it seems kind of overkill for one library.
      Thanks in advance and have a great day!
    • By nuel
      Hi there
      Basically I want to call code within a ProcessWire page that isn't used as a template. Example: www.mypwpage.com/myphpfile.php
      I have a working PW Website with a couple of pages like /artists, /releases, /videos etc. Now I need a page /download without any editable fields in the backend, just calling some PHP code (that was coded by another guy) containing a form that checks unique download-codes in a second database and starts the download of the desired file. The script is working fine right now as part of a static website, but since I built PW behind the site, this independent «Download Section» of the page doesn't work anymore.
      Right now I have the main file download.php as a page template on a newly created empty page called /download, so until now the form is working (wow). After sending the form containing the download-code, the file check_code.php in a subfolder /site/templates/download is called and that's where I get an error.
      Any help?
    • By Marcel
      Hey, 
      I am very new to processwire and bootstrap. I have a field (text area) and there I want to be able to insert an image which is responsive. I tryed it with Source but in the end the page doesn't seem to like it when I insert in Source the following code
      <img src="<?php echo $homepage->content_img->url; ?>" class="img-fluid" alt="Responsive image"> What can I do to make it possible to insert reponsive images in a text area?
      Thank you in advance.
      Marcel
×
×
  • Create New...