-
Posts
91 -
Joined
-
Last visited
Everything posted by MateThemes
-
Future of Padloper - New Project Lead Announcement
MateThemes replied to kongondo's topic in Dev Talk
I am really looking forward for this ecommerce module. Are there any plans about pricing for the module for now? Thank you! -
Add Repeater Matrix Fields to Search Selector
MateThemes replied to MateThemes's topic in API & Templates
Hello everyone! So as far as I understand the discussion, it is not possible to make a repeaterfield searchable in a repeater matrix. Is this right? Thank you! -
Thank you very much for this starting tutorial! I love to work with Twig. I am switching over from OctoberCMS to Processwire and it is hard to get over from Twig template files to a plain PHP. So I am happy to have a starting point to start working with Twig in my Processwire Projects. Greetings from Austria to Germany
- 16 replies
-
- 1
-
-
- environment
- twig
-
(and 1 more)
Tagged with:
-
Add Repeater Matrix Fields to Search Selector
MateThemes replied to MateThemes's topic in API & Templates
Thank you for your answer. It seems like the problem is, that the field is in a repeater matrix and then in a repeater. The hierarchy is: - repeater_matrix -- aboutusblock_repeater ---- textfield Could that be? -
Hello everyone! I am trying to add my repeater matrix fields to the search selector, but unfortunately nothing seems to work for me. I have following search code in my search.php: <?php namespace ProcessWire; // look for a GET variable named 'q' and sanitize it $q = input()->get('q'); // sanitize to text, which removes markup, newlines, too long, etc. $q = sanitizer()->text($q); // did $q have anything in it after sanitizing to text? if($q) { // Make the search query appear in the top-right search box. // Always entity encode any user input that also gets output echo '<input id="search-query" value="' . sanitizer()->entities($q) . '">'; // Sanitize for placement within a selector string. This is important for any // values that you plan to bundle in a selector string like we are doing here. // It quotes them when necessary, and removes characters that might cause issues. $q = sanitizer()->selectorValue($q); // Search the title and body fields for our query text. // Limit the results to 50 pages. The has_parent!=2 excludes irrelevant admin // pages from the search, for when an admin user performs a search. $selector = "title|body~=$q, limit=50, has_parent!=2"; // Find pages that match the selector $matches = pages()->find($selector); } else { $matches = array(); } // unset the variable that we no longer need, since it can contain user input unset($q); ?> <main pw-replace='main'> <?php include('./includes/_pageheadersearch.php'); ?> <div id='content-body' class='uk-section uk-section-large uk-section-large'> <div class='uk-container uk-container-small'> <?php // did we find any matches? if(count($matches)) { // yes we did, render them echo ukAlert(sprintf(_n('Found %d page', 'Found %d pages', $matches->count), $matches->count), "default", "check"); echo ukDescriptionListPages($matches); } else { // we didn't find any echo ukAlert(__('Sorry, no results were found'), "danger", "warning"); } ?> </div> </div> </main> I have tried to add my fields to the selector code (repeater_matrix.aboutsblock_repeaters.mytextfield) . But I didn't get any results. What I am doing wrong? Thanks for your help!
-
I have found a solution, that worked for me. I just put in the module file at line 523 a isset statement: /** * Hook format extra fields * * @param HookEvent $event */ public function formatExtraValue(HookEvent $event) { $page = $event->arguments(0); if (!isset ($page->data['title'])) { $field = $event->arguments(1); $value = $event->arguments(2); $settings = $this->getOtherFieldSettings($field); if ($settings && $formatters = $settings->cf_textformatter) { foreach ($value as $v) { foreach ($this->additionalFields['other'][$field->name] as $otherField) { if (!array_key_exists($otherField, $formatters)) continue; $formatter = $formatters->$otherField; $currentValue = $v->$otherField; if ($formatter) $this->modules->get($formatter)->formatValue($page, $field, $currentValue); $v->$otherField = $currentValue; } } } } } And this works for me.
-
I've got the same error here. I use the Image in a Repeater. Is there any workaround at this time? Although the module works fine, to have an error is annoying. Thanks for your help!
-
Hello everyone. I have a question that i can't find a way to solve. I have following function in _uikit.php $date = $page->get('date|createdStr'); $dateModified = $page->get('datemodified'); But I need to output the $date in to different formats. My further function looks like this // return the blog post article markup return " <div> <article class='uk-article blog-post $class'> <meta property='name' content='$page->title'> <meta property='author' typeof='Person' content='Arra Lifte Harmanschlag'> <meta property='dateModified' content='$dateModified'> <meta property='datePublished' content='$date'> <meta class='uk-margin-remove-adjacent' property='articleSection' content='News'> <div property='image' typeof='ImageObject'> $featuredBlogPostImage </div> $heading <ul class='mt25 uk-margin-remove-bottom uk-subnav uk-subnav-divider'> <li class='uk-article-meta'> <time datetime='$date'>$byline</time> </li> </ul> <div class='mt25' property='text'> $body </div> </article> </div> "; Now I need to output the meta property in this format 2019-03-02CET05:23:00 and then a normal date format that is displayed on the Homepage with 2. März 2019 without time. Can anybody help me? Thanks in advance.
-
Extending UIKit 3 markup functions based on Ryans site profile
MateThemes replied to Juergen's topic in Dev Talk
Thank you very much!!! Now it works! -
I have found it! It was my mistake!!! In this function function ukAlert($html, $type = '', $icon = '') { $out = $type ? "<div class='uk-alert-$type uk-alert'><a class='uk-alert-close' uk-close></a><p>" : "<div data-uk-alert><a class='uk-alert-close' uk-close></a>"; if($icon) $out .= ukIcon($icon) . ' '; $out .= $html . "</p></div>"; return $out; } I have forgot to add uk-alert <div class='uk-alert-$type uk-alert' uk-alert> function ukAlert($html, $type = '', $icon = '') { $out = $type ? "<div class='uk-alert-$type uk-alert' uk-alert><a class='uk-alert-close' uk-close></a><p>" : "<div data-uk-alert><a class='uk-alert-close' uk-close></a>"; if($icon) $out .= ukIcon($icon) . ' '; $out .= $html . "</p></div>"; return $out; }
-
Hello everybody! I use the Regular blog site profile as my starter template for my new website. I also use the included uikit.php with reusable functions. But I have one question to this uikit.php. If render an ukAlert the close trigger is not working. If i hard code the alert box, everything is working fine. Here is the code I use (it is not modified and is provided by the Regular blog site profile): /** * Render a uikit alert box * * @param string $html Text/html to display in the alert box * @param string $type Specify one of: success, primary, warning, danger or leave blank for none. * @param string $icon Optionally specify a uikit icon name to appear in the alert box. * @return string * */ function ukAlert($html, $type = '', $icon = '') { $out = $type ? "<div class='uk-alert-$type uk-alert'><a class='uk-alert-close' uk-close></a><p>" : "<div data-uk-alert><a class='uk-alert-close' uk-close></a>"; if($icon) $out .= ukIcon($icon) . ' '; $out .= $html . "</p></div>"; return $out; } /** * Render a success alert, shortcut for ukAlert('message', 'success'); * * @param string $html * @param string $icon * @return string * */ function ukAlertSuccess($html, $icon = '') { return ukAlert($html, 'success', $icon); } /** * Render a primary alert, shortcut for ukAlert('message', 'primary'); * * @param string $html * @param string $icon * @return string * */ function ukAlertPrimary($html, $icon = '') { return ukAlert($html, 'primary', $icon); } /** * Render a warning alert, shortcut for ukAlert('message', 'warning'); * * @param string $html * @param string $icon * @return string * */ function ukAlertWarning($html, $icon = '') { return ukAlert($html, 'warning', $icon); } /** * Render a danger alert, shortcut for ukAlert('message', 'danger'); * * @param string $html * @param string $icon * @return string * */ function ukAlertDanger($html, $icon = '') { return ukAlert($html, 'danger', $icon); } Here is the code in the template: <?php // did we find any matches? if(count($matches)) { // yes we did, render them echo ukAlert("Found $matches->count page(s)", "default", "check"); echo ukDescriptionListPages($matches); } else { // we didn't find any echo ukAlert("Sorry, no results were found.", "danger", "warning"); } ?> May someone have the answer to this! Thanks in advance!
-
Extending UIKit 3 markup functions based on Ryans site profile
MateThemes replied to Juergen's topic in Dev Talk
Hello everybody!!! It is me again with a beginner question. I have following function defined in uikit.php and used in my search-template <?php // did we find any matches? if(count($matches)) { // yes we did, render them echo ukAlert("Found $matches->count page(s)", "default", "list"); echo ukDescriptionListPages($matches); } else { // we didn't find any echo ukAlert("Sorry, no results were found.", "danger", "warning"); } ?> Now, how can I make the ukAlert translatable as a string? I didn't find a way to get it work! Thanks for your help in advance!!! -
Extending UIKit 3 markup functions based on Ryans site profile
MateThemes replied to Juergen's topic in Dev Talk
Thank you very much for your answer!!! This helps me a alot!!! I am still new to Processwire but I love it more and more!!! -
Extending UIKit 3 markup functions based on Ryans site profile
MateThemes replied to Juergen's topic in Dev Talk
Hello again!!! May someone can help me again!!! I have this to variables in my uikit.php $body = explode('</p>', $body); $body = reset($body) . ' '; what means explode and reset? And you see my funtion above, how can I summarize the text in the body field only with e.g. 10 Words? Thank you in advance! -
Extending UIKit 3 markup functions based on Ryans site profile
MateThemes replied to Juergen's topic in Dev Talk
Now I get it!!! This is my code that i function ukBlogPostOverview(Page $page, $options = array()) { $defaults = array( 'summarize' => null, // Display blog post summary rather than full post? (null=auto-detect) 'metaIcon' => 'info', 'moreIcon' => 'arrow-right', 'moreText' => __('Read more'), 'categoryIcon' => 'hashtag', 'bylineText' => __('%2$s'), ); $options = _ukMergeOptions($defaults, $options); $title = $page->title; $date = $page->get('date|createdStr'); $datePublished = $page->get('date'); $name = $page->createdUser->name; $featuredBlogPostImage = $page->featured_blogpost_image; $body = $page->get('body'); $metaIcon = ukIcon($options['metaIcon']); $moreIcon = ukIcon($options['moreIcon']); $categoryIcon = ukIcon($options['categoryIcon']); $n = $page->get('comments')->count(); $numComments = $n ? "<a href='$page->url#comments'>" . ukIcon('comments') . " $n</a>" : ""; if($options['summarize'] === null) { // auto-detect: summarize if current page is not the same as the blog post $options['summarize'] = page()->id != $page->id; } $categories = $page->get('categories')->each($categoryIcon . "<a class='uk-button uk-button-text' href='{url}'>{title}</a> " ); if($options['summarize']) { // link to post in title, and use just the first paragraph in teaser mode $title = "<a href='$page->url'>$title</a>"; $body = explode('</p>', $body); $body = reset($body) . ' '; $more = "<a href='$page->url' class='uk-button uk-button-text'>$options[moreText]</a>"; $class = 'blog-post-summary'; } else { $class = 'blog-post-full'; } if($options['summarize']) { $heading = "<h2 class='uk-margin-medium-top uk-margin-remove-bottom uk-h4'>$title</h2>"; } else { $heading = "<h1 class='uk-margin-medium-top uk-margin-remove-bottom'>$title</h1>"; } $byline = sprintf($options['bylineText'], $name, $date); if($page->get('featured_blogpost_image')) { $featuredBlogPostImage = "<div class='uk-width-auto'><img class='uk-comment-avatar' src='{$featuredBlogPostImage->url}' alt='{$featuredBlogPostImage->description}'></div>"; } // return the blog post article markup return " <div> <article class='uk-article blog-post $class'> <meta property='name' content=''> <meta property='author' typeof='Person' content='Arra Lifte Harmanschlag'> <meta property='dateModified' content='2018-12-14T11:08:44+00:00'> <meta property='datePublished' content='$datePublished'> <meta class='uk-margin-remove-adjacent' property='articleSection' content='News'> <div class='uk-text-center uk-margin-top' property='image' typeof='ImageObject'> $featuredBlogPostImage </div> $heading <ul class='uk-margin-small-top uk-margin-remove-bottom uk-subnav uk-subnav-divider'> <li class='uk-article-meta'> <time datetime='2019-02-08T14:45:39+00:00'>$byline</time> </li> <li class='categories'> $categories </li> </ul> <div class='uk-margin-small-top' property='text'> $body </div> </article> </div> "; } Thanks for the help!!! Processwire has the greatest community, that is also a reason why I like this CMF so much!!! Have a nice day! -
Extending UIKit 3 markup functions based on Ryans site profile
MateThemes replied to Juergen's topic in Dev Talk
Hello and thank you for your answer! I have following function added to uikit.php function ukBlogPostOverview(Page $page, $options = array()) { $defaults = array( 'summarize' => null, // Display blog post summary rather than full post? (null=auto-detect) 'metaIcon' => 'info', 'moreIcon' => 'arrow-right', 'moreText' => __('Read more'), 'categoryIcon' => 'hashtag', 'bylineText' => __('%2$s'), ); $options = _ukMergeOptions($defaults, $options); $title = $page->title; $date = $page->get('date|createdStr'); $datePublished = $page->get('date'); $name = $page->createdUser->name; $featuredImage = $page->get('featured_blogpost_image'); $body = $page->get('body'); $metaIcon = ukIcon($options['metaIcon']); $moreIcon = ukIcon($options['moreIcon']); $categoryIcon = ukIcon($options['categoryIcon']); $n = $page->get('comments')->count(); $numComments = $n ? "<a href='$page->url#comments'>" . ukIcon('comments') . " $n</a>" : ""; if($options['summarize'] === null) { // auto-detect: summarize if current page is not the same as the blog post $options['summarize'] = page()->id != $page->id; } $categories = $page->get('categories')->each($categoryIcon . "<a class='uk-button uk-button-text' href='{url}'>{title}</a> " ); if($options['summarize']) { // link to post in title, and use just the first paragraph in teaser mode $title = "<a href='$page->url'>$title</a>"; $body = explode('</p>', $body); $body = reset($body) . ' '; $more = "<a href='$page->url' class='uk-button uk-button-text'>$options[moreText]</a>"; $class = 'blog-post-summary'; } else { $class = 'blog-post-full'; } if($options['summarize']) { $heading = "<h2 class='uk-margin-medium-top uk-margin-remove-bottom uk-h4'>$title</h2>"; } else { $heading = "<h1 class='uk-margin-medium-top uk-margin-remove-bottom'>$title</h1>"; } $byline = sprintf($options['bylineText'], $name, $date); if($page->get('featured_blogpost_image')) { $img = $featuredImage($page->featured_blogpost_image->url); if($img) $featuredImage = "<div class='uk-width-auto'><img class='uk-comment-avatar' src='{$img->url}' alt='$cite'></div>"; } // return the blog post article markup return " <div> <article class='uk-article blog-post $class'> <meta property='name' content=''> <meta property='author' typeof='Person' content='Arra Lifte Harmanschlag'> <meta property='dateModified' content='2018-12-14T11:08:44+00:00'> <meta property='datePublished' content='$datePublished'> <meta class='uk-margin-remove-adjacent' property='articleSection' content='News'> <div class='uk-text-center uk-margin-top' property='image' typeof='ImageObject'> $featuredImage </div> $heading <ul class='uk-margin-small-top uk-margin-remove-bottom uk-subnav uk-subnav-divider'> <li class='uk-article-meta'> <time datetime='2019-02-08T14:45:39+00:00'>$byline</time> </li> <li class='categories'> $categories </li> </ul> <div class='uk-margin-small-top' property='text'> $body </div> </article> </div> "; } I wann add a featuredimage, as i added the $featuredImage but on my Page it only displayed the file name of the image. I don't know how to display the Image url. Thanks for your help! -
Extending UIKit 3 markup functions based on Ryans site profile
MateThemes replied to Juergen's topic in Dev Talk
Hello!!! This is great!!! I use the uikit.php too! But i have one questions. If i customize the blog markup (i wanna add a featuredimage field) how to i get the image url, i only get the image name? I am new to use functions and i can not find a way. Thank you very much for your help!!! -
Future of Padloper - New Project Lead Announcement
MateThemes replied to kongondo's topic in Dev Talk
Hello everybody! Are there any News for Padloper 2 now? Thank you! -
Thank you very much!!! This works great!!!
-
Hello everyone!!! Maybe I am missing something. First I need to say the module works now fine, but as i said, i am missing something. I have following html markup: <div class="uk-navbar-center uk-visible@m"> <!-- Main Menu --> <ul class='uk-navbar-nav'> <li class="uk-active"><a href="/">Home</a></li> <li><a href="/der-schiort/">Schiort</a></li> <li><a href="#">Test</a> <div class='uk-navbar-dropdown'> <ul class='uk-nav uk-navbar-dropdown-nav'> <li><a href="/impressum/">Impressum</a></li> <li><a href="/datenschutz/">Datenschutz</a></li> </ul> </li> </ul> </div> And following Menubuilder Code for the Menu: <?php /** * Builds a nested list (menu items) of a single menu. * * A recursive function to display nested list of menu items. * * @access private * @param Int $parent ID of menu item. * @param Array $menu Object of menu items to display. * @param Int $first Helper variable to designate first menu item. * @return string $out. * */ function buildMenuFromObject($parent = 0, $menu, $first = 0) { if(!is_object($menu)) return; $out = ''; $has_child = false; foreach ($menu as $m) { $newtab = $m->newtab ? " target='_blank'" : ''; // if this menu item is a parent; create the sub-items/child-menu-items if ($m->parentID == $parent) {// if this menu item is a parent; create the inner-items/child-menu-items // if this is the first child if ($has_child === false) { $has_child = true;// This is a parent if ($first == 0){ $out .= "<ul class='uk-navbar-nav'>\n"; $first = 1; } else $out .= "\n<div class='uk-navbar-dropdown'>\n<ul class='uk-nav uk-navbar-dropdown-nav'>\n"; } $class = $m->isCurrent ? ' class="uk-active"' : ''; // a menu item $out .= '<li' . $class . '><a href="' . $m->url . '"' . $newtab . '>' . $m->title; // if menu item has children if ($m->isParent) { $out .= '</a>'; } else $out .= '</a>'; // call function again to generate nested list for sub-menu items belonging to this menu item. $out .= buildMenuFromObject($m->id, $menu, $first); $out .= "</li>\n"; }// end if parent }// end foreach if ($has_child === true) $out .= "</ul>\n"; return $out; } ################################## /* grab menu items using MarkupMenuBuilder */ $mb = $modules->get('MarkupMenuBuilder');// get Menu Builder /* get menu the menu we want (i.e. a menu created and published using ProcessMenuBuilder) */ // we can pass the menu's Page, page ID, title, name or its menu items string to getMenuItems() #$menu = $pages->get(1299);// pass a Page $menu = 1041;// pass an ID #$menu = 'main';// pass a name // passing an array #$jsonStr = $pages->get(1299)->menu_items; #$arrayFromJSON = json_decode($jsonStr, true); #$menu = $arrayFromJSON;// pass an array #$menu = 'Main';// pass a title /* only these 3 options apply to getMenuItems() */ $options = array('default_title'=> 1, 'default_class'=> 'cool_menu_class', 'current_class_level' => 4); /* grab menu items as a WireArray with Menu objects */ $menuItems = $mb->getMenuItems($menu, 2, $options);// called with options and 2nd argument = 2 {return Menu (WireArray object)} #$menuItems = $mb->getMenuItems($menu);// if calling without without options; 2nd argument defaults to 2 ?> <?php // build menu from array (example 1b only) echo buildMenuFromObject(0, $menuItems); ?> How can I close the <div class="uk-navbar-dropdown">? Everything I've tried seems not to work! Thank you very much for your help!!!
-
Thank you very much!!!
-
Hello! I like to use the menu builder module. I like the freedom for the website administrator to add and remove easily pages. But if I use the menubuilder with more than one menus on a page i got an error with the language code. It is a multilanguage website. Does anyone have experience with such an error? Thanks for your help! Best greetings Gerald @mate-themes
-
Future of Padloper - New Project Lead Announcement
MateThemes replied to kongondo's topic in Dev Talk
Hello!!! It is good to hear that you are that far with your shop module. I am waiting for it!!! :-0) I think the second option would be the best. Because it is easy to work with especially on Desktop. I am looking forward for your great module!!! Have a good day! Gerald -
Future of Padloper - New Project Lead Announcement
MateThemes replied to kongondo's topic in Dev Talk
Hello!!! Thanks for your development!!! How much will the module costs? I have a current project with ecommerce and I need to decide if i should wait for the release! Thank you very much in advance! Gerald @mate-themes -
Hello Adrian!!! Thank you very much for your answer! Now I get it!!! Processwire has the best forum ever!!! Thank you so much!