ShaneFoster Posted October 2, 2011 Share Posted October 2, 2011 Hi, I'm experiencing a strange error when trying to query some child posts from a parent page/template. I have a Projects page that contains multiple child "Project" pages.The Project pages are based on the "project" template. The parent "Projects" page is based on the "Projects" template. When I view the "Projects" page of my site I see the following error returned: Viewable at: http://cougar.showtimedesigner.com/projects "The page you were looking for is not found. Please use our search engine or navigation above to find the page." However, if I login as site admin and resave the "Projects" page, then view my site again, the "Projects" page loads as expected. It seems I'm obviously querying the data correctly. I can get it to work, but only after I login and resave the "Projects" page using "Save Page". It seems as if it's a strange caching issue. Anyone have any thoughts on why this error occurs and why I have to resave the page to get it to display correctly? I'll post the code for each page below. Parent Projects Page Template <?php // Pull Child Projects from Projects Template $projects = $pages->get("/projects/")->find("template=project"); foreach($projects as $project) { ?> <div class="project-info-wrap"> <?php // Grab Project Images foreach($project->images as $img) { $t = $img->size(250, 250); } echo "<img src='{$t->url}' alt='{$t->description}' />"; ?> <div class='project-info'> <h2><?php echo $project->title; ?></h2> <ul> <li class="project-budget"><?php echo $project->project_budget; ?></li> <li class="project-company"><?php echo $project->project_company; ?></li> </ul> <p><?php echo $project->body; ?></p> </div> </div> <?php } ?> Child Project Page Template <h2><?php echo $page->title; ?></h2> <div class="project-info-wrap"> <?php foreach($page->images as $img) { $t = $img->size(250, 250); echo "<img src='{$t->url}' alt='{$t->description}' />"; } ?> <div class="project-info"> <ul> <li class="project-cost"><?php echo $page->project_budget; ?></li> <li class="project-company"><?php echo $page->project_company; ?></li> </ul> <p><?php echo $page->body; ?></p> </div> </div> Thanks in advance for your help! Link to comment Share on other sites More sharing options...
apeisa Posted October 3, 2011 Share Posted October 3, 2011 For some reason it gives 404 / page not found error - so it same error than ie. this page: http://cougar.showtimedesigner.com/projectsgh/ One possible issue comes to my mind: User access: be sure you haven't restricted access from guests. I don't think that problem is in template code. but in template settings. Also are you using 2.0 or 2.1? Link to comment Share on other sites More sharing options...
ryan Posted October 3, 2011 Share Posted October 3, 2011 We definitely need to know which version you are running because it will affect where you check for the access settings. I agree with everything @apeisa said. In addition, check to make sure the page is published– Unpublished pages are viewable to the admin, but not to guests. Lastly, edit your /site/config.php, find $config->debug=false; and change it to $config->debug=true; then view the page again and keep an eye out for errors. I just want to make sure there isn't some error occurring here that might be redirecting it to load the 404. Link to comment Share on other sites More sharing options...
ShaneFoster Posted October 3, 2011 Author Share Posted October 3, 2011 Man, you guys are GOOD For some reason the "Select the roles that may view this page." check box was not checked. I'm assuming this is checked by Default. It looks like it is on all my other pages. I must have unchecked it by accident, like a moron. Looks like it's working as expected now. As always, thanks so much for the prompt response. It's mind blowing to see such amazing support on a small (but I'm sure soon to be huge) open source project. -Shane Link to comment Share on other sites More sharing options...
ryan Posted October 3, 2011 Share Posted October 3, 2011 Thanks Shane, glad you got it working. It sounds like you are using v2.0. If you use 2.1 on a future site, note that all those access role settings are now with the templates rather than the pages. Link to comment Share on other sites More sharing options...
ShaneFoster Posted October 3, 2011 Author Share Posted October 3, 2011 Perfect. Thanks, Ryan! Is there an official doc on upgrading from 2.0 -> 2.1? I see a few things in the forum. It seems like it should be fairly straight forward. I thought I'd check before moving forward, just in case I miss something. Thanks again! Best, Shane Link to comment Share on other sites More sharing options...
ryan Posted October 4, 2011 Share Posted October 4, 2011 There is not an official doc on this yet. But I have just upgraded the skyscrapers demo site from PW 2.0 to 2.1 last week, so I now have a way to go about it. Note though that it doesn't touch your existing 2.0 install. Instead, you basically download a new copy of PW 2.1 (on another site or another directory), then copy your /site/ directory from 2.0 into your 2.1 dir. Then you run the installer. It takes care of the rest. Once you are certain your new 2.1 install is all good, then you can move or delete your 2.0 install. In order to make it as simple as possible, I created a module that does much of the work for you. However, I want to test it on a couple more sites before making it public. But if you would be interested in beta testing it, let me know? Lastly, I want to mention that the user/access system in 2.1 is quite different than 2.0. Most people don't have a lot going on with users since 2.0 wasn't particularly strong in this area. As a result, that is one thing that does not translate from 2.0 to 2.1. So if you have a lot of users or access settings, I'll want to help you individually with that. Thanks, Ryan Link to comment Share on other sites More sharing options...
ShaneFoster Posted October 6, 2011 Author Share Posted October 6, 2011 I see. That's about what I expected. That definitely sounds easy enough. I'd be more than happy to test the module. The user access system shouldn't be an issue for me with either of these sites. Thanks for making me aware of that though Thanks again, Shane Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now