-
Posts
102 -
Joined
-
Last visited
-
Days Won
1
Nicolas last won the day on September 16 2013
Nicolas had the most liked content!
Contact Methods
-
Website URL
https://www.omnitic.com
Profile Information
-
Gender
Male
-
Location
Nantes, France
Recent Profile Visitors
The recent visitors block is disabled and is not being shown to other users.
Nicolas's Achievements
-
Thanks @Robin S, this hook did the trick 🙌
-
Nicolas started following HTML tag in custom Repeater label
-
Is there a way to display/allow HTML tags in custom repeater label ? // CHange the label of the grape variety repeater $this->addHookAfter('InputfieldRepeater::renderRepeaterLabel', function(HookEvent $event) { $repeater = $event->object; if($repeater->name === 'grape_varieties') { $option_page = $event->arguments(2); $event->return = $option_page->title . '<span>(' . $option_page->color . ')</span>'; } }); Using the code above the span tag is escaped and not interpreted in the label.
-
You could use the Pages::saved hook to format a page's name. You can find a example of code here :
-
Hi, You may find a soltution to your problem here : Hope this helps.
-
You need to iterate over the menu items object. <?php $mainMenuItems = $mb->getMenuItems('Main navigation', 2, $options); foreach($mainMenuItems as $menu_item) { // You know have access to $menu_item->title // You know have access to $menu_item->url // See the doc for available $menu_item properties $has_children = ''; $has_children_dropdown = ''; $dropdown = ''; $tag_class = $menu_item->cssClass!=''?$menu_item->cssClass . ' ' . $has_children:$has_children; if($menu_item->isParent) { $has_children = 'has-submenu'; $has_children_dropdown = '<span uk-icon="chevron-down"></span>'; $children = $wire_pages->get($menu_item->pagesID)->children(); $dropdown = '<div uk-dropdown="animation: uk-animation-slide-top-small; duration: 300; animate-out: true; offset: 0; pos: bottom-left"><ul class="uk-nav uk-navbar-dropdown-nav">'; foreach($children as $child) { $dropdown .= '<li><a href="' . $child->url .'">'. $child->title . '</a></li>'; } $dropdown .= '</ul></div>'; } if($menu_item->pagesID == $current_page->parent->id || $menu_item->pagesID == $current_page->id) { $item = '<li class="current-item ' . $tag_class . '"><a href="' . $menu_item->url .'">'. $menu_item->title . $has_children_dropdown . '</a>' . $dropdown . '</li>'; } else { $item = '<li class="'. $tag_class .'"><a href="' . $menu_item->url .'">'. $menu_item->title . $has_children_dropdown . '</a>' . $dropdown . '</li>'; } if($menu_item->parentID == 0) { echo $item; } }
-
Add general information to specific template pages in admin
Nicolas replied to TomPich's topic in General Support
@virtualgadjo I might compare ProcessWire to the Perl language : "There is more than one way to do it" ©. Thanks to ProcessWire flexibility, it's good to have options depending on the way one is more comfortable with. -
Add general information to specific template pages in admin
Nicolas replied to TomPich's topic in General Support
Hi, Using ProcessWire notice system you could do something like <?php // In /site/ready.php $wire->addHookAfter('ProcessPageEdit::execute', function (HookEvent $event) { $pageEdit = $event->object; $page = $pageEdit->getPage(); if ($page->template == 'home') { $this->wire('notices')->add(new NoticeMessage("Hello World")); } }); -
My first ProcessWire website: peopleandplanet.org
Nicolas replied to artfulrobot's topic in Showcase
Great feedback. Regarding the second point of the things you don't like, ProcessWire provides core functions to manage the urls as you wish. Either with URL Hooks or with the templates' URL segments settings you can easily opt out the tree hierarchy structure of the pages. Thanks for your modules contributions. -
“Gentlemen you had my curiosity ... but now you have my attention.” ― Quentin Tarantino, Django Unchained
-
Get the pages tree retaining children position
Nicolas replied to Nicolas's topic in General Support
Hi @wbmnfktrThanks for your answer. I'm indeed using the TemplateEngineLatte module, but I think my issue is more related to the point mentionned by @BillH regarding the "sort=sort" parameter nested pages. I ended up adopting a recursive approach to solve my problem as shown below : <?php // In init.php $catalogue_root = $pages->get(1027); $view->categories = getOrderedCategories($catalogue_root->id); function getOrderedCategories($current_category_id, &$categories = []) { $current_categories = wire()->pages->get($current_category_id)->children('template=category'); foreach($current_categories as $category) { $categories[] = $category; // populate the reponse with category page object getOrderedCategories($category->id, $categories); // proceed with sub categories } return $categories; } -
Hi, I need to make a filter sidebar for a catalogue displayed in a tree like fashion. To get the list of the catalogue root page i've the the following $view->top_categories = $pages->get(1027)->descendants('template=category, sort=sort'); In the category template the children a sorted by 'None'. What would be the right selector to display the tree like filter with the categories sorted in the same order as the pages in the admin section ?
-
Fixed ! Thank for the heads-up.
-
We just launched 2 new project in the past sooner this week. The first one is Overline Systems. The following modules were used : AdminStyleRock, Formbuilder, ProCache and the MarkupMenuBuilder. The second is a simple one page : De la Cave au Cellier
-
Hello Webjack, Great writeup on ProcessWire from a beginner point of view. A quick note : in the breadcrumb ProcessWire is spelled wrongly. It should be ProcessWire whithout a dash (-). Glad to see you're enjoying ProcesWire while dicovering it and learning english at the same time. Merry Christmas !!
-
You can test multiple conditions in PHP if a if instruction as shown below if( $page->id == 1042 || $page->id == 1043 ) { // Do something here }