-
Posts
7,479 -
Joined
-
Last visited
-
Days Won
146
Everything posted by kongondo
-
I haven't thoroughly tested this (nor fully read the post you linked to) but it works. Edit/Note: code be will be updated in line with the changes in OP. See new post below In /site/ready.php $pages->addHookAfter('save', function($event) { // get the page object saved $page = $event->argumentsByName('page'); // only on pages with a temporary parent (old template) if($page->template !='old-template') { $this->message('page has wrong template'); return; } // if page still unpublished return if($page->is(Page::statusUnpublished)) { $this->message('page still unpublished'); return; } // good to go; assign new parent and template $page->parent = '/new-parent/'; $page->template = 'new-template'; $page->save(); $this->message('page template and parent changed'); }); Messages in there are for testing. Edit as needed
-
On which page do you have the form being submitted? Do you have it in /your-module-page/testa-page/ ? I'm not sure what the implications of url: "" (empty string) are. To post to self you can do url: "./" If you echo something inside the check for $config->ajax, e.g. echo 'I got that' and check that in the (chrome) console xhr panel, would do you see? I'm not sure if return $input will work. I.e., I don't know how long the $input->post variables will be alive for.
-
Listen to ajax calls like this: $sanitizer = $this->wire('sanitizer'); if ($this->wire('config')->ajax) { // ajax sent, process inputs $input = $this->wire('input')->post; $someID = (int) $input->someID; $showOptions = (int) $input->show_options; $name = $sanitizer->name($input->name); $someTextArray = $sanitizer->array($input->someTextArray, 'text'); // blah blah $data = array('message' => 'error'); if(1 == $someVar) $data['message'] = 'success'; echo json_encode($data); exit;// or the halt() thingy... } // no ajax else { }
-
Hi. 2 - 3 weeks at least. Media Manager is really keeping me busy, I am afraid.
- 96 replies
-
- chained-selects
- dropdowns
-
(and 2 more)
Tagged with:
-
Does PW keep values retrieved from the database in memory?
kongondo replied to Robin S's topic in General Support
Old topic below but might provide some insights -
Welcome to the forums @Mikael, Here's a simple explanation of Dos and Don'ts (regarding MPL 2.0): https://tldrlegal.com/license/mozilla-public-license-2.0-(mpl-2) So, yes, you can modify it as you wish. As the summary at the above link, you have to: Include Copyright Include License Disclose Source Etc
- 1 reply
-
- 1
-
Not out of the box, I don't think so. A user is a page like any other page. They share the same parent, Users (ID 29). You cannot have more than one page with the same name under the same parent in ProcessWire.
-
Three options to get the discussion going Bootstrap either ProcessWire or your eCommerce App. The one being bootstrapped stores the user data REST API: The eCommerce App can request and receive user data using REST or similar (@see ProcessWireGraphQL) Invest in the native ProcessWire eCommerce app, Padloper .
-
This worked for me. See the changes in getLanguageValue(); The echo's were too much for me ; I substituted them for $out (code be made even cleaner, but this is a start). function createArticle($el){ $out = ''; //$el->setOutputFormatting(false); $title = $el->getLanguageValue('default', 'title'); $titleFR = ($el->getLanguageValue('fr', 'title') ? $el->getLanguageValue('fr', 'title') : $title); $titleNL = ($el->getLanguageValue('nl', 'title') ? $el->getLanguageValue('nl', 'title') : $title); $out .= ' <div class="close closeArticle"><span>×</span></div>'; //$out .= ($el->title ? '<h2>'. $el->title .'</h2>' : ''); $out .= ($el->title ? '<h2>'. $titleFR .'</h2>' : '');// @note: just for testing $out .= ($el->sous_titre ? '<h3>'. $el->sous_titre .'</h3>' : ''); $out .= '<div class="dates">'; $out .= ($el->date_debut ? '<h4 class="dateDebut"><span></span> ' . $el->date_debut . ' </h4>' : ''); $out .= ($el->date_fin ? '<h4 class="dateFin"> <span> ⤑ </span> ' . $el->date_fin . '</h4><br>' : ''); $out .= ($el->vernissage ? '<h4 class="vernissage"> <span>vernissage : </span>' . $el->vernissage . '</h4>' : ''); $out .= '</div>'; $out .= ($el->images ? '<img src="' . $el->images->first()->url . '" alt="" />' : '' ); $out .= '<div class="content">'; $out .= ($el->contenu ? $el->contenu : '' ); $out .= '</div>'; $out .= ($el->en_savoir_plus ? '<p class="savoirPlus">' : '' ); $out .= ($el->en_savoir_plus ? '<a href="' . $el->en_savoir_plus . '" target="_blank">En savoir plus</a>' : '' ); $out .= ($el->en_savoir_plus ? '</p>' : '' ); return $out; } I have not looked at the rest of your code in detail...
-
@bernhard, @dragan's is different (e.g. it has image search in there) from the one I use which I think has been around a lot longer .
-
Post to database of another Processwire site
kongondo replied to modifiedcontent's topic in General Support
Excellent! I don't think you need $u->of(false) for a new record/page, btw. Btw2, I testing saving a field in an existing $mainsite->somePage and it worked OK. However, I noticed two things: I expected PW to throw an error if I attempted to save the page without turning output formatting off, but it didn't Reloading the page where I was viewing content from $mainSite->somePages, the changes made to the above field were only visible after a 2nd reload Did you experience this @modifiedcontent? -
Post to database of another Processwire site
kongondo replied to modifiedcontent's topic in General Support
Similar(-ish) issue? -
Post to database of another Processwire site
kongondo replied to modifiedcontent's topic in General Support
Yeah, I can confirm this. From my testing ,$mainsite does not seem to have access to $session. Security? I don't know, just guessing. -
Post to database of another Processwire site
kongondo replied to modifiedcontent's topic in General Support
Forgot to show where $forum is defined in your example code? Would be good to show the complete, correct code to help others, thanks. -
Hmm, why? Do you have an upcoming project? Although we are in 'Off Topic', I don't get the point of starting a new thread instead of 'continuing' the discussion (if there is one), using the existing threads:
- 1 reply
-
- 6
-
Yeah. I've had it in my signature for ages (so, you see, we are not so clever ) . I can't remember who created this particular CSE though. I also have it bookmarked in my bookmarks bar for easy access.
-
Module Module: RuntimeMarkup Fieldtype & Inputfield
kongondo replied to kongondo's topic in Modules/Plugins
Hi @hezmann That's because the code (in the field) is locally scoped so that $page refers to the page you are editing. However, if using wireRenderFile(), you need to get the page being edited yourself. When editing a page, the page (named) edit is what ProcessWire assigns to $page. The page edit has the id 10. So, what you need is code like below to get the page being edited: $currentPage = ''; $process = wire('process'); if($process && $process->className() == 'ProcessPageEdit') $currentPage = $process->getPage(); if(!$currentPage) return; // if you get here $currentPage is the page being edited More in this post. Sorry, this should be in the docs. I will update the docs at some point (when I get the time). Hope this helps. -
No worries . Btw search tip: Use this one instead: E.g., searching for restore trash page or restore trash page api returns $pages->restore() as the second result and your question as the fifth .
-
// Grab a page from the trash and restore it $trashedPage = $pages->get(1234); $pages->restore($trashedPage); http://processwire.com/api/ref/pages/restore/
-
@andrew24, Moderator Note Please consider this your first and final warning against spamming in these forums. This forum is for ProcessWire jobs. You had hidden a link to your non-ProcessWire CMS behind your email address. I have removed your email and the said link.
-
Module Module: Matrix Fieldtype & Inputfield
kongondo replied to kongondo's topic in Modules/Plugins
I'm totally clueless about this . I'll have to investigate, but it might not be soon, I'm afraid. I need to finish work on some other module first, before I can turn my attention to Matrix. Thanks for reporting. -
Hi @OllieMackJames, This is a basic example because I don't know what want to do with the contents of page2use4homepage. $content = ''; // if page2use4homepage is a multi page field if($page->id == 1 && count($page->page2use4homepage)) { foreach ($page->page2use4homepage as $p) { $content .= $p->title;// @note: $p is a page; you can access all its properties } } /* // if page2use4homepage is a single page field if($page->id == 1 && $page->page2use4homepage) { $content .= $page->page2use4homepage; // alternatively, you could create a property on the fly and assign to $page, e.g. (a silly example) $page->content = $page->page2use4homepage->id; } */ else $content = $page->body; // do something with your $content You don't want to do this. You are overwriting $page which is a native ProcessWire variable. Same goes for $pages, $template, etc. You want to use different variable names (in general) I highly suggest you go through some basic PHP tutorials. It might seem hard at first but the benefits thereafter will be worth it. Otherwise, copying and pasting code will only get you so far. Please don't take offence; just friendly advice .
-
Change Default Admin Page Loaded / Hide Pages Tree
kongondo replied to geekpete's topic in Getting Started
These topics might be of interest, especially Macrura's dashboard And this module (page list hidden by default) -
Welcome to the forums @activestate. Have a read here about selectors, specifically about MySQL and short words. Please use code blocks (@see the <> icon) around your code.
-
Thanks for the post! How would getMatchQuery() work if data is encrypted or that's the compromise, i.e. you lose search functionality?