Jump to content

Search the Community

Showing results for tags 'pw3'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

  1. I just noticed when I try to do this in the ready.php that it can not retrieve the page. This works perfectly in the init. But since I need my languages I'm forced placing it in the ready. I'm just trying to get the child from a page. $pages->get("name=settings")->child(); Var_dumping that gives me a Nullpage. (and yes the name is correct since it does work in init.php but doesn't in ready.php) So I have no idea what I'm doing wrong, I was guessing maybe it's a bug?
  2. Hi fellows I have a problem with one of my hooks in processwire 3. It's a hook which manipulates the processpagelist to only show the pages which are not editable and not addable. This works fine in 2.7.3 but in pw 3 it doesn't work 100%. When the first time the ProcessPageList is rendered the hook works. Now when I open a branch and reload then it shows all pages. but when i close the branch before reload it works again and only shows the pages which are editable or addable. How it should look like: How it looks when i let the branch open and reload: PHP-Code $this->addHookAfter('ProcessPageList::execute', $this, 'hidePages'); public function hidePages(HookEvent $event){ $excludePages = new PageArray(); $the_pages = wire('pages')->find("template=newsletter-clinic|sender_2016|sender_2016_collab|inside-news-folder|event-clinic"); foreach ($the_pages as $the_page) { if(!$the_page->editable() && !$the_page->addable()) { $excludePages->add($the_page); } } $hidden = explode('|', $excludePages); if($this->config->ajax){ // manipulate the json returned and remove any pages found from array $json = json_decode($event->return, true); foreach($json['children'] as $key => $child){ if(in_array($child['id'],$hidden)) unset($json['children'][$key]); } $json['children'] = array_values($json['children']); $event->return = json_encode($json); } } Do you perhaps know what causes this and how to fix this?
  3. Hello everyone. I have strange things happening when I want to edit Site translation files. When I try to edit files I got error: " Session: File does not exist: /site\templates\include\footer.inc (translation file not needed? textdomain: site--templates--include--footer-inc) " Here I noticed strange division on left. Somehow it is change direction. Can anyone explain to me why this is happening, and can cause this error?
  4. Hello, the frontend edit mode in pw3 is allready great. But I'n looking for a solution where I can have the create/update form on a edite page. (url/urlsegmaent=edit). With all the released code here I was able to put together some code that does that. So far it works to fill the page for the first time, but unfortunaly it dosen't work so great on updating the page. When I try to update, the page disappears from the frontend. Its still visible in the backend but seems to be corrupt. Here is the code I used: <?php namespace ProcessWire; ?> <?php $content =''; ?> <?php $content = ''; $out = ''; if ($input->urlSegment(1 ) =='edit'): if(!isPageOwner()) throw new Wire404Exception(); // Edit Form // get a page $editpage = $page->setOutputFormatting(false); $ignorefields = array("isOld","user_activation","language_published","roles","admin_theme"); $form = $modules->get("InputfieldForm"); $form->method = 'post'; $form->action = './'; // get the collection of inputs that can populate this page's fields $inputfields = $editpage->getInputfields(); // make all the fields required and add them to the form foreach($inputfields as $inputfield) { if(in_array($inputfield->name, $ignorefields)) continue; $form->add($inputfield); } // the inputfields don't already have a submit button, so we'll add one. $submit = $modules->get("InputfieldSubmit"); $submit->name = "submit"; $submit->value = 'Submit'; // add the submit button the the form $form->add($submit); // process the form var_dump($editpage->snippet_repeaterblock->first()); echo '<hr>'; var_dump($editpage->snippet_repeaterblock); echo '<hr>'; $rpf_count = $editpage->snippet_repeaterblock->count(); echo $rpf_count; if($this->input->post->submit) { echo $firstRepeaterId; $n = 1; $codesnippet = "snippet_code_repeater$n"; $codelanguage = "snippet_select_codelanguage_repeater$n"; $snippet_repeaterblocks = $editpage->snippet_repeaterblock; // the repeaters foreach ($snippet_repeaterblocks as $item){ # $item = $pages->get("id=$snippet_repeaterblock->id"); // the repeater page we want to update $item->of(false); // update repeater fields $item->snippet_code_repeater = $input->post->$codesnippet; $item->snippet_select_codelanguage_repeater = $input->post->$codelanguage; // save the repeater page $item->save(); // update counter etc $n++; $codesnippet = "snippet_code_repeater$n"; $codelanguage = "snippet_select_codelanguage_repeater$n"; } # New Code End // now we assume the form has been submitted. // tell the form to process input from the post vars. $form->processInput($this->input->post); // see if any errors occurred if( count( $form->getErrors() )) { // re-render the form, it will include the error messages $out .= $form->render(); } else { // successful form submission, so populate the page with the new values. foreach($form as $field) { $donotpopulate = array("snippet_repeaterblock"); if(in_array($field->name, $donotpopulate)) continue; $editpage->set($field->name, $field->value); echo $field->name; echo ':'; echo $field->value; echo '<hr />'; } // save it $editpage->of(false); $editpage->save(); $out .= "Page saved."; $out .= $form->render(); $content .= $out; } } else { $out .= $form->render(); $content .= $out; } else: ?> <?php /* -------------------- UserProfile */ ?> <?php $cuser = $page->createdUser->id; ?> <?php $cusername = $users->get($cuser)->name; ?> <?php $cusermail = $users->get($cuser)->email; ?> <?php # print_r($page->createdUser); ?> <?php /* -------------------- TAGS*/ ?> <?php $snippet_tag_count = count($page->get("snippet_tag")); $allsnippettags = $page->get("snippet_tag"); if ($snippet_tag_count > 0 ): $tagcontent ='<ul class="snippet_tags">'; $tagcontent =''; $tagcontent .='<ul class="all-tags">'; foreach ($allsnippettags as $allsnippettag) : $alltagtitle = $allsnippettag['title']; $alltagid = $allsnippettag['id']; $alltagpath = $allsnippettag['path']; $alltagurl = $baseurl.$alltagpath; $tagcontent .='<li class="all-snippet_tag">Tag: <a href="'.$alltagurl.'">'.$alltagtitle.'</a>'; # print_r($allsnippettag); ?> <?php $tag = $allsnippettag['name']; $matches = $pages->find("snippet_tag=$tag"); $matchescount = count($matches); $tagcontent .='<ul class="tags">'; foreach ($matches as $match) : $tagtitle = $match['title']; $tagid = $match['id']; $tagpath = $match['path']; $tagurl = $baseurl.$tagpath; $tagcontent .='<li class="snippet_tag "><a href="'.$tagurl.'">'.$tagtitle.'</a></li>'; endforeach; $tagcontent .='</ul>'; $tagcontent .='</li>'; endforeach; $tagcontent .='</ul>'; endif; ?> <?php $content .= "<div id='snippet' edit='snippet_repeaterblock,snippet_tag'>"; $content .= "<p>Create Snippet</p>"; foreach ($page->snippet_repeaterblock as $repeater_item) { if ($repeater_item->get("cb_desc_code")): $content .= "<div class='snippet_description'>" . $repeater_item->get("snippet_description") . "</div>"; else : $content .= "<pre><code>" . $repeater_item->get("snippet_code") . "</code></pre>"; endif; } $content .= '</div>'; $content .= $tagcontent; $content .= '<div class="CreatedUser"><a href="'.$baseurl.'snippets/'.$page->createdUser.'" >'.$cusername.'</a></div>'; If someone has some ideas that would be great. Best Nico
  5. Hello, guys! I'm trying to display the list of notices, but unfortunately there are more informations that I would like to show: The class of the notice seems to be always 'Session'. But sometimes also 'FileCompiler'.. Here is the code: <?php if(count(ProcessWire\wire('notices'))): ?> <div id="messages"> <?php foreach (ProcessWire\wire('notices') as $notice): ?> <?php if($notice->class != 'Session') { continue; } if ($notice instanceof NoticeError) { $class = "error"; } else { $class = "information"; } ?> <div class="<?php echo $class; ?> <?php echo $notice->class; ?>"><?php echo $notice->text; ?></div> <?php endforeach; ?> </div> <?php ProcessWire\wire('session')->removeNotices(); ?> <?php endif; ?>
  6. Hello, Looking to start making modules (and then writing about the adventure) but I just wanted to check whether there were many differences between PW2 and PW3 module creation and whether I'll have to pick a camp to start with? Thanks
×
×
  • Create New...