-
Posts
372 -
Joined
Everything posted by hellomoto
-
Nice pseudocode, and nice of you to actually consider the proper grammar of English as your second language while so many native speakers disregard it. I'm learning Spanish and am coming across the same thing... Many native speakers don't tend to pay much mind to their grammar or spelling, etc., the technicalities, so when I ask questions they won't know because they had never thought about it. Turns out I can at least write Spanish more accurately now than some native speakers. I enjoy learning the forms and irregularities. But the real simpler way to tell the difference, in my opinion -- being that it is the real difference -- is that "it's" is a contraction, meaning it's the word "it" with "is" or "has", connected to make it shorter, and the apostrophe is there in place of whatever is eliminated in between. This should be obvious... I would think... Then "its" is possessive. It's like "Sam's" means like "belonging to Sam". But since "it's" is already another word, a contraction, we can't use that, so as to be able to distinguish one from the other, grammatically; additionally, all third-party pronouns in English lack the apostrophe: "his", "hers", and "theirs". Another bad one is then and than. They're just two different words -- homonyms, indeed, but different nonetheless, like "so" and "sew". Completely irrelevant, yet both totally common words that everyone should know how to spell... Yeah... grammar's my passion...
-
Sorry for not PMing that!
- 15 replies
-
- responsive
- ajax
-
(and 2 more)
Tagged with:
-
The doc pages are searchable and public, by the way; -------------------------- Moderator note: @hellomoto, That's a very important and helpful find, thanks. However, to protect the integrity of that website (and save Macrura some blushes ), could you please PM him instead? Thanks. Hence, I have removed the link you posted.
- 15 replies
-
- responsive
- ajax
-
(and 2 more)
Tagged with:
-
Awesome work and ideas, thanks for sharing.
- 15 replies
-
- 1
-
-
- responsive
- ajax
-
(and 2 more)
Tagged with:
-
Is there a somewhat comprehensive guide or tutorial somewhere on theming the PW admin? There's so much untapped potential there I just don't know really where to start to learn my way around it. If not, would anyone care to create one? I know I would greatly appreciate it, as would many more users. There are no admin themes in the modules directory currently that claim to be compatible with 2.5. That would probably change with a solid beginner's guide.
-
If not that, at least display the latest specified compatible version in the list view. I think this would be a nice and helpful feature to have, especially for some module categories (such as Admin Themes) with few listed as being compatible with 2.5... For now you have to open each module's page individually to view this info, and not only that but that brings up another minor annoyance in my experience with the modules directory, which is that trying to open a module's page in a new tab actually loads it in the source tab as well. I mean, the site does load swiftly, thank you guys for upholding such quality standards... but I still don't see why that's even desirable to do... You all know what I'm talking about right? I wish processwire.com was open source, especially to see how the newsletter system is done.
-
Never mind, wasn't the conditional anyway. This did it: foreach ($mainnav as $p) { $p = $p->id; if($page->rootParent->id == $p) $current = 'style="background: #fff;"'; else $current = ''; echo "<a href='{$pages->get($p)->url}' $current class='{$pages->get($p)->name}'>" . strToUpper($pages->get($p)->name) . "</a>"; }
-
I have a page field on my home template with output set to multiple pages (PageArray). I can echo its value, 1111|2222, or foreach $nav as $p echo $p, 11112222. But when I do this that I need to, it doesn't work: foreach ($mainnav as $p) { if($page->rootParent->id == $p->id) $current = 'style="background: #fff;"'; else $current = ''; echo "<a href='{$pages->get($p)->url}' $current class='{$pages->get($p)->name}'>" . strToUpper($pages->get($p)->name) . "</a>"; } I get: I've tried the conditional in the code with one and three = signs.
-
According to Pingdom on shared hosting this costs 7 seconds on an initial page load...
-
I'll just call you Sir Fan. The MR acronym has too many options to choose from. I hear only great things about Costa Rica though, for sure. Anyway I had added magnific popup to edit them from the calendar already; but my calendar view isn't supposed to replace the page list view or whatever you have, just supplement it, with more than one type of event and varying start/end date assignments (like a listing template could be included in two group instances: one with the start date = created and no end date, to mark its creation, and another with the date_sold instead; and the event template only need be instantiated once and can use date_start and date_end for a range). I got the basic functionality going, now trying to make it into its own module and take it a bit further... keyword "trying"...
-
I made a calendar view page in the admin using AdminCustomPages module, but since I want to add more functionality to it I am trying to make it (the calendar) its own module... So I have a module ProcessKalendar that extends Process and implements Module, ConfigurableModule. It creates the Kalendar page on installation and currently just outputs the input of the one config field for the module on that page on execution. I need to add scripts and stylesheets... How do I do this within the module?
-
Ohhh, thanks.
-
Okay now what if I want to access this info? Like display on a page, the most "viewed" pages, in a certain datetime range? (or "edited", let's say; viewed in my case.) Also how often are these flushed out? I see the cleanup function in ProcessChangelogHooks, says at an interval of $this->data_max_age. Where does that come from/is it set?
-
This is great; I was building a viewtracker made up of PW pages but needed a better solution, so I was able to just add it in to this, thanks to adrian who brought it to my attention. Anyone know how I can add page segments to the URL though for the views? Here's my altered logPageEvent() in ProcessChangelogHooks.module (just search 'viewed' or 'render' in the code to find my additions): Never mind $page->input->urlSegment(1) had to be $event->input->urlSegment(1). public function logPageEvent(HookEvent $event) { // render has no arguments if ($event->method == "render") $page = $event->object; else $page = $event->arguments[0]; // don't log operations for repeaters or admin pages if ($page instanceof RepeaterPage || $page->template == "admin") return; // grab operation from event $operation = $event->method; if ($operation == "saveReady") $operation = "edited"; if ($operation == "render") { if ($page->template->name !== "vessel") return; $operation = "viewed"; } // only continue if this operation is set to be logged if (!in_array($operation, $this->operations)) return; $fields_edited = array(); if ($operation == "edited") { // skip new pages or pages being restored/trashed if (!$page->id || $page->parentPrevious) return; if ($page->isChanged()) { foreach ($page->template->fields as $field) { if ($page->isChanged($field->name)) { $fields_edited[] = $field->name; } } // only continue if at least one field has been changed (or // if status has changed trigger new event for that) if (!count($fields_edited)) { if ($page->isChanged("status")) { $event->method = $page->is(Page::statusUnpublished) ? "unpublished" : "published"; $this->logPageEvent($event); } return; } } else return; } else if ($operation == "renamed") { // if previous parent is trash, page is being restored if ($page->parentPrevious->id == $this->config->trashPageID) return; // if current parent is trash, page is being trashed else if ($page->parent->id == $this->config->trashPageID) return; } else if ($operation == "moved") { if ($page->parent->id == $this->config->trashPageID) { // page is being trashed $operation = "trashed"; } else if ($page->parentPrevious->id == $this->config->trashPageID) { // page is being restored $operation = "restored"; } } // details about page being edited, trashed, moved etc. $details = array(); if ($page->title) $details['Page title'] = $page->title; $details['Page name'] = $page->name; if ($page->namePrevious) { $details[($operation == "moved" ? 'Page name' : 'Previous page name')] = $page->namePrevious; } $details['Template name'] = $page->template->name; if ($page->templatePrevious) { $details['Previous template name'] = $page->templatePrevious->name; } $details['Page URL'] = $page->url; if ($page->parentPrevious && $operation != "edited") { // for pages being edited current or previous parent is irrelevant // data since changing parent will also trigger "moved" operation. $details['Previous page URL'] = $page->parentPrevious->url; if ($page->namePrevious) $details['Previous page URL'] .= $page->namePrevious."/"; else $details['Previous page URL'] .= $page->name."/"; } if ($operation = "viewed" && $page->template->name == "vessel") { //$details['Page URL'] .= $page->input->urlSegment(1); //echo $pages->get($page)->input->urlSegment(1);//->input->urlSegment(1); //print_r($page); } // note: currently only "edited" operation keeps track of edited fields if (count($fields_edited)) $details['Fields edited'] = implode(", ", $fields_edited); // find out which script / URL triggered this particular action if ($this->log_caller && $caller = $this->getCaller()) $details['Caller'] = $caller; $this->insert($operation, $page->id, $page->template->id, $details); if ($page->isChanged('status') && !in_array($operation, array("unpublished", "published"))) { // if status has changed, log extra unpublished/published event $event->method = $page->is(Page::statusUnpublished) ? "unpublished" : "published"; $this->logPageEvent($event); } Much thanks to Teppo et al in advance
-
My starter ViewTracker module: scalable as pages..?
hellomoto replied to hellomoto's topic in Module/Plugin Development
I just added it into Changelog Can't wait for the next release so I can try out the multiple versions of modules... I don't want to try and fail the dev branch again. -
My starter ViewTracker module: scalable as pages..?
hellomoto replied to hellomoto's topic in Module/Plugin Development
Awesome, thank you. -
Hi. I made a little module a while ago to track pageviews. It stores each pageview record as a PW page (hidden, under a hidden parent page "ViewTracker"), with the user & page IDs and timestamp. <?php /** * Processwire ProcessViewtracker Module * * ProcessWire 2.5.3 * Copyright (C) 2014 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * http://processwire.com * */ /* TO-DO: - add settings: templates select, clear/archive option..? - add auto-creation of templates/fields on install */ class ProcessViewtracker 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' => 'ViewTracker', 'version' => 1, 'summary' => 'Records pageviews.', 'href' => '', 'singular' => true, 'autoload' => true, 'icon' => 'eye', ); } public function init() { // add a hook after each page is rendered $this->addHookAfter('Page::render', $this, 'viewTracker'); } /** * ViewTracker hooks into every page after it's rendered and records the views for specified template(s) * (and adds "Hello World" text at the bottom) * */ public function viewTracker($event) { $page = $event->object; // don't add this to the admin pages if($page->template == 'admin') return; // add to selected templates if($page->template == 'vessel') { // create record $r = new Page(); $r->template = 'pageview'; $r->parent = wire('pages')->get('/viewtracker/'); $r->user = $this->user; $r->vessel_id = $page; $r->name = $this->user . $page . date('YmdHisu'); $r->status = $r->status | Page::statusHidden; $r->save(); // record if segment if($this->input->urlSegment(1) !== '') { //$segment = "$this->input->urlSegment(1)"; $this->sanitizer->text($this->input->urlSegment(1)); $r->page_segment = "{$this->input->urlSegment(1)}"; $r->save(); } $event->return = str_replace("</body>", "<p>Hello {$this->input->urlSegment(1)} World!</p></body>", $event->return); } } } I want to add a configuration option for choosing the template(s) this module should activate for, maybe an admin view, but for right now this is all I got, so that the view data can be pulled easily. I know PW can handle a great many pages, but like I've kept this module uninstalled when not developing it... though maybe if I'd just left it enabled I'd have an answer to my own question here. Because tracking page views compiles much more quickly than any other sort of page, really... Should I just be storing this data in its own table?
-
I want to use this to add events to a calendar using FullCalendar.js... and eventually other items of different templates... The initialization goes like so: jq111("#calendar").fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, //defaultDate: '2010-01-01', editable: true, eventLimit: true, // allow "more" link when too many events events: '<?php echo $pages->get(1373)->url ?>?template=events' }); Obviously that doesn't work though since the JSON needs to be outputted in this format: [{"id":830,"start":1262279460000,"end":1262281260000,"title":"this is a long event isnt that right?","body":"","multi":0,"allDay":false,"extension_id":2},{"id":831,"start":1262282052000,"end":1262283852000,"title":"830","body":"","multi":0,"allDay":false,"extension_id":2},{"id":832,"start":1262284644000,"end":1262286444000,"title":"831","body":"","multi":0,"allDay":false,"extension_id":2}] Is there any way to change the format of the output..?
-
Hey I got FC working! Woohoooo With AdminCustomPages module, in my admin page scripts and styles in its settings: calendar.js: var jq111 = jQuery.noConflict(true); jq111(function() { jq111("#calendar").fullCalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaWeek,agendaDay' }, //defaultDate: '2014-11-12', editable: true, eventLimit: true, // allow "more" link when too many events events: [ { title: 'All Day Event', start: '2014-11-01' }, { title: 'Long Event', start: '2014-11-07', end: '2014-11-10' }, { id: 999, title: 'Repeating Event', start: '2014-11-09T16:00:00' }, { id: 999, title: 'Repeating Event', start: '2014-11-16T16:00:00' }, { title: 'Conference', start: '2014-11-11', end: '2014-11-13' }, { title: 'Meeting', start: '2014-11-12T10:30:00', end: '2014-11-12T12:30:00' }, { title: 'Lunch', start: '2014-11-12T12:00:00' }, { title: 'Meeting', start: '2014-11-12T14:30:00' }, { title: 'Happy Hour', start: '2014-11-12T17:30:00' }, { title: 'Dinner', start: '2014-11-12T20:00:00' }, { title: 'Birthday Party', start: '2014-11-13T07:00:00' }, { title: 'Click for Google', url: 'http://google.com/', start: '2014-11-28' } ] }); }); It's a beautiful start, there are minor CSS fixes to be made but that's the least of my concerns.
-
I haven't even used PageTables yet but aren't those both (PT & Repeater) just different ways of managing pages? Everything's a page. I don't know if you mean to have one or multiple programs... so... you probably can just achieve what you want with PageTables or Repeater, just test out both. I just don't know what you want. But I would really like to get a calendar viewer of some sort up... where you can select templates to include or exclude and corresponding start & end datetime fields, if other than the default created. I really wanted to get FullCalendar to work, I've been trying to include the jQuery 1.11.1 to try to noconflict it in but I don't know what I'm doing but sadly it's not working. I'll check out the UI datepicker, thanks Mr. Fan.
-
Unfortunately something about Full Calendar seems to conflict with the admin UI (debug info in footer is all open). I got this Kalendar to embed easily enough, now I just have to play with it... but I am disappointed about missing out on FC, at least for now.
-
You just want an intuitive admin UI for these or something else? Just make a custom admin page, calendar, and I'm sure you can use like DataTables or even FullCalendar.io. Arrange the showings pages in the calendar view and have the page editors open in a modal. I might try this because calendar views tend to come in handy and could be mixed with actual calendar feeds potentially to see everything you need in one place.
-
At least you get to travel rather than being stuck somewhere under somebody else's nose all day! Anyway, when you get a chance, definitely do buff up your site's SEO; that way you won't have to work as hard to promote your services to individual local agents, as they'll be coming to you. Also on your Services page, the sample website link http://maxwellbalmain.com/housesample/index.html is giving a server error. Maybe fix that first. Nice photography! Congrats on getting your site live, I hope it serves you well.
-
I've used this before http://ngiriraj.com/pages/htmltable_export/demo.php which was super easy to implement and worked like a charm, and that was when only CSV was supported, apparently now many formats are; also I haven't tried it with large amounts of data. But it might be pretty breezy to implement export functionality with that script.