-
Posts
7,529 -
Joined
-
Last visited
-
Days Won
160
Everything posted by kongondo
-
Thanks for sharing Pete . Also speaks volumes about the beauty of OOP. Don't know how/if you could have achieved that using procedural code.
-
AsmSelect: add text to first option (Please select...)
kongondo replied to tpr's topic in General Support
Most of its magic happens in JS. See how I do it Menu Builder if at all helpful. I hooked into its render method and injected my custom JS file (jquery.asmselect-mb.js) which overrides its native jquery.asmselect.js. See this thread for the results (toward the end) -
@Roxanne, Welcome to ProcessWire and the forums. The source code is here in GitHub And this is the module's page
-
Module Module: Matrix Fieldtype & Inputfield
kongondo replied to kongondo's topic in Modules/Plugins
Update version 1.0.1 (Dev only for now) Note: Haven't had time to update README Changes As requested, added ability to find column/row pages using custom PHP code. Thanks @adrian. This is a really powerful feature. Note that the order of precedence for the 3 methods to return row/column pages is: 1. Selector 2. Custom PHP code 3. Page field (3 is greatest). Browser warning alert for reset button + rename the button (@adrian). Done + enhancement by @mackski, the button styling now matches other PW buttons Added two properties: rowLabel and columnLabel (in memory only; not saved to DB) to return user-friendly row/column header info. E.g. echo matrix->rowLabel could render 'Red' or 'Large' instead of echo matrix->row that would instead render the page's ID. These are searchable in-memory ONLY, e.g. $results = $page->results->find("columnLabel=Maths"). Added two methods getRow() and getColumn() for mainly syntactic convenience. These do in-memory searches. Can search by path, title, ID, page object (see examples below). Examples columnLabel //find all results for one column - using 'user friendly selector'; $results = $page->results->find("columnLabel=Maths");//@note: in-memory selector echo '<h3>The are the results of: ' . $results->first()->columnLabel . '</h3>';//maths results foreach ($results as $r) echo $r->rowLabel . ': ' . $r->value . '<br>';//student name: score rowLabel $results = $page->results->find("rowLabel=Maurice|Joel|Mi Mong");//@note: in-memory selector #$results = $page->results->find("");//will show all echo '<h3>The are the MULTIPLE results for several students</h3>'; $row = array(); foreach ($results as $r) { if(!in_array($r->row, $row)) { echo '<h4>' . $r->rowLabel . '</h4>';//echo'es student name (e.g. Joel) $row[] = $r->row; } echo $r->columnLabel . ': ' . $r->value . '<br>';//echo'es each subject's results, e.g. Maths: 70 } getRow()//accepts 3 arguments selector value, limit, sort #$p = $pages->get(1088); #$results2 = $page->results->getRow($p->id);//get by ID #$results2 = $page->results->getRow($p->title);//get by Title #$results2 = $page->results->getRow('Joel');//get by Title (case sensitive) #$results2 = $page->results->getRow($p);//get by Page #$results2 = $page->results->getRow($p->path);//get by Path $results2 = $page->results->getRow(1087);//get by ID//get by ID #$results2 = $page->results->getRow('/students/richard/');//get by Path #$results2 = $page->results->getRow($p, 4, 'random');//get by Page, limit to 4 random values #$results2 = $page->results->getRow($p, 4, 'asc');//get by Page, limit to 4 values, sort ascending #$results2 = $page->results->getRow($p, 3, 'desc');//get by Page, limit to 3 values, sort descending #$results2 = $page->results->getRow($p->title, 4);//get by Page title, limit to 4 #$results2 = $page->results->getRow($p, '', 'asc');//get by Page, no limit, sort ascending #$results2 = $page->results->getRow($p->path, '', 'desc');//get by Path, no limit, sort descending echo '<h3>The are the results for: ' . $results2->first()->rowLabel . '</h3>';//student name foreach ($results2 as $r) echo $r->columnLabel . ': ' . $r->value . '<br>';//subject: score getColumn()//accepts 3 arguments selector value, limit, sort Similar to getRow() except for columns $results3 = $page->results->getColumn('/subjects/physics/'); echo '<h3>The are the results for: ' . $results3->first()->columnLabel . '</h3>';//Subject foreach ($results3 as $r) echo $r->rowLabel . ': ' . $r->value . '<br>';//student:score Some feature requests still pending + thinking whether to implement findRows() and findColumns(). Please test and let me know (if you can, both fresh install and upgrades [test on non-critical data please]) -
Media Manager Released 31 March 2016 https://processwireshop.pw/plugins/media-manager/ Documentation http://mediamanager.kongondo.com/ As of 10 May 2019 ProcessWire versions earlier than 3.x are not supported ******************************************************* ORIGINAL POST ******************************************************* API Example (frontend; will be added to documentation site) Accessing and outputting the contents of the MediaManager field(s) in your template is quite simple. The fields are accessed like many other ProcessWire fields. The fields return an array of type MediaManagerArray that need to be looped to output each media within. Assuming you created a field of type MediaManager named 'media', you can loop through it for a given page as shown below. @note: Each MediaManager object has the following 5 basic properties: DATABASE (saved properties) 1. id => pageID of the page where the media lives (hidden in admin and not important to know about) 2. type => integer denoting media type (1=audio; 2=document; 3=image [for variations this will be 3x, where x is the number of the variation of an original image]; 4=video) RUNTIME 3. typeLabel => user friendly string denoting media type (audio, document, image, video) 4. media => a ProcessWire Image/File Object including all their properties (ext, filesizeStr, height, width, description, tags, filename, basename, etc.) 5. title => title of media (@note: this is the title of the page where the media lives; may or may not be the same as the name of the media file itself). This can be used as a user-friendly name for your media $media = $page->media;// returns a MediaManagerArray. Needs to be looped through foreach ($media as $m) { echo $m->id;// e.g. 1234 (hidden page in /admin/media-manager/media-parent/) echo $m->type;// e.g. 3 (a media of type image) OR 1 (a media of type audio) echo $m->typeLabel;// e.g. 'document' (i.e. type would be 2) echo $m->title;// e.g. 'My Nice Trip' (whose media file could be my-nice-trip.mp4) /* @note: - $m->media returns an object; either a ProcessWire Image (for image media) or File object (for audio, document and video media) - This means you have access to all the properties of that object, e.g. ext, tags, description, url, filename, basename, width, height, modified, created, filesize, filesizeStr, etc as well as associated methods, e.g. size() */ echo $m->media->tags; } // only output images foreach ($media as $m) { if($m->typeLabel =='image') { echo "<img src='" . $m->media->size(100,75)->url . "'><br>"; } } // There's also a toString() method so you can do: echo $page->media; /* All your media will be output wrapped in appropriate HTML tags, i.e.: audio: <audio></audio>; document: <a></a>; image: <img>; video: <video></video>; */ ******************************************************* ORIGINAL POST ******************************************************* The topic of a central media manager feature for ProcessWire has come up several times: https://processwire.com/talk/topic/4330-get-image-from-other-pages-via-images-field/ https://processwire.com/talk/topic/4330-get-image-from-other-pages-via-images-field/?p=42578 https://processwire.com/talk/topic/4330-get-image-from-other-pages-via-images-field/?p=42582 https://processwire.com/talk/topic/425-file-manager/ https://processwire.com/talk/topic/425-file-manager/?p=13802 https://processwire.com/talk/topic/425-file-manager/?p=13861 https://processwire.com/talk/topic/10763-asset-manager-asset-selector/ More recently, regarding my Visual Page Selector module, I have been asked several times why the module does not have an in-built feature to upload images. There's two camps on the topic of a central media manager: those who like them (especially those coming in to PW from other CMSes) and those who don't like them (primarily because of the chaotic way some CMSes (dis)organise their media management) . I think that we can have our cake and eat it too! If done the right way, closely following the principles of and harnessing the power of ProcessWire, we can have a well-implemented, organised, feature-rich, site-wide media manager. Introducing Media Manager: (a commercial module) Alongside a number of modules I am currently working on (both free and commercial), I have been developing a centralised Media Manager for ProcessWire. Before you cast the first stone, no, this is not going to be a one-large-media-bucket as in other CMS where it gets very messy very quickly . In the backend things are neatly stored away, yes, in pages. However, those are pages you will not see (just like repeater pages). Before anyone has a go at pages, remember a page is not that thing you see on the ProcessWire Tree (that's just its visual representation); A page is a record/row in the database . For the end-user of Media Manager, all they will see is the 'familiar media bucket' to select their media from. As long as it works efficiently, I don't think they care about the wizardry behind the scenes . The module allows for the comprehensive management of several media types: Audio Video Images Documents Each media type will be handled by its own sub-module so the user can pick and install/choose the type of media management they want. Features include: Access controls Centralized uploads of media Bulk management of media: tag, delete, describe, replace, etc. Bulk upload: zip; scan, single Quick upload in page edit mode Usage stats across pages (maybe?) Etc.. Would love to hear your thoughts and any feature suggestions. I think there's enough demand for such a module. If not, please let me know so that I can instead focus on other things , thanks. How other CMS do it The more efficient (PW) way of doing it
-
It's not meant to show any other fields. For that, you need to edit your post as page as usual.
-
Yes. Doing things the ProcessWire way....we make no assumptions (aka total freedom for end-user to implement as they wish). Some stuff, e.g. the role and demo files, Blog offers as a courtesy to get you started
-
This is actually ProcessWire territory and not a Blog one. . I'd suggest that you search and have a read in the forums and docs how ProcessWire implements access controls. As you've figured out, access in ProcessWire is controlled at two levels; the high level (when editing a 'role') and the low level (at the template level).. Also have a good read of the info in the 'role' edit screen. This 'homework' will help you beyond Blog...
-
Module Module: Matrix Fieldtype & Inputfield
kongondo replied to kongondo's topic in Modules/Plugins
Toying with the idea of having 'non-page columns and rows mode'. In this mode, if you upload a csv file, the first row will be treated as column headers and first column as row headers/labels -
Module Module: Matrix Fieldtype & Inputfield
kongondo replied to kongondo's topic in Modules/Plugins
I must have been half-asleep when I answered this one. . Sorry for wasting your time with the GitHub issue. This already works (in fact, there is an example in README). See examples below. The last example answers your question. Here 'catalogue' is the name of the matrix field on the current page //find all values for one row $results = $page->catalogue->find("row=1024"); //find all values for one column $results = $page->catalogue->find("column=1035"); //finding by object; no need for $p->id for 'column' or 'row' $p = wire('pages')->get('template=basic-page, title=Sizes'); $results = $page->catalogue->find("column=$p, value>=67");//finding by object; no need for $p->id foreach ($results as $r) echo $r->value . '<br>'; //alternatively user toString() formatted output echo $results; //get a specific matrix value (single intersection) $result = $page->catalogue->get("column=1034, row=1020"); echo $result->value; Will update the docs with these examples. -
$process = $this->wire('process'); if($process && $process->className() == 'ProcessPageEdit') $page = $process->getPage();
-
Aah...wish you'd mentioned that xdebug issue . It's bitten somebody else here before. Anyway, you got there in the end. The comments field sql error can be safely ignored. I mentioned it to Ryan a while ago but he didn't seem to be able to replicate it. It has nothing to do with Blog per se, but the comments module which ships with PW... You rollback instructions (even with the disclaimer) seem quite dangerous and I wouldn't recommend any one to use them. You are using LIKE to search. That will match other things that are not 'blog' but 'sound' like blog...Instead, use the cleanup facility in Blog
-
@David and other experiencing this issue. I have not been able to replicate the issue. Please see my comment on the issue at Github. Could someone please provide responses to the questions I have detailed there? Thanks.
-
Saving form with data from AJAX (outputFormatting terror!)
kongondo replied to thomas's topic in General Support
Try setting output formatting off in the 2nd foreach as well as saving inside this loop: foreach($form as $f) { $prod->of(false); $prod->set($f->name, $f->value); $prod->save(); } -
Authors are not added via the authors' page. They are normal ProcessWire users with the role 'blog-author'. Try the following to cleanup blog manually: Copy all the code in BlogCleanup.php to one of your template files, at the very top. Save Find and replace 'private function' to 'public function' in the code you just copied Find public function cleanUpPages() and add the following lines to it, at the very top of the function. Save //Get the module config data $this->data = wire('modules')->getModuleConfigData(get_parent_class($this)); $this->blogStyle = $this->data['blogStyle'];//selected blog style (1-4) $this->commentsUse = $this->data['commentsUse'];//commenting feature on/off $this->templateFilesInstall = $this->data['templateFilesInstall']; Add the following code to your template file, somewhere after the last } of the BlogCleanup class you copied to this template file $bc = new BlogCleanup(); echo $bc->cleanUpPages(); Visit a page that uses the template file you added the BlogCleanup class to. Blog Cleanup will run but you will get lots of PHP notices. Just ignore them. You will also have to manually delete your template files (normally it would be done for you but that needs code alteration in our manual cleanup). Restore you template file to the state it was before you added the BlogCleanup class. Save You should be able to start afresh then. I am afraid I don't have any more time today to invest in this. Hope it works out.
-
That image tells me you haven't finished installing the Blog module. It is step-2 of the installation. I don't know how you got the Blog pages then since you seem not to have finished installing blog. There's is a button 'Run Install Wizard' on that screen that you need to press to fully install Blog (see image below). When done, you should see a screen like the one I posted earlier, i.e. the Blog Dashboard. You don't see the cleanup menu because you haven't finished installing Blog. What happens you click on the 'Run Install Wizard' button? If this is local install, then it is just easier to start over. If you wanna go that route, I'll guide you with the cleanup...
-
If you need an exercise in patience (or conversely, hair-pulling), try Firefox + Firebug
-
You can still uninstall it but it will leave behind all the pages, fields and templates it had installed before, which then won't allow you to re-install Blog. I don't know how comfortable you are with PHP and PW but you could copy the cleanup utility code to your template file and run it from there. I can show you how to do it but before that: Is this a dev install? i.e. not a production site. Is this on a local machine or on a remote server? I just can't figure out why you cannot see the cleanup Menu item. Did you alter the module code in any way? Can you confirm you are logged in as a superuser (the main admin person)? Can you show me a screenshot of what you see when you go to /yoursite /admin/blog/? admin here is whatever you called your PW admin, normally processwire. Have you tried updating the Blog modules (just overwritting the files) to see if cleanup menu item will appear?
-
Previous & Next navigation links in page editor?
kongondo replied to hellomoto's topic in API & Templates
There's also the Admin Save Actions module by @Nik: http://mods.pw/3W -
Interesting approach @blynx
-
I'm not aware of any clashes. What do you mean by the Blog Module? This is the Blog Module . You probably mean the Blog Profile by Ryan? I know it appears in the modules directory so that can be confusing. Let us know how it goes.
-
ProcessWire has a comments module that is part of the core. It was updated some time ago with an up/down vote system (as can be seen here in the comments at the bottom of the post). I am not sure, but I think this version is still part of the PW dev branch (which many of us use..so, you can use it once you've tested it)..
-
Building a module - Stuck on getting users
kongondo replied to FuturShoc's topic in Module/Plugin Development
There was a typo in my explanation. Corrected that in case it confused you... -
Building a module - Stuck on getting users
kongondo replied to FuturShoc's topic in Module/Plugin Development
What caused this is what Martijn posted above and my attempt to expound on it. The 'identical' names made PHP assume your method was a constructor....etc...as stated above Happy coding!