Jump to content

tpr

Members
  • Posts

    2,321
  • Joined

  • Last visited

  • Days Won

    44

Community Answers

  1. tpr's post in Create new page with api from external script PW 3.0.25 was marked as the answer   
    Perhaps it's
    new Processwire\Page();
  2. tpr's post in TemplateFile.php - get filename in a hook? was marked as the answer   
    $event->object->filename should work I guess.
  3. tpr's post in hasPermission page-edit-created was marked as the answer   
    Shooting in the dark: using $page->editable() wouldn't take care of what you need?
  4. tpr's post in Loosing a character in automatic page name: bug? was marked as the answer   
    Have you tried adding this character to the Page Name module's settings? (under admin-modules-core I guess)
  5. tpr's post in Long-click modal actions was marked as the answer   
    Add this to /site/ready.php:
    <?php namespace ProcessWire; // modify longclick duration $page->addHookAfter('render', function ($event) { if ($this->page->template != 'admin') return; $js = <<< HTML <script> $(document).ready(function () { if (jQuery && jQuery.longclick) { jQuery.longclick.duration = 2000; } }); </script> HTML; $event->return = str_replace('</body>', $js . PHP_EOL . '</body>', $event->return); });
  6. tpr's post in Selector Question on (Custom selector to find selectable pages) was marked as the answer   
    Try
    (isCity=1), (id=58617)
  7. tpr's post in Checking for a child of a certain template was marked as the answer   
    $childCount is a PageArray but you need a number. Add ->count() after children(...)
  8. tpr's post in User Access was marked as the answer   
    Check if the module AdminRestrictBranch can help you:
    https://processwire.com/talk/topic/11499-admin-restrict-branch/
  9. tpr's post in Best strategy for role-based edit access to subtrees, in 2016? was marked as the answer   
    Maybe this:
    https://processwire.com/talk/topic/11499-admin-restrict-branch/
  10. tpr's post in wireRenderFile() inside wireRenderFile() was marked as the answer   
    Is it namespaced PW? (3.05)
    If so, try ProcessWire\wireRenderFile...
  11. tpr's post in UX nightmare: nested modals in theme (default & Reno) was marked as the answer   
    This kinda works:
    Default theme:

    Reno theme:

    Add this to "/site/ready.php":
  12. tpr's post in Need help with page attacment was marked as the answer   
    You overwrite $attachments in the for each, use ".=".
  13. tpr's post in $page->name always returns default name was marked as the answer   
    $page->localName($language); Read on:
    https://processwire.com/api/multi-language-support/multi-language-urls/
  14. tpr's post in inserting into a loop was marked as the answer   
    The easiest thing could be saving the page to be inserted into a variable before the loop, and using a counter inside the loop to output the page if the counter reaches the number you need.
    Otherwise you could use the "slice" and "and" methods of PageArray to construct your custom array of pages before the loop.
  15. tpr's post in $page->find different result depending on language was marked as the answer   
    Are you sure all those missing pages are active (I mean their non-English versions)?
    (check the Active checkbox on the Settings tab of pages under the Name field)
  16. tpr's post in Global variables? was marked as the answer   
    Create a Settings page and add these fields to it.
  17. tpr's post in Problems with pagination was marked as the answer   
    I got the same problem, having a slider (carousel) with the first N pages, then the rest are listed below that (and paginated).
    Using "start" screwed things up. However, getting pages to exclude first and then building up the pages to paginate worked:
    $carouselItems = 2; $itemsPerPage = 5; // get page IDs to exclude $carouselItemIDs = wire('pages')->find('limit=' . $carouselItems . ', sort=-publish_date')->id('|'); // get pages for pagination (without carousel pages) $myPages = wire('pages')->find('id!=' . $carouselItemIDs . ', template=recipe, limit=' . $itemsPerPage . ', sort=-publish_date');
  18. tpr's post in Issue With Page Field Displaying The Title (Multiple Pages (Page Array)) was marked as the answer   
    I meant another foreach loop.
    $csu = $pages->find("template=crms-updates, crms_status_updates=$page, sort=-crms_start_date"); if ($csu) foreach($page->crms_status_updates as $csu) { echo "<strong>{$csu->crms_start_date}</strong>  |"; echo "  {$csu->crms_comments}  |"; // handle multiple page titles foreach($csu->crms_show_contact as $csu_page) { echo "  {$csu_page->title}"; } echo nl2br("<br />"); } (ps. I recommend leaving the styling part to the CSS (and remove  -es from php)
  19. tpr's post in Mail sendt too many times was marked as the answer   
    You should mention WireMailMandrill earlier, see this:
    https://processwire.com/talk/topic/5693-new-module-type-wiremail/?p=96011
  20. tpr's post in Pagination not adding current class to markup was marked as the answer   
    Try 
    'itemMarkup' => "<li class='{class}'>{out}</li>"
  21. tpr's post in How to add styles on the menu? was marked as the answer   
    You will need something like this (untested!):
    <ul id="topnav"> <?php $root = $pages->get("/"); $children = $root->children(); // insert the following line $children->prepend($root); foreach($children as $child) { $activeClass = ($child->id == $page->id) ? ' class="active"' : ''; echo "<li><a href='{$child->url}' $activeClass>{$child->title}</a></li>"; } ?> </ul>
×
×
  • Create New...