Leaderboard
Popular Content
Showing content with the highest reputation on 10/19/2014 in all areas
-
This module adds a "SEO" tab to every page where you can define a special title, description, keywords, etc. Try it http://aluminum-j4f.lightningpw.com/processwire/ Name: demo Pass: demo123 How to use You can choose between include automatically or use the following methods: $config->seo // includes all the default values and configuration settings // e.g.: $config->seo->title $config->seo->keywords $page->seo // includes all the default values mixed with the page related seo data // e.g.: $page->seo->title $page->seo->keywords // for rendering: $page->seo->render . . Screenshot Download You can download it in the modules repository: http://modules.processwire.com/modules/markup-seo/14 points
-
8 points
-
It is quite some time since I wrote tutorials in the wiki and I am starting the task of updating them and putting the new versions in the tutorial section of the main website. To kick things off, here is a brand new, created from the bottom up, Simple Website Tutorial https://processwire.com/docs/tutorials/simple-website-tutorials/ It is aimed at new users who are comfortable with HTML and CSS and have some limited, basic php knowledge. This is different from the very basic tutorials I have been writing aimed at those who know no php at all and have no coding skills. Like the old series, this constructs a website, complete with html and then further tutorials will use this as a basis. Joss6 points
-
$answers = $pw->community("answers=awesome"); foreach ($answers as $answer) { echo "Thank you " . $answer->createdUser->name . " "; } :)5 points
-
OK, this is solved now. The most efficient and performant method for storing multiple (even thousands) of timestamps with a page definitely is a custom input field type that stores values in an extra table in the DB which makes it really fast. Thanks to all who contributed, especially kongondo who was so kind to supply a customized input field Timestamps module derived from the input field events module. I can now save about 3000 timestamps for a page within 2 seconds which is really fast compared to other methods that I have tried. Also searching through those timestamps is pretty fast, even when it comes to hundreds of pages that need to be searched for a timestamp value. PW really is great tool and the detailed help and instructions here in the forum is absolutely awesome. I also learned a lot about PHP and the inner workings of PW during the process. Thanks again!5 points
-
I've just posted a Fieldtype and Inputfield module combination that support the use of MySQL time fields in ProcessWire. Ryan's Datetime module is great but I needed something that dealt specifically with times for a scheduling system and this is one of the results. For 24 hour clock format ('HH24MM') you now get a clock-picker pop-up by default... ...but you can inhibit it if you don't want it... Although the input time format is selectable, as this is stored as a MySQL time field, you currently need to specify values in selectors in full "H:MM:SS" format. So if you wanted to get all events starting on or after 9am you'd do something like this... $events = $pages->find("template=events, starts>=9:00:00")->sort("starts"); This is definitely a beta module as I've not tested every single input format yet. Currently does not support negative time-periods or fractions of a second. FieldtypeTime on Github FieldtypeTime in the Module Repository Releases Version 0.2.0: Adds support for the use of this input field in repeaters and repeater matrix types. Version 0.1.0: Adds clock picker.4 points
-
Just updated one of my PW installations on my iPad on a boat in the middle of the Irish Sea. This amuses me for some reason :-/ Ever update your PW installation from somewhere 'wierd' ?4 points
-
Had the same last week. I spelled method wrong. <form action="http://i-m-a-fool.com" methode="post"> <-- I did this4 points
-
thanks everyone! actually the original code was close, i was using the wrong magnific popup type (ajax).. (magnific popup is already loaded on page edit) added the &modal=1 to the link.. so this is the final custom js file to accomplish this: $(function(){ $('div.InputfieldPageAutocomplete ol li').each(function(){ var id = $(this).find('span.itemValue').text(); $(this).find('span.itemLabel').wrapInner(" <a class='edit-modal' href='"+config.urls.admin+"page/edit/?id="+id+"&modal=1' target='_blank'></a>"); }); }); $(document).ready(function(){ $('span.itemLabel a').magnificPopup({ type: 'iframe'}); }); As far as a module, yes i think it would be cleaner to have a configurable module where you could somehow set the behavior of the link (new window, lightbox etc.) and then that module could output the linked title for the page select... also I think this code only works on page Autocomplete fields since it targets that particular structure which is an ol > li > span.. it does seem like being able to optionally link the title of any page select item to an editor for that item would be a huge time saver in many instances.. right now this is saving me a ton of time!4 points
-
http://tjmahaffey.com/blog/cron-legacy-scheduling-a-mysql-query/ "cron-legacy-scheduling-a-mysql-query" is not a url segment - it is a child of the blog page. All you need for that is to echo $page->name Nico mentioned this above already. URL segments are extra paths added to the url as a way of passing values to the page. Instead of: http://tjmahaffey.com/blog/cron-legacy-scheduling-a-mysql-query/?boolean=true&this=that echo $input->get->boolean; // true echo $input->get->this; // that You can do: http://tjmahaffey.com/blog/cron-legacy-scheduling-a-mysql-query/true/that/ echo $input->urlSegment(1); //true echo $input->urlSegment(2); //that3 points
-
I love this place. The quality of answers and willingness to help is like no other community I've ever been a part of. I'm consistently amazed. Cheers guys!3 points
-
FrontendUserLogin Module to handle frontend user login / logout. Also should work with Persistent login for users (mode: automatically) out of the box Version 0.3.1Requires PW 2.5.5 (fields defined by array) Download Processwire module page: http://modules.processwire.com/modules/frontend-user-login/ Bitbucket Repo: https://bitbucket.org/pwFoo/frontenduserlogin/ Usage Readme file Module isn't available anymore, but it's planed to replace FrontendUserLogin and FrontendUserRegister with the new FrontendUser module which is not released yet. A new support topic will be created after FrontendUser module is added to the PW module repo. FrontendUser module2 points
-
Just wanted to feedback that the new module config options are working fine for me here after upgrading my development installation. I did have a little trouble at first as I started out by calling my options file XyzConfig.module rather than ZyxConfig.php. Once that was sorted out everything just worked. Thanks for listening to the community on this one Ryan!2 points
-
Hi Martijn, Even though I hadn't spelled "method" incorrectly, your suggestion forced me to look very closely at the form. I noticed that the action value was action="/booking" It was redirecting because it didn't have a trailing slash and coming back as a GET Yay!! Cheers2 points
-
2 points
-
Nico: thanks, this looks interesting! Testing it right now, so might have more comments later, but first things first: you might want to add some isset-checks to module config. Seeing quite a few notices and warnings before saving module config. Sorry, forget that, it's not about config. The problem is occurring in init(), when trying to check for $this->page->template. While viewing the module settings, $this->page doesn't seem to be available yet, which is causing some issues Edit: here's a diff for changes I had to make locally to get this module running. Wouldn't work at all before that, possibly because I've got debug mode on. Not sure if they're all required, implemented the way you'd want them, etc. and some of them might be specific to my environment. Also, moving the hooks from init() to ready() should ensure that API is ready by that time, but it could cause other (potentially unwanted) side-effects.. diff --git a/MarkupSEO.module b/MarkupSEO.module index fecc6a3..c2ebb86 100644 --- a/MarkupSEO.module +++ b/MarkupSEO.module @@ -57,7 +57,7 @@ class MarkupSEO extends WireData implements Module, ConfigurableModule { * Initializing the hooks * */ - public function init() { + public function ready() { $this->addHookAfter("ProcessPageEdit::buildFormContent", $this, 'addSEOTab'); $this->addHookBefore("ProcessPageEdit::execute", $this, 'saveSEOTab'); @@ -85,9 +85,10 @@ class MarkupSEO extends WireData implements Module, ConfigurableModule { $page = wire('pages')->get($this->config->input->get->id); $pageData = $this->getPageSEO($page->id); $configData = wire('modules')->getModuleConfigData($this); - $mixedData = array_merge((array)array_filter($configData), (array)array_filter($pageDataDefault)); + $mixedData = array_merge((array)array_filter($configData), (array)array_filter($pageData)); + $this->modules->get('FieldtypeFieldsetTabOpen'); $field = new InputfieldFieldsetTabOpen; $field->name = $this->prefix."meta"; $field->label = $this->_('SEO'); @@ -158,6 +159,7 @@ class MarkupSEO extends WireData implements Module, ConfigurableModule { $e->return->add($field); + $this->modules->get('FieldtypeFieldsetClose'); $field = new InputfieldFieldsetClose; $field->name = $this->prefix."meta_END"; @@ -204,7 +206,19 @@ class MarkupSEO extends WireData implements Module, ConfigurableModule { */ private function getPageSEO($id) { $dataOrg = wire('modules')->getModuleConfigData($this); - return $dataOrg['pages'][$id]; + if (isset($dataOrg['pages']) && isset($dataOrg['pages'][$id])) { + return $dataOrg['pages'][$id]; + } else { + return array( + 'title' => '', + 'keywords' => '', + 'description' => '', + 'image' => '', + 'canonical' => '', + 'robots' => '', + 'custom' => '', + ); + } } /**2 points
-
AHA. I see your point now. My misunderstanding of PW's URL segments seems to stem from my experiences with CodeIgniter in which URL segments are used in the way I was trying to use them here. My apologies for misunderstanding. Now that I know, it certainly explains why they didn't "work" in my mind. lol Thanks to everyone for their patience and persistence.2 points
-
Did a couple of MODx Evo sites back in the day, and i liked it. Then Revolution came around and i was excited, tried it and was heavily disappointed. Revo was (and probably is) a very capable system but, at least at the time of my experiments, it was also very slow, from the sluggish ExtJS based UI to reduced front-end page rendering performance compared to Evo. It had a security/access system that was powerful but also very complex and complete overkill for my uses-cases. So i went looking for a substitute to Evo and eventually stumbled across PW and i've never looked back.2 points
-
On a CustomAdminPage i use this jquery to get the magnific popup working and add the needed ?modal=1 to the edit links of the pagelisttree.... so may it helps: <style type="text/css" media="screen"> /** * larget magnific popup */ .mfp-iframe-holder .mfp-content { max-width: 1200px!important; } </style> <script type="text/javascript"> $(document).ajaxComplete(function() { //add trigger class and modal setup $('.PageListActionEdit a').each(function(){ $(this).addClass("lb-edit").attr("href",$(this).attr('href')+"&modal=1"); }); $('.PageListActionNew a').each(function(){ $(this).addClass("lb-edit").attr("href",$(this).attr('href')+"&modal=1"); }); //setup lightbox $('.lb-edit').magnificPopup({ type: 'iframe', disableOn: 0 }); }); </script> <?php //get Magnific css and js $this->modules->get('JqueryMagnific'); regards mr-fan2 points
-
Here's an example of how I used the module that netcarver posted: before something is selected: after selection: i also had an idea for extending AsmSelect to make the selected items clickable and brings up a modal editor for that selected page; has anyone done something like that yet? For example with this site I'm working on, you can add composers to a track, but it would be cool if after you add new items to the page you could click on them to make some edits (bio, website for ex), without having to go and find that page in the tree..2 points
-
FrontendContentManager (unstable / testing) FrontendContentManager is a module based on FormHelper to generate needed page edit / add form via form api. NO sanitizing of form values at the moment!!! edit pages create / add new pages add, replace and remove images Download ProcessWire module page: http://modules.processwire.com/modules/frontend-content-manager Bitbucket Repo: https://bitbucket.org/pwFoo/frontendcontentmanager Version 0.2.0 Required FormHelper (0.7.1+) Usage Example template file <!DOCTYPE html> <html lang="en"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title><?php echo $page->title; ?></title> <?php // Load FormHelper module and also set wire('fh') variable $fcm = $modules->get('FrontendContentManager'); // edit existing page //$form = $fcm->edit($pages->get('1108')); // add a new page based on a template and a parent object $parent = $pages->get('name=test'); $form = $fcm->add($parent, $parent->template); // jsConfig needed by ckeditor echo $fcm->JsConfig(); // outpunt needed scripts for inputfield modules, ... foreach ($config->styles as $file) { echo "<link type='text/css' href='$file' rel='stylesheet' />\n"; } foreach ($config->scripts as $file) { echo "<script type='text/javascript' src='$file'></script>\n"; } ?> </head> <body> <h1><?php echo $page->title; ?></h1> <?php // output the forom echo $form; ?> </body> </html> *UPDATED TO 0.1.0* At the moment I have no usage for FCM module, but after FormHelper 0.5.2 is finished I've done a quick FCM rewrite. Only few tests done yet! *UPDATED TO 0.2.0* Updated to work with redesigned FormHelper 0.71 point
-
Hey PW, I am only a starting developer and I am still in school and my experience with processwire is quite small but recently I've created my own module for Processwire and I kind of had to ask and copy a lot from other sources, now I want to create a small walk through tutorial for people with the same lack of knowledge as me And as a guide for myselfs in the future 1) Setting up the file. Okay, so we start of by making a new document in the Module root folder and call it Harmster.module for this example, we dont need to add the .php extension. Now every module in Processwire needs to extends the classes and methods from Processwire itselfs so we start off by typing class Harmster extends Process{ } You can also extend WireData, I don't really understand the difference but both work for me A module contains 2 standart classes, init() and getModuleInfo() init() This is kind of, or the same as a __construct() method, this always executes and is executed almost at creation. getModuleInfo() This is a method that is used to show the information in the Processwire CMS. We both need to add these to our fresh class like following: class Harmster extends WireData { public static function getModuleInfo() { return array( 'title' => 'Harmster', 'version' => 100, 'summary' => 'Harmster module' 'singular' => true, ); } public function init() { $this->setFuel("harmster", $this); } This is where I, as a starting developer, get really excited about this little code in the init() method $this->setFuel("harmster", $this); Basically creates your class in every template you are going to use and it is callable by $harmster Woah! awesome right! Now this is where I got stuck on, I the user to configure some options in the module :\ hmm... Well I just went asking on the forums and the super nice community of PW came to help me, Wanze in this case (no emoticon because its not allowed) (Check it for yourselfs, http://processwire.c...lds-for-module/) And basically you need to implement some methods from an another object, you should replace this, class Harmster extends WireData implements Module with class Harmster extends Process implements Module, ConfigurableModule But when you add that and try to use your module you'll see you get an error, we need to add one more method to the class called getModuleConfigInputfields add static public function getModuleConfigInputfields(array $data) { } 2) Adding a configurable and usable textbox But now you want to add some input fields, now this is pretty hmm complicated For a simple textbox you put this inside the method you just made: $modules = Wire::getFuel('modules'); $fields = new InputfieldWrapper(); $field = $modules->get("InputfieldText"); $field->attr('name+id', ''some_text_field_saved_name''); $field->attr('value', $data['some_text_field_saved_name']); $field->label = "Hamsters rule!"; $field->description = 'Enter a nice sentance here if you like hamsters'; $fields->append($field); Now you've created a input field and you can use it with $this->get(''some_text_field_saved_name''); in all your methods in this class (no emoticon because its not allowed) If you're lazy Now what you've created is a configurable module, heres a I am lazy and i want to pastey (no emoticon because its not allowed) class Harmster extends Process implements Module, ConfigurableModule { public static function getModuleInfo() { return array( 'title' => 'Harmster', 'version' => 001, 'summary' => '', 'href' => '', 'singular' => true, 'autoload' => true, ); } public function init() { $this->fuel->set("harmster", $this); } static public function getModuleConfigInputfields(array $data) { } } Now if you want to add a overview page, much like the setup, pages, acces and module tab in Processwire CMS default you can easily do this by adding 2 new methods in your class, install and uninstall 3) Creating your install and uninstall So you want to get a nice overview for your module now eh? Well we can do that because Processwire is awesome like that I did this for my module Now, we need to add 2 methods to our class, ___install and ___uninstall (yes, 3 underscores) So add this to your class: public function ___install() { } public function ___uninstall() { } I think that these are kind of self explaing, the one method gets executed when the user installs the module and the other one gets executed when the user deinstalls the module. Now we want to add a page to PW CMS, but how (no emoticon because its not allowed) Thats actually really easy, $page = $this->pages->get('template=admin,name='.self::PAGE_NAME); if (!$page->id) { $page = new Page(); $page->template = $this->templates->get('admin'); $page->parent = $this->pages->get($this->config->adminRootPageID); $page->title = 'MailChimp'; $page->name = self::PAGE_NAME; $page->process = $this; $page->save(); } This is how you install a page, notice that we name the page to self::PAGE_NAME therefor you want to add const PAGE_NAME = 'harmster-module'; with the name of your module BUT BUT now everyone can look in to this module D:< i dont want that! Ofcourse you dont want that. Clients are famous for breaking everything where they put their hands on, so we need to create permissions! Now the way you make permissions is just genius and so easy, you just add this to your ___install method, $permission = $this->permissions->get(self::PERMISSION_NAME); if (!$permission->id) { $p = new Permission(); $p->name = self::PERMISSION_NAME; $p->title = $this->_('View Harmster Page statistics and synchronize pages with lists'); $p->save(); } And you create a permission constant just like PAGE_NAME like this const PERMISSION_NAME = 'hr-view'; And of course you can create more permissions, just genius! Now what our install method should look like is this: public function ___install() { $page = $this->pages->get('template=admin,name='.self::PAGE_NAME); if (!$page->id) { $page = new Page(); $page->template = $this->templates->get('admin'); $page->parent = $this->pages->get($this->config->adminRootPageID); $page->title = 'Harmster'; $page->name = self::PAGE_NAME; $page->process = $this; $page->save(); } $permission = $this->permissions->get(self::PERMISSION_NAME); if (!$permission->id) { $p = new Permission(); $p->name = self::PERMISSION_NAME; $p->title = $this->_('View Harmster Page statistics and synchronize pages with lists'); $p->save(); } } This will set a module page up for you And we create an uninstall method, this basicly reverts your installed permissions and pages. public function ___uninstall() { $permission = $this->permissions->get(self::PERMISSION_NAME); if ($permission->id) { $permission->delete(); } $page = $this->pages->get('template=admin, name='.self::PAGE_NAME); if ($page->id) { $page->delete(); } } Now you are might be wondering, how do i get to display content in my page :S Well, I kinda stole this from other modules and it does work, but I am open for suggestions. the method ___execute gets executed when you click on your page in the PWCMS. What i wrote in there is public function ___execute() { return $this->_renderInterface(); } and in renderInterface() i put the next code: private function _renderInterface() { $this->setFuel('processHeadline', 'MailChimp synchronize tool'); $form = $this->modules->get('InputfieldForm'); $form->attr('id','ga_form'); $wrapper_audience = new InputfieldWrapper(); $field = $this->modules->get("InputfieldMarkup"); $field->label = $this->_("Gebruikers"); $field->columnWidth = 100; $members = $this->list_members($this->get_apikey()); $html = "<table class='AdminDataTable AdminDataList AdminDataTableSortable'>"; foreach($members['data'] as $member) { $html .= "<tr><td>" . $member['email'] . "</td><td>" . $member['timestamp'] . "</td></tr>"; } $html .= "</table>"; $field->attr('value',$html); $wrapper_audience->append($field); $form->append($wrapper_audience); return $form->render(); } Bascily you create a form and you render the form and that displays it for you, just play around with it for a bit and you'll get into it, as i am still getting into it. I am lazy, here a copy, pastey (no emoticon because its not allowed) <?php class Harmster extends Process implements Module, ConfigurableModule { const PAGE_NAME = 'harmster-module'; const PERMISSION_NAME = 'hr-view'; public static function getModuleInfo() { return array( 'title' => 'Harmster', 'version' => 001, 'summary' => '', 'href' => '', 'singular' => true, 'autoload' => true, ); } public function init() { $this->fuel->set("harmster", $this); } static public function getModuleConfigInputfields(array $data) { } public function ___install() { $page = $this->pages->get('template=admin,name='.self::PAGE_NAME); if (!$page->id) { $page = new Page(); $page->template = $this->templates->get('admin'); $page->parent = $this->pages->get($this->config->adminRootPageID); $page->title = 'Harmster'; $page->name = self::PAGE_NAME; $page->process = $this; $page->save(); } $permission = $this->permissions->get(self::PERMISSION_NAME); if (!$permission->id) { $p = new Permission(); $p->name = self::PERMISSION_NAME; $p->title = $this->_('View Harmster Page statistics and synchronize pages with lists'); $p->save(); } } public function ___uninstall() { $permission = $this->permissions->get(self::PERMISSION_NAME); if ($permission->id) { $permission->delete(); } $page = $this->pages->get('template=admin, name='.self::PAGE_NAME); if ($page->id) { $page->delete(); } } public function ___execute() { return $this->_renderInterface(); } private function _renderInterface() { $this->setFuel('processHeadline', 'MailChimp synchronize tool'); $form = $this->modules->get('InputfieldForm'); $form->attr('id','ga_form'); $wrapper_audience = new InputfieldWrapper(); $field = $this->modules->get("InputfieldMarkup"); $field->label = $this->_("Gebruikers"); $field->columnWidth = 100; $members = $this->list_members($this->get_apikey()); $html = "<table class='AdminDataTable AdminDataList AdminDataTableSortable'>"; foreach($members['data'] as $member) { $html .= "<tr><td>" . $member['email'] . "</td><td>" . $member['timestamp'] . "</td></tr>"; } $html .= "</table>"; $field->attr('value',$html); $wrapper_audience->append($field); $form->append($wrapper_audience); return $form->render(); } } I'll update this tutorial in the near future as i am still working my way up (no emoticon because its not allowed) Aww, i get an error when i save it, thats not nice. Thanks for reading (no emoticon because its not allowed)EDIT Updating this tutorial very soon, its horrible and incorrect1 point
-
Hi to all, As I've mentioned earlier to Ryan, ProcessWire runs fine on Windows 7/2008 Server setup with IIS 7.5 WebServer with IIS Mod-Rewrite from Micronovae that can read .htaccess file. The problem is that this IIS filter is free for development use on localhost without limitations but it's not free for production use on live server (it costs $150 per server license). I've found another solution that works flawlessly and it's absolutely free. Download URL Rewrite Module 2.0 for IIS from http://www.iis.net/download/urlrewrite and install it Define new web site under "sites" in IIS Manager and point it to directory where you've unzipped ProcessWire files Download web.config (translated from original .htaccess) file from this post, unzip it and put it in ProcessWire root directory Delete .htaccess file (because you don't need it any more). I hope that this will help someone if the need arises for ProcessWire use on this kind of install. web.config.zip1 point
-
FrontendUserRegister (dev / maybe unstable!!!) Simple user registration process. Create a new user with checked values if username & email isn't taken by a existing user and not empty a correct password is set Required FormHelper Version 0.0.5+ Download Processwire module page: http://modules.processwire.com/modules/frontend-user-registration/ Bitbucket Repo: https://bitbucket.org/pwFoo/frontenduserregister/ Usage // load module and output the register form echo $fur = $modules->get('FrontendUserRegister')->register("{$redirect_after_register}"); Planned features email activation Module isn't available anymore, but it's planed to replace FrontendUserLogin and FrontendUserRegister with the new FrontendUser module which is not released yet. A new support topic will be created after FrontendUser module is added to the PW module repo. Added new FrontendUser module1 point
-
Hello everybody, I'd like to introduce a new module to you. It automatically adjusts pages' URLs based on naming patterns. It allows you to specify a general pattern for all pages or individual patterns per template. It is available in the ProcessWire module directory. Also you may find the code here. New: Auto Name has been updated to Version 1.1. Changes: It is now possible to set a human-readable date format for the created and updated fields Renaming can now be restricted to unpublished pages Includes a fix for a bug that accidentally renamed system pages I'm looking forward to your feedback. Thanks in advance, Marvin1 point
-
1 point
-
1 point
-
Nice and clean and simple. Where do the recipes come from? Oh, just answered my own question by translating!1 point
-
I suppose it depends what the module is doing. If it is doing something live with the content (hanna code or auto links are good examples) then I suppose it will have a small effect. If it is providing functionality to the admin, like a field type, for instance, then no. However, add ProCache to the scenario and this all becomes pretty academic.1 point
-
Gotta love it when this happens. Sit baffled for 20 minutes, open a forum thread, and solve the problem before anyone gets a chance to say anything. Ah well, as is life.1 point
-
This looks excellent! I've been manually creating my SEO tabs. So this is a huge relief! And I really dig the preview. (Better than what it looks like with WordPress SEO, for sure.) Kudos!1 point
-
Ivan - I upgraded with the new Upgrade module. I didn't even back up the database. See what 2 weeks of holiday in the UK does ... Makes you reckless and free.1 point
-
"I'm walking backwards to Christmas Across the Irish sea...." I'm too lazy to update from somewhere interesting. Though I did direct a vocalist over my phone sitting on Haytor rocks in Dartmoor. I was on the rocks, not the singer.1 point
-
here you find the updates in german language files for the PW dev. https://github.com/Manfred62/pw-lang-de/tree/dev new german updates for actual PW dev 2.5.5 (19 October 2014). updated files: wire--modules--fieldtype--fieldtypedatetime-module.json wire--modules--inputfield--inputfieldpagetable--inputfieldpagetable-module.json wire--modules--process--processtemplate--processtemplate-module.json wire--core--pages-php.json added files: wire--modules--process--processrecentpages--processrecentpages-module.json wire--modules--system--systemnotifications--systemnotifications-module.json1 point
-
I think you didn't understand the concept of urlSegements. What you want is something like this: <?php $splitted = explode('/', $page->url); echo $splitted[2]; ?>1 point
-
They are working. If you open this url for example: http://tjmahaffey.com/blog/asas/ the first urlSegment relative to the page would be "asas". If the y wouldn't work you would receive a 404 If you had expected "blog" to be the url segment you have to use e.g. $page->name1 point
-
@gebeer Great to see you get a solution to this. Really glad you benchmarked the options too.1 point
-
Nice! This was a learning experience for me too . Would love to see the final code/implementation (if possible). Or is it the one above?1 point
-
@kongondo In my foreach, the values are converted to timestamps before I send them to the Timestamps module (note the 2nd line here) foreach ($times as $t) { $t = $t->getTimestamp(); $timestamp = new Timestamp();//this is the Class Timestamp found in Timestamp.php. Included via FieldtypeTimestamps. $timestamp->date = $t; // note stored in column 'data' in the db of the Field $editpage->ad_publish_at->add($timestamp); } That's why I don't understand that PHP Notice. But my solution to convert the value again with strtotime seems to be working fine and everything behaves as expected. So no need to worry about it any further.1 point
-
@Macrura Glad this worked out for you. Actually, the PW admin interface does what you are after already (if I understand you correctly.) If you edit a template and look at the AsmSelect list of fields in the template - each one of them is clickable and brings up a modal edit for that field's properties when used in that particular template. This would suggest that everything you need is already built right into AsmSelect so I'd suggest you have a look through the source code and see what's commented in there and how Ryan uses it.1 point
-
Actually if you look at the code in Timestamp.php, lines 40-47, that is where the conversation from string to integer happens so you don't have to do this in your foreach; Providing a date string is enough . if($key == 'date') { // convert date string to unix timestamp if($value && !ctype_digit("$value")) $value = strtotime($value); // sanitized date value is always an integer $value = (int) $value; } See also the comment in FieldtypeTimestamps.module lines 140-1 Also never got the errors you were getting. But I suppose your implementation of the code is different so I may be way off here... Btw, about your earlier questions on how stuff was getting deleted in the backend? The module is using trackChanges. You can read more here about the method. Edit: Aaah, I think I now see why you were getting that PHP notice. As pointed out in the SO link you gave, date() expects the second parameter to be an integer. In the case of InputfieldTimestamps.module, it's getting its values from the database. Those values were already saved as integers so no need for strtotime at that point. In your case, your values are coming from your frontend form as strings so they needed to be parsed into timestamps. At least I think this is what was happening. Anyway, you sorted it out but just thought to clarify this. Or maybe, I am not getting what's going on....I am having one of those slow days...again...sigh...1 point
-
Thanks for that guys. This solution is quite brittle and may break with future releases of PW as it relies on the current way that PW marks up the submission form with a class that contains the template name. If PW ever stops adding that markup class, this will break. Also take note of that space after the end of the template name in the search string - which is needed if you have templates with matching substrings: like "patient" and "patients" where both would match if you tried to apply it only to "patient" and don't have the space at the end. I'd much rather be able to access the template name directly somehow from the hook method (preferably as the form is built rather than post-rendered) but I just couldn't find the right way to access it.1 point
-
Some more bug fixes - thanks again to muzzer! More interestingly though, during import you now have the option to automatically download and install any required missing fieldtypes/inputfields from the PW modules directory. This is optional and I have noted that if you don't trust the source of the data you are importing, then you might want not want to enable this option. It is off by default, in which case you'll receive notifications of what's missing so you can install manually before re-starting the import.1 point
-
Hi Macrura, Here's a version for select multiple... <?php class InputfieldSelectMultipleExtended extends InputfieldSelectMultiple { public static function getModuleInfo() { return array( 'title' => __('Select Multiple Extended', __FILE__), 'version' => 1, 'summary' => __('Multiple selection with extended attributes. An enhancement to select multiple', __FILE__), 'permanent' => false, ); } /** * Adds an option with extended attributes */ public function addOption($value, $label = null, array $attributes = null) { if ( is_null($value) || (is_string($value) && !strlen($value)) ) { return $this; } if (null === $attributes) { $attributes = array(); } $extra_atts = $this->extendAttributes($value, $label); $attributes = array_merge($attributes, $extra_atts); return parent::addOption($value, $label, $attributes); } /** * Hook this and return an array with whatever extended attributes you need. * */ public function ___extendAttributes($id, $value) { $atts = array(); /** * Either hook this method to do what you want or implement things directly if this * is the only use of this Inputfield. * For your example you'd grab the fields you want from your page and put into data * attributes... */ $page = wire()->pages->get($id); $atts['data-description'] = $page->description; return $atts; } } Here's how to use it... Save this module as InputfieldSelectMultipleExtended.module in your site/modules directory of a development install of PW. Install it in PW. Edit InputfieldPage's module configuration and add InputfieldSelectMultipleExtended to the inputfields that can represent pages. Create a new Page field and select InputfieldSelectMultipleExtended on the input tab and setup the parent and other fields as required. Add the new page reference field to a template. Add some pages that use this template. Check the HTML of any of the pages using the template and you should see the options for the select have data-description attribute for every page referenced that has a non-empty description field. Hope that helps!1 point
-
Hello again! We've just updated Ratings to Version 1.1, which includes a simpler, more unified API. You can access all API methods via the ratings property. Examples: $page->ratings->add(4); $page->ratings->average; // => 4.4 $page->ratings->count; // => 12 The changes should appear soon in the ProcessWire modules directory. Please check out our GitHub repository for more details.1 point
-
1 point
-
I have made some nice progress: DeliveryPost done, which asks post address + email.These DeliveryModules pretty much control the whole checkout process (and also adds some admin actions). This is the part of the shop that I guess will be most often customized. It also keeps things simple, when your needs are simple. module that hooks into DeliveryPost and adds shipping options order events (or order history - what has happened and when) Oh, and the module has a name: PadLoper (named after cute turtle species) Here are few teasers:1 point
-
A very wonderful and remarkable piece of work. Thank you for producing this module. I believe and certainly hope that this module will further open the door for acceptance of ProcessWire in a lot of places. Kongondo, you have talent.1 point
-
For those interested. Requires the shop module installed, code not well documented and from the my first steps in PW time. So be honest with me templates.zip1 point