• Content count

  • Joined

  • Last visited

  • Days Won


Juergen last won the day on November 5

Juergen had the most liked content!

Community Reputation

343 Excellent

About Juergen

  • Rank
    Hero Member

Profile Information

  • Gender
  • Location
  • Interests
    Playing electric guitar (Rock, Heavy), flying model helicopters

Recent Profile Visitors

4,209 profile views
  1. Render UIKit list Here is another function to create various types of lists corresponding to https://getuikit.com/docs/list /** * Render a uikit list * * @param array $listitems All list items as an array, you can also use html inside the array (fe links) * @param array $options Optionally specify different options to list. * @return string * */ function ukList($listitems = array(), $options = array()) { if(count($listitems) == 0) return; $defaults = array( 'divider' => false, 'bullet' => false, 'striped' => false, 'large' => false, 'icon' => '', // icon to display before list items 'class' => '' // add custom class to list item ); $options = _ukMergeOptions($defaults, $options); $out = ''; $classes = array(); if($options['class']) $classes = explode(' ', $options['class']); if($options['divider']) $classes[] = 'uk-list-divider'; if($options['bullet']) $classes[] = 'uk-list-bullet'; if($options['striped']) $classes[] = 'uk-list-striped'; if($options['large']) $classes[] = 'uk-list-large'; if(count($classes)) { $class = ' ' . implode(' ', $classes); } else { $class = ''; } $out .= '<ul class="uk-list'.$class.'">'; foreach($listitems as $listitem) { $out .= '<li>'; $icon = (!empty($options['icon'])) ? ukIcon($options['icon']).' ' : ''; $out .= $icon.$listitem.'</li>'; } $out .= '</ul>'; return $out; } Usage examples: echo ukList($page->children); //creates a simple unstyled list of all child pages ids echo ukList($page->children, $options = array('icon' => 'heart', 'striped' => true, 'large' => true)); //creates a striped list, with heart icon in front and a larger margin
  2. This causes a problem in my case with Ajax update, so I removed it.
  3. Hello @all, I am using UIKit now for over a year and I am totally satisfied. Ryan has created a site profile with UIKit 3 (https://processwire.com/blog/posts/introducing-a-new-processwire-site-profile/) where he uses a lot of markup functions to simplify content creation. Here is the function file of Ryan: https://github.com/ryancramerdesign/regular/blob/master/site-regular/templates/_uikit.php I want to start this topic for all users, who are also using UIKit 3 and want to share additional markup functions to extend Ryans function file. So everyone who use the new UIKit 3 framework can benefit from it. I want to start with functions to render different types of buttons: Render UIKit buttons Render UIKit buttons corresponding to https://getuikit.com/docs/button /** * Render a uikit button * * @param string $text Text for the button * @param string $style Specify one of: default, primary, secondary, danger, text, link. * @param array $options Optionally specify different options to the button. * @return string * */ function ukButton($text, $style = '', $options = array()) { if(!$text) return; $defaultoptions = array( 'tag' => 'button', //button or a tag 'type' => '', //optional button type attribute fe submit 'name' => '', //optional name attribute fe if button is inside form 'disabled' => false, //optional true or false 'href' => '', //optional href attribute; works with button and a tag, but recommended only with a tag 'rel' => '', //optional rel attribute fe nofollow 'icon' => '', //optional icon fe user, unlock 'class' => '', //optional additional class attribute fe uk-width-1-1, uk-button-small or uk-margin-small-bottom 'id' => '', //optional id attribute 'wrapper' => false, //optional add a wrapper div arround the button 'wrapperclass' => '' //optional add a class to the wrapper div fe alignment or margin ); $options = _ukMergeOptions($defaultoptions, $options); $out = ''; if($options['wrapper'] == true){ $out .= (!empty($options['wrapperclass'])) ? '<div class="'.$options['wrapperclass'].'">' : '<div>'; } $out .= ($options['tag']) ? '<'.$options['tag'].' class="uk-button' : '<button class="uk-button'; $out .= (!empty($style)) ? ' '.$style : ' uk-button-default'; $out .= (!empty($options['class'])) ? ' '.$options['class'].'"' : '"'; if(!empty($options['id'])) $out .= ' id="'.$options['id'].'"'; if($options['disabled'] == true) $out .= ' disabled'; if(!empty($options['name'])) $out .= ' name="'.$options['name'].'"'; if($options['tag'] == 'a'){ if(!empty($options['href'])) $out.= ' href="'.$options['href'].'"'; } else { $out .= ' onclick="window.location.href=\''.$options['href'].'\'"'; } if((!empty($options['href'])) && (!empty($options['rel']))) $out .= ' rel="'.$options['rel'].'"'; if(!empty($options['type'])) $out .= ' type="'.$options['type'].'"'; $out .= '>'; if(!empty($options['icon'])) $out .= ukIcon($options['icon']) . ' '; $out .= $text; $out .= ($options['tag']) ? '</'.$options['tag'].'>' : '</button>'; if($options['wrapper'] == true) $out .= '</div>'; return $out; } /** * Render a primary button; * * @param string $text * @param array $options * @return string * */ function ukButtonPrimary($text, $options = array()) { return ukButton($text, 'uk-button-primary', $options); } /** * Render a secondary button; * * @param string $text * @param array $options * @return string * */ function ukButtonSecondary($text, $options = array()) { return ukButton($text, 'uk-button-secondary', $options); } /** * Render a danger button; * * @param string $text * @param array $options * @return string * */ function ukButtonDanger($text, $options = array()) { return ukButton($text, 'uk-button-danger', $options); } /** * Render a text button; * * @param string $text * @param array $options * @return string * */ function ukButtonText($text, $options = array()) { return ukButton($text, 'uk-button-text', $options); } /** * Render a link button; * * @param string $text * @param array $options * @return string * */ function ukButtonLink($text, $options = array()) { return ukButton($text, 'uk-button-link', $options); } This code snippet uses functions from Ryans code (ukIcon() and _ukMergeOptions()), so please be sure that this functions are included in your function file as well. It would be great if other users can also post their UIKit markup functions (if you have created ones) to extend the collection. Best regards
  4. Nevermind. Thanks for your info. I will change the code at my first post.
  5. Ok, I have tried another approach that seems to work: Replace $page = $this->process->getPage(); with $id = $this->input->get('id'); $page = wire('pages')->get('id='.$id); Let me know if it works Best regards
  6. Ok I found the issue, but not a solution. This line of code is responsible: $page = $this->process->getPage(); I will try to find a working way to grab the page in another way.
  7. Ok, there must be something in the code that stops the Ajax update of page table fields. For the moment I have no solution, but I hope that I will find out what causes the problem.
  8. I am not 100 percent sure, but I guess this issue was not present in previous versions. For the moment I am a little bit helpless, cause there is not so much code that could be changed to make it work properly. Its a simple string replace function and nothing more. I cannot say what causing this issue now????? Maybe you could try to use the code from @Robin S to see if that works.
  9. Yes you are right. Do you use the latest DEV version of PW?
  10. Hello @tpr You can ignore this "bug". It was caused by a page table hook inside ready.php on my side. After changing my code it works as expected. Maybe there was some interference . Now my code and AOS work as expected - I am happy.
  11. Hello @tpr If you can confirm the behavior written in the previous post, @Robin S helped me out at my similar problem to get it working. Running a slightly modificate code inside init.php instead of ready.php will solve the problem. Maybe its a solution you can also use if you can confirm this behavior. For the solution please click the link to my problem in the previous post. Best regards
  12. Yep that works!!! Awesome! I will rewrite it to adapt it to my code! Thousand thanks.
  13. hello @tpr I have discovered an issue with search box in page table field and updating the page table field via Ajax. Before: The search box is there After updating the page table via Ajax (a child page was edited in modal and then saved): As you can see the search box is gone. After refreshing the page the search box is still there. I have also troubles with this behavior by using a InputfieldPageTable::render hook (see https://processwire.com/talk/topic/17738-tip-how-to-change-the-table-headers-in-page-tables/). It seems that that the hook doesnt hook in if the field will be updated via Ajax. My attempt was to try to run this hook in init.php but I was not successful.
  14. Yes you are right @szabesz
  15. Thanks @adrian, unfortunately my solution does not work if the page table is updated via Ajax after a child page is saved in the modal. I have tried to use the code inside init.php instead of ready.php but I cannot solve this problem. Do you have an idea?