Damienov
Members-
Posts
16 -
Joined
-
Last visited
Everything posted by Damienov
-
just curious though, have you run foundation update on the project folder?
-
Added options if you do not want a dropdown on a specific parent on the navigation function renderChildrenOf($pa, $root = null, $output = '', $level = 0) { if(!$root) $root = wire("pages")->get(1); $output = ''; $level++; $nodrop = 'product'; //set no dropdown page foreach($pa as $child) { $class = ''; $has_children = count($child->children) ? true : false; if($has_children && $child !== $root) { // if have child with specified no dropdown page if ($child->template == $nodrop) { $class .= ''; $childUrl = $child->url; // add link back again } else { $class .= 'has-dropdown'; // sub level Foundation dropdown li class $childUrl = "#"; // stop parents being clickable } } else { $childUrl = $child->url; // if does not have children, then get the page url } // make the current page and only its first level parent have an active class if($child === wire("page")){ $class .= ' active'; } else if($level == 1 && $child !== $root){ if($child === wire("page")->rootParent || wire("page")->parents->has($child)){ $class .= ' active'; } } $class = strlen($class) ? " class='".trim($class)."'" : ''; $output .= "<li$class><a href='$childUrl'>$child->title</a>"; // If this child is itself a parent and not the root page, then render its children in their own menu too... if($has_children && $child !== $root) { $output .= renderChildrenOf($child->children, $root, $output, $level); } $output .= '</li>'; } $outerclass = ($level == 1) ? "left" : 'dropdown'; return "<ul class='$outerclass'>$output</ul>"; }
-
I see, can't wait until it's done well I did some searching on my own. One of the best solution I found is adding this parameter find("limit=10") Will limit the output but not the input though
-
Is there a way to limit the repeater entry on the admin? for example, user can only enter a max of 10 entries
-
yep this works thanks
-
Is there a way to get the item id from a repeater field? for example: <? foreach($page->items as $item): ?> <div class="classname-<?php echo $item->id; ?>"> <h2><?php echo $item->title; ?></h2> <p><?php echo $item->content; ?></p> </div> <?php endforeach; ?> with an expected output of something like this <div class="classname-1"> <h2>title 01</h2> <p>content</p> </div> <div class="classname-2"> <h2>title 02</h2> <p>content</p> </div> <div class="classname-3"> <h2>title 03</h2> <p>content</p> </div>
-
I know, and simple (2 tier) keeps mobile compatibility.
-
Since changing it would break the menu on mobile, perhaps adding an empty template+ empty placeholder trough processwire would be best?
-
Hi everyone, I've made a snippet update for the bootstrap 2.2.2 navbar by Soma to Bootstrap 3.x. I also added a multi level menu fix since it was removed from Bootstrap 3. Screenshot: topnav_inc <?php /* Navigation for ProcessWire using the Bootstrap 2.2.2 markup This menu was written by Soma based on work by NetCarver and a bit thrown in by Joss Navigation Bootstrap 3 update by Damienov, with multi level dropdown support fix */ function renderChildrenOf($pa, $output = '', $level = 0) { $output = ''; $level++; foreach ($pa as $child) { $atoggle = ''; $class = ''; if ($child->numChildren && count($child->parents) == 1) { $class .= 'dropdown'; $atoggle .= ' class="dropdown-toggle" data-toggle="dropdown"'; } else if ($child->numChildren && count($child->parents) > 1 ) { $class .= 'dropdown-submenu'; $atoggle .= ' class="dropdown-toggle"'; } else if ($child->numChildren && $child->id != 1) { $class .= 'dropdown-menu'; } // Makes the current page and it's top level parent add an active class $class .= ($child === wire("page") || $child === wire("page")->rootParent) ? " active" : ''; $class = strlen($class) ? " class='" . trim($class) . "'" : ''; if ($child->numChildren && count($child->parents) == 1) { // Add Caret if have children $output .= "<li$class><a href='$child->url'$atoggle>$child->title <b class='caret'></b></a>"; } else if ($child->numChildren && count($child->parents) > 1) { $output .= "<li$class><a tabindex='-1' href='$child->url'$atoggle>$child->title</a>"; } else { $output .= "<li$class><a href='$child->url'$atoggle>$child->title</a>"; } // If this child is itself a parent and not the root page, then render it's children in their own menu too... if ($child->numChildren && $child->id != 1) { $output .= renderChildrenOf($child->children, $output, $level); } $output .= '</li>'; } $outerclass = ($level == 1) ? "nav navbar-nav" : 'dropdown-menu'; return "<ul class='$outerclass'>$output</ul>"; } // bundle up the first level pages and prepend the root home page $homepage = $pages->get(1); $pa = $homepage->children; $pa = $pa->prepend($homepage); // Set the ball rolling... echo renderChildrenOf($pa); Add to your CSS /* Bootstrap 3 navbar with multi level fix */ .dropdown-submenu{ position:relative; } .dropdown-submenu > .dropdown-menu { top:0; left:100%; margin-top:-6px; ; -webkit-border-radius:0 6px 6px 6px; -moz-border-radius:0 6px 6px 6px; border-radius:0 6px 6px 6px; } .dropdown-submenu:hover > .dropdown-menu{ display:block; } .dropdown-submenu > a:after{ display:block; content:" "; float:right; width:0; height:0; border-color:transparent; border-style:solid; border-width:5px 0 5px 5px; border-left-color:#cccccc; margin-top:5px; margin-right:-10px; } .dropdown-submenu:hover > a:after{ border-left-color:#ffffff; } .dropdown-submenu .pull-left{ float:none; } .dropdown-submenu.pull-left > .dropdown-menu{ left:-100%; margin-left:10px; -webkit-border-radius:6px 0 6px 6px; -moz-border-radius:6px 0 6px 6px; border-radius:6px 0 6px 6px; } note: My php skills are crappy , so feel free to add some fixes on the code
-
Yeah, that is why I'm here Since my php is crappy, I love how PW works. I've experience Joomla, heck I even sold commercial templates on Joomla early days (when they forked out from mambo), Wordpress, Drupal (Awesome system, shite templating) - made a full fleged CRM with it for a client, godawful theme though
-
Would love to have both the Core (shipped with PW) and 3rd party modules Would love to have this on the 3rd party docs: Available API's list and description on what they are and what they do (with parameter, if any), a sample snippet would be awesome Small how-to's for the less technical (screenshots!, everyone love screenshot ) Advance Sample, see how the module can roar The 2nd and 3rd could be condensed with a Tutorial with a test case example
-
So pretty much many Modx users is migrating to processwire then? Would be great to have docs on the modules and I would be willing to help writing...if I can understand it first . Pretty much the chicken or egg thing. No offense taken In fact sorry for sounding demanding, but I just really want to full understand Processwire and it's modules/extensions. One of the reason I'm tinkering with processwire is to get away from the assumed sctructure of other cms Joomla/Wordpress/Drupal etc. But as you say, it's both a blessing and frustration.
-
I've tried the Blog profile, it works just fine. But its not whether it works or not for me, I want to KNOW how the process works, and the blog profile seems like an overly complicated process. I cant seem to find a documentation on specific module/profile. One of the good things from Modx (the one I used before) is that there is a specific documentation on each modules not just the core. For example: How to achieve the create button (with an option to create categories, blog post, or tag)?
-
Hi eveyone, Is there anywhere where I can find some video tutorials/training for Processwire? Also, is there a way to make a blog like site with processwire? I've tried the tutorial from the wiki and tried the blog profile installation, but I cant seem to grasp the process yet, thus the question of a video tutorial