Leaderboard
Popular Content
Showing content with the highest reputation on 11/04/2015 in all areas
-
Let say you have these pages in your tree: Products (1005) |- page 1006 |- page 1058 |- page 1062 You could add a field of the type Page (FieldtypePage) with a name "mobile_sort" or something alike. make sure you can select multiple pages, and it will list the children from the Products (1005) page (or whatever your parent page is named). Then add this field to the Products page template. Next edit the Product page and select all the children and sort them accordingly for mobile. You could then create a navigation for your mobile listing all pages attached to the "mobile_sort" field. Another way i think will work is to use the sorting of the mobile_sort field in your selector. sort=mobile_sort.sort5 points
-
I would create a multiple select page field on the template that you are using to control your navigation. Either point the page field to the parent of your navigational elements or use a asm field and filter by template. Then instead of performing your find on the pages you will just load the field. <?php $navigation_elements = $pages->get('/setting-page/')->navigation; foreach($navigation_elements as $elem){ //nav code here } ?>4 points
-
if ($page->trackChange('name_of_you_field')) {...} got triggered for me on every page save, no matter if the value of my field had changed or not. Changing it to if ($page->isChanged('name_of_you_field')) {...} brought the desired result. See also $page->isChanged("field") in API cheat sheet4 points
-
3 points
-
even the smileys could be nice to administrate with one page for one smiley image page title = ";)" page image file "smiley.png"... and some link i've in my bookmarks on this topic: http://tutorialzine.com/2015/01/shoutbox-php-jquery/ it uses Emoji One: http://emojione.com/demo May a own comments branch would be better for this as the full blown blog modul. together with commentmanger modul it would be a nice solution for such guestbook things.. regards mr-fan3 points
-
Gayan, We have launched the site built around your profile and would like to thank you again for releasing such elegant profile and design. All the best.3 points
-
I noticed that this site was featured on http://weekly.pw/. Thank you everyone who commented with your feedback, it's much appreciated. This made me very happy2 points
-
Or you could build a module like MigratorWordpress: https://github.com/NicoKnoll/MigratorWordpress that gets the Textpattern content and creates JSON that can be imported into PW. While it might be a little more work to build, it would be useful for other future users coming from TextPattern.2 points
-
You could always use an bootstrap script, which does connect to the Textpattern database, reads the data by mysql queries and then use the processwire api to fill those data into the pages you need.2 points
-
2 points
-
The track change function is actually there to force the changed status for the field, which does explain why it always reportet a change.2 points
-
Ok, you guys convinced me that these guestbook features can be done with api in less time than I first thought.2 points
-
Not tested but something simular would work I guess $this->addHookAfter('Pages::saveReady', $this, 'hookPagesSave'); public function hookPagesSave(HookEvent $event) { // Modified page, already contains changes in memory, not yet in DB $page = $event->arguments('page'); // If there is a change in your field if ($page->isChanged('name_of_you_field')) { // Page as it is in the DB $oldPage = $this->pages->get($page->id); // ... Now you could do your comparison old <-> new. } }2 points
-
I'm having trouble figuring out how to do this correctly. Let's say I have a page with an ASM select field. Let's say this ASM select field has values A, B and C selected. Let's say the page is edited so that the ASM select field has C removed and then it is saved. How do I determine specifically if C was removed and also display a custom notification if C was removed (in addition PW's regular save page notification)? I've got my code to a point where it can determine if this field was changed, but not specifically what value were changed. Not sure how to do it. Thank you.1 point
-
1 point
-
I wouldn't do it. Consider using children pages and a page table inside them. I've been having better feedback from editors when creating blocks of content with children than with PageTables1 point
-
Since your ProcessModule is in /processwire/... It's not possible to have guest (no guest is not logged in) user access to it.1 point
-
Marco, it sounds like the built-in static translation process should provide everything you need except for the permissions aspect. Setup > Languages > [language] > Translate New File. Point it to any file in /site/templates/ and you should be able to translate it. Let me know if I've misunderstood? As for the permissions aspect (limiting a translator to just one language), I can add support for our new language permissions to this static translation engine on the dev branch once we get 2.7 out the door. If you need it before that, you should be able to block access with a hook.1 point
-
My bad..those are incoming settings. Just haven't pushed them to dev yet1 point
-
1 point
-
Firstly, to clarify - what you are talking about is core functionality now, but you have posted in the support thread for Nico's "old" module. Just use the $options array like this: $options = array('limit' => 100); $items = $this->wire('log'); $items = $items->getEntries('animalabc_logs', $options);1 point
-
@GuruMeditation, Sure thing. At least I can listen to what you have in mind...1 point
-
Kongondo, I've just read through your posts again, and it all makes sense to me. I'm sorry if my response made it sound like I hadn't taken in what you said, it's just all new to me at the moment I was wondering if I could send you a PM regarding a very simple and minimalist Fieldtype example I have in mind. I am keen to get my head around them, and if you can spare some free time I would really appreciate it. If not, I understand and you've been more than helpful. But I would really prefer to use Fieldtypes to store some of the data.1 point
-
It was the userAuthSalt. Thank you!1 point
-
My Small Module: class CalendarEventsCustom extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( 'title' => 'Calendar Events Custom', 'version' => 1, 'summary' => 'Renames subevents', 'href' => '', 'singular' => true, 'autoload' => true, 'icon' => '', ); } public function init() { $this->pages->addHookBefore('save', $this, 'nameEvents'); } protected function nameEvents($event) { $page = $event->arguments[0]; $sanitizer = wire('sanitizer'); if($page->template == 'calendar-event') $page->name = wireDate('Y-m-d',$page->calendar_event_start) . '/' . $sanitizer->pageName($page->title, true); elseif($page->template == 'calendar-event_instance') $page->name = wireDate('Y-m-d',$page->calendar_event_start); // if calendar_start_date != rrule don't publish } } It'll probably be of no help to you, and anyway as it turns out, of course I was just confused and checking the wrong parent template's settings. Name format for children was not set where it was supposed to be. If you want to disable a certain notification then it sounds to me like you're on the right track... What message are you trying to get rid of?1 point
-
Dude, It's ProcessWire, why using an external guestbook? $entry = new Page(); $entry->template = 'guestbook-entry'; $entry->parent = $pages->get('/guestbook-entries/'); $entry->name = 'John Doe'; $entry->date = time(); $entry->comment = 'ProcessWire rocks'; $entry->save(); $entries = $pages->find('template=guestbook-entry,sort=-date,limit=100'); foreach ($entries as $entry) { echo '<h2>' . $entry->name . '</h2>'; echo '<p>' . $entry->comment . '</p>'; }1 point
-
Just remembered that the internet is well, the internet and nothing gets erased (OK, not always) so a snapshot of my old site is on the Wayback Machine. Here you go: https://web.archive.org/web/20141114094607/http://www.kongondo.com/tutorials/specific-features/creating-a-blog-in-processwire/render-posts echo $blog->renderPosts($posts);//the default is to show non-truncated posts. So, unless you want them truncated, you don't need the 2nd argument1 point
-
Slick is really easy to implement. Doesn't do what you asked, but it's a good alternative to owl.1 point
-
Hi jlahijani, Do these posts from ryan and soma will work for you as a starting point?1 point
-
First dev release FrontendUserLogin FrontendUserRegister will be the next one...1 point
-
1 point
-
Here's my way of organizing AJAX. It's just another way of doing it. There's a module with some functions for handling AJAX requests. Mine's called 'fjax' and has some extra code for optionally sanitizing arguments to the functions. There's a 'fjax' template too. The fjax page (using fjax template) can be very minimal. I suggest putting it in /tools/fjax/ and setting tools as hidden. Having a Page gives us a handy URL to send requests to and the template file becomes the place to put the application's server-side AJAX code. The fjax template doesn't need anything more than the required title field. On the client side we use jQuery's AJAX tools. If you POST the data, use the query string on the URL to indicate the function you want to call (tools/fjax/?fn=function) and the module will simply pass the POST array to the function and return the result JSON encoded. If you use GET you pass the arguments on the query string too (tools/fjax/?fn=function&arg1=foo). In the template file you have 5 lines of code plus your function definitions. It's a simple PHP file so you can easily pull in code from reusable files etc. The fact that it's used with a Page means you can use Page fields as easily configurable data for your server-side AJAX functions.1 point
-
What diogo said. If you really need a fieldtype to do ajax internally you best create a hidden admin page with a process module to handle all that. Not overkill but a well streamlined approach, and makes it solid and easy, also the admin URL that way is sure to be unique throughout the system. Gives an interface that is well defined. Process pages are meant for that and PW uses it also in some places like Page tree and fieldtypes. If you will you can of course always catch and bypass the requested url in a module init. Something like public function init() { $adminUrl = ltrim($this->config->urls->admin, "/"); if($this->input->get->it == $adminUrl . "testmodule/load"){ echo $this->executeLoad(); exit; } } protected function executeLoad(){ $id = $this->input->get->id; return $this->pages->get((int)$id)->title; } And a js ajax request might look like $(function(){ $.ajax({ type: 'get', url: "/processwire/testmodule/load", data: "id=1001", success: function(data){ alert(data); } }); }); But I don't know if that's really a good idea at all. Just because you can doesn't mean it's good.1 point
-
Just wanted to mention it also here that all front-end login code posted mostly in this forum has one flaw. The problem is with the login throttle that once it's kicking in, you'll get an WireException thrown and interrupt your login as you will only see this error and nothing else. There's a thread where this was asked and the solution is to use a try/catch to perform the login, this way you can catch the error message and output it where you want it. Looks like this try { $u = $session->login($username, $password); if($u && $u->id){ // user logged in do something $session->redirect("/profil/"); } else { $errors .= "Login failed."; } } catch(WireException $e){ // in case of multiple false login (throttle login) $errors .= $e->getMessage(); // get the error message } There was a mention here https://processwire.com/talk/topic/1716-integrating-a-member-visitor-login-form/?p=505011 point
-
This is pretty much how I'd solve this, still no need for any core changes or additions Create new template called "symlink", add page type field "symlink" with value limited to single Page (use PageListSelect as input field type) and then in template file do something like this: <?php if ($page->symlink instanceof Page && $page->symlink !== $page) echo $page->symlink->render(); else throw new Wire404Exception(); Now you can add as many symlinks you wish and easily choose which page each is tied to. Don't forget to add canonical tags to let robots know which version of this page is the "original" one, though, or you'll have serious SEO issues.1 point