Jump to content

OpenBayou

Members
  • Posts

    85
  • Joined

  • Last visited

Everything posted by OpenBayou

  1. The above works but it checks if a page is using the field. How do I check for pages that use the field and ignore those that are blank?
  2. Error: Call to a member function hasField() on a non-object
  3. Is there a way to show how many pages are using the 'title' field? I tried doing '$page->count' and 'ceil' with no results.
  4. Thanks for the help but this is beyond my skills set. I don't know how to do a module and when I tried to one, I got an error code saying the module is empty. This may be something I could mess around with later on. Thanks again.
  5. Got it working! Thanks for the help. // show each page from deals and using the template 'deals-post' that's sorted by date created. <?php foreach($pages->find("has_parent=/deals/, template=deals-post, sort=-created") as $child):?> <?php echo $child->title?> <?php endforeach; ?>
  6. Images, titles, description and adding <div>s Edit: this is the final product <?php foreach($pages->find("has_parent=/deals/, template=deals-post, sort=-created") as $child):?> <?php if(!$dealsTitle) : ?> <div class="top-id"> <div class="title"> <div class="title-id"> <?php echo $child->parent->parent->title;?> </div> <div class="togger-button-deals togger-button"> <img width="auto" height="20px" src="<?php echo $config->urls->templates?>imgs/arrow_down.svg"> </div> </div> <div style="display:none" class="description-deals description"> <?php echo $child->parent->parent->item_description;?> </div> <?php $dealsTitle = true;?> </div> <?php endif; ?> <div class="deals-item"> <div class="deals-store-left"> <img src="<?php echo $child->parent->post_image->first()->size(40,0)->url;?>"> </div> <div class="deals-right"> <div class="category"> <div class="title"> <?php echo $child->deals_category?> </div> </div> <div class="deals-title"> <?php echo $child->parent->title;?>: <?php echo $child->title;?> </div> <?php if($child->publish_until):?> <div class="deals-expire"> <div class="title"> expires: <?php echo date("M. d, Y",$child->getUnformatted("publish_until")); ?> </div> </div> <?php endif;?> </div> </div> <?php endforeach; ?>
  7. I have a page called deals that has three sub-pages and those sub-pages have posts. Here's a short description of what my deals pages look like: Deals - Page A - - Sub-page 1 - - Sub-page 2 - - Sub-page 3 - Page B - - Sub-page 1 - Page C - - Sub-page 1 - - Sub-page 2 - - Sub-page 3 Right now it's sorted by sub-pages in page A, sub-pages in page B and sub-pages in page C. How do I sort sub-pages by publish date? This is what I've done so far and it doesn't do anything. <?php foreach($pages->get("/deals/")->children() as $post) { ?> <?php foreach($post->children("sort=-publish_date") as $child) { ?> <?php echo $child->deals_category?> <?php } } ?> Thanks for the help.
  8. Got it working! Thanks for the help <?php foreach($pages->get("/deals/")->children as $post){ foreach($post->children as $child) {?> <?php echo $child->title;?> <?php } }?>
  9. <?php $store = $pages->get("parent=/deals/"); $storechild = $store->children; foreach ($storechild as $child){?> <?php echo $child->title;?> <?php } ?> The above code does show sub-pages under Page A but sub-pages under Page B and C, it only shows 'Sub-page A Sub-page B'. This is how it's structured: Deals - Page A - - Sub-page A - - Sub-page B - Page B - - Sub-page A - Page C - - Sub-page A
  10. Is there a difference between 'get' and 'find'? Also I changed 'find' to 'get' and I got an internal server error.
  11. I have three pages under a child page under a child page. Deals - Store - - page 1 - - page 2 How do I show the title of page 1 and page 2? Thanks. This is how I have the template: <?php foreach($pages->find("parent=deals") as $child) { ?> <?php echo $child->title;?> <?php }?>
  12. Thanks everyone. Got it working but don't like how complex it is to do next page and previous page while other CMSs have an easy option. <?php $total_pages = ceil($pagedata->getTotal() / $limit);?> <?php if($total_pages > 1): $current_url = $page->url; if($input->urlSegmentsStr) $current_url .= $input->urlSegmentsStr . '/'; ?> <div class="pagination"> <?php if($input->pageNum > 2): ?> <div class="prev-page"> <a rel="prev" href="<?= $current_url . $config->pageNumUrlPrefix . ($input->pageNum - 1) ?>">Prev page</a> </div> <?php elseif($input->pageNum === 2): ?> <div class="prev-page"> <a rel="prev" href="<?= $current_url ?>">Prev page</a> </div> <?php else: ?> <?php endif; ?> <?php if($input->pageNum < $total_pages): ?> <div class="next-page"> <a rel="next" href="<?= $current_url . $config->pageNumUrlPrefix . ($input->pageNum + 1) ?>">Next page</a> </div> <?php else: ?> <?php endif; ?> </div> <?php endif; ?>
  13. I couldn't get it to work. When I got it to work it either shows the next post or array, not page2.
  14. It's not really good practice because it still loads the data and your browser is hiding it.
  15. Got it working! Thanks! The results are: Is there a way to remove the page numbers in-between next and prev?
  16. Hello, How do you do pages on a template? For example, I want my template to show only 5 posts. If there's more, do page=2. Search results I found results in errors on my end. // posts from the parent page. Only show 5 posts <?php foreach($pages->find("parent=recommendations,limit=5") as $child) { ?> <?php echo $child->title;?><br /> <?php } ?>
  17. Is this for the template or for the field? Can't seem to find where to go.
  18. I need to know if it's possible to add requirements to the image field. Specifically, if the image field has two images and if the first image is under 200px wide. If those requirements aren't met, the post doesn't publish. Thanks for the help.
  19. Thanks for the help. I tried other CMSs and notice the same quality as ProcessWire. I also found out I can display the full image and resize the width by CSS.
  20. That's not what I meant (and my fault for not being more clear). In WordPress, each theme has a settings configuration file called functions.php. In that file, you can have custom code to perform functions on our site. One item I use is `add_image_size( 'link-image', 630, 330, true);` so that when a person uploads an image it crops it to 630px width and 330px height and calls it 'link-image' so you can call that image setting in your theme. Does ProcessWire have something similar?
  21. I'm used to WordPress and they have a way to crop images on upload and use a setting to call up that image. Is there a way to crop the image on upload and call it by a setting?
  22. Thanks for the help. That did solve it but the image looks very soft, even with quality at 100 and upscaling. Keep in mind that I'm on a MacBook Pro retina so I'll keep trying many options.
×
×
  • Create New...