Leaderboard
Popular Content
Showing content with the highest reputation on 02/05/2016 in all areas
-
This week we have another new ProcessWire 3.x version for you that includes several updates and optimizations. We’ve also greatly expanded upon the field rendering with template files, with lots of info covered in this post. https://processwire.com/blog/posts/processwire-3.0.7-expands-field-rendering-page-path-history-and-more/6 points
-
My setup: ->every event is a page ->events are listed only in a overview page ->i change the name of the event pages ot something like my-great-event-title-2016-02-04-id.ics that the page template itself works as a ics file I've this in my event.php: <?php //set correct content-type-header header('Content-type: text/calendar; charset=utf-8'); header('Content-Disposition: inline; filename='.$page->name.''); //get the data for the ical file $homepage = $pages->get('/'); $event_desc = stripslashes(strip_tags($page->event_text)); // get the startdate $dtstart_date = $page->getUnformatted("event_start_date"); $dtstart_time = $page->event_start_time; $tsstart = strtotime($dtstart_time); // get the enddate $dtend_date = $page->getUnformatted("event_end_date"); $dtend_time = $page->event_end_time; $tsend = strtotime($dtend_time); //set the repetition_type to the recur option value $event_repetition_type = $page->event_recur; //set the output for rrule in ical file $rrule = ''; switch ($event_repetition_type) { case '2': $rrule = 'RRULE:FREQ=WEEKLY;COUNT=5;'; break; case "3": $rrule = 'RRULE:FREQ=WEEKLY;INTERVAL=2;COUNT=5;;'; break; case '4': $rrule = 'RRULE:FREQ=WEEKLY;INTERVAL=3;COUNT=5;;'; break; case '5': $rrule = 'RRULE:FREQ=MONTHLY;COUNT=5;;'; break; case '6': $rrule = 'RRULE:FREQ=YEARLY;COUNT=5;'; break; default: $rrule = ''; } //build the .ics data $ical_data = 'BEGIN:VCALENDAR'; $ical_data .= "\r\n"; $ical_data .= 'VERSION:2.0'; $ical_data .= 'PRODID:-//'.$homepage->title.'//NONSGML ProcessWire//DE'; $ical_data .= "\r\n"; $ical_data .= 'CALSCALE:GREGORIAN'; $ical_data .= "\r\n"; $ical_data .= 'METHOD:PUBLISH'; $ical_data .= "\r\n"; $ical_data .= 'BEGIN:VEVENT'; $ical_data .= "\r\n"; $ical_data .= 'SUMMARY:'.$page->title; $ical_data .= "\r\n"; $ical_data .= 'UID:' . md5(uniqid(mt_rand(), true)) . '@'.$config->httpHost; $ical_data .= "\r\n"; $ical_data .= 'CLASS:PUBLIC'; $ical_data .= "\r\n"; $ical_data .= 'STATUS:CONFIRMED'; $ical_data .= "\r\n"; if ($rrule) { $ical_data .= $rrule; $ical_data .= "\r\n"; } $ical_data .= 'DTSTART:'.date('Ymd', $dtstart_date).'T'.date("His", $tsend); $ical_data .= "\r\n"; $ical_data .= 'DTEND:'.date('Ymd', $dtend_date).'T'.date("His", $tsstart); $ical_data .= "\r\n"; $ical_data .= 'DTSTAMP:'.date('Ymd').'T'.date('His'); $ical_data .= "\r\n"; $ical_data .= 'CATEGORIES:Landwirtschaft,Maschinenring'; $ical_data .= "\r\n"; $ical_data .= 'LOCATION:'.$page->location; $ical_data .= "\r\n"; $ical_data .= 'URL:'.$page->httpUrl; $ical_data .= "\r\n"; $ical_data .= 'END:VEVENT'; $ical_data .= "\r\n"; $ical_data .= 'END:VCALENDAR'; //output echo $ical_data; ...not the smartest code - could be refactored and opitmized - but it is working for an "save to outlook" link... additional i've a "save in your google calendar" link that works with the google calendar API: //output Ical Outlook link echo '<a href="'.$e->url.'"><span class="fa fa-windows" aria-hidden="true"></span> Outlook iCal Link</a><br>'; //output Google Cal link echo '<a target="_blank" href="https://www.google.com/calendar/event?action=TEMPLATE&text=' .$e->title. '&dates=' .date('Ymd', $e_start).'T'.date("His", $tsstart).'/'.date('Ymd', $e_end).'T'.date("His", $tsend). '&location=' .$e->event_location->title. '&details=' .$e_text_decode. '&trp=true"><span class="fa fa-google" aria-hidden="true"></span> Google Calendar Link</a>'; maybe not the best but useful examples... best regards mr-fan5 points
-
This feature has saved my ass a few times Phpstorm is very project-centric, knows more of the project than you I believe this IDE helped me much becoming a better developer. As for the methods/properties, there's a popup (ctrl+F12 here) that lists all of them in the file, but you can stick this panel where you want.4 points
-
Just incorporate one of these: https://gist.github.com/jakebellacera/635416 https://github.com/hising/ics-generator Have a go and drop a line if you have any problems.3 points
-
Just wanted to let you guys know that I have committed some changes over the last couple of days that brings complete live updating of child page details (name, template, hidden status, unpublished status, and removal of a row if deleted) in the edit mode table after making edits to a specific page in a modal popup. It might not seem like much, but it makes this mode much more functional and intuitive. Please let me know if you notice any problems.3 points
-
Here's the latest version of the MVC-ish structure I was referring to in my previous post, in case someone wants to take a peek: https://github.com/teppokoivula/pw-mvc/.3 points
-
If you have most of the content in the templates, and not harcoded in the template files, it's not that difficult. Roughly, this is what you should do. Install the language modules that are present at the core and convert the text and textarea fields to the correspondent multilanguage fieldtypes. Create the new languages, and edit the homepage urls to reflect this change (in the settings tab). If all goes well, in the template files you'll just need to create the language switcher. If you have some hardcoded content on the PHP you can either create fields to accomodate it and distribute by the templates where it makes sense, or you can create a dedicated page for them, or you can even take advantage of internationalisation by using the function __(), like this: echo __("Something"). This will allow you to translate it in the admin, on the languages pages. For all this, go through the language docs https://processwire.com/api/multi-language-support/2 points
-
Update: Merged dev 2.3.6 to master. This version makes it possible to use CKEditor to create Quick Posts2 points
-
I just wanted to share a small module I just made, that can inherit values from pages, that are higher up in the page tree. This inheritance will only show for formatted output, so for example in listers or in the frontend. When using the unformatted value one will see, if a field is really set or not. <?php class FieldtypeInheritInteger extends FieldtypeInteger { public static function getModuleInfo() { return array( 'title' => 'Inherit Integer', 'version' => 101, 'summary' => 'If empty tries to get values of the same field from further above the pagetree. This does only work for formatted values so empty values won\'t ne overwritten by editing a page.' ); } public function ___formatValue(Page $page, Field $field, $value) { if(!$this->isEmptyValue($field, $value)) return $value; $parent = $page->parent("$field!=''"); if($parent->id) return $parent->getFormatted($field); else return $value; } public function ___markupValue(Page $page, Field $field, $value = null, $property = '') { return $this->___formatValue($page, $field, $value); } }1 point
-
A ProcessWire Fieldtype storing files in a customized location, outside the web root. This module is primarily useful if you need to store sensitive data which should not be accessible directly from the web. Normally, ProcessWire stores all files under /site/assets/files. Direct URL access to these files can be restriced by setting $config->pagefileSecure = true. Still you need to make sure that your template permissions are setup correctly. If something goes wrong, those files could be accessed from outside. GitHub: https://github.com/wanze/FieldtypeSecureFile Modules Directory: http://modules.processwire.com/modules/fieldtype-secure-file/ How does it work? After installing this module, you can create a new field of type SecureFile. Enter your configuration under the "Details" section when editing the field: Storage Location Enter a path outside the web root where the files are stored. You need to create the directory manually. Also make sure that the user running the web server has write permission. Roles allowing to download a secure file Users with a role selected here are able to download the files if a download is requested via the API. Allow Download in Admin If checked, users having a role selected above can download the files when editing a page. I needed this functionality for a recent project, so I created this module and thought to share it, mabye this is useful for someone else Consider it beta, I'm using it on one site but I'm sure it could be improved here and there. Feel free to suggest additional features! Cheers1 point
-
1 point
-
Hi Adrian! When I mark children page for delete and then Save the page, I get errors (see attachment). The page itself (http://localhost/processwire/page/edit/?id=1) returns " The process returned no content." Could it be my fault (playing around...)? No problem with editing and adding pages. error.txt1 point
-
It has simple stock management that can do just that. Need to update the website when I get to computer - that information is missing there.1 point
-
It's not like I could read my task manager, which tells me which program is using which amount of ram I'm fully aware vm's need lots of ram, but phpstorm needing roughly the same amount is hefty.1 point
-
Great Topic, i come across this problem all the time. Wouldn't be such a big problem if ID's were truly unique. With ID's are being auto incremented separately (on development, and in production) it makes it hard to merge the two DB's without conflict. I tend to just make a note of fields / templates added and then go through the process manually on live. Bit of a pain.1 point
-
1 point
-
Right now there's "quite a lot stress" around my work and don't have much spare time to figure new things out next to all the new things I have to learn right now. My mind is full with new info these days and I need the time to arrange that first . However, I do think IDE is the way to go in the for seeable future. (I did bought PHP Storm)1 point
-
@tpr Good point! The same is true in my case. It is gently leading me to the right direction. I could not ask for more in this regard1 point
-
...first I used Coda, then switched to Sublime Text, and now happily using Brackets: you should give it a try!1 point
-
I have tried all kind of editors and IDE's, but all those IDE's 'are' running on JAVA. There are a few things I really don't like about those IDE's is that your working space is full with all kind of buttons spoiling your work space. Next what I really hate is that those are slow, very slow. In the past they had even latency on typing in bigger documents. My experience with Eclipse isn't very good and I guess it's running from the same base as PHPStorm does. There are a some parts in BBEdit that I've never seen in any editor. I can drop i a 150MB CSV and do regular regex find and replaces and it does do that quick. BBEdit is very precise with white space and you know your documents are clean. Sublime tend to make a mesh (I own a licence for that and have worked with Sublime for 3 months fulltime, (love the color coding)) With BBedit I can do (regex) find/replace directly on the server in thousands of files. Haven't seen those functionalities in other editors. And I don't know how to make PHPStorm aware of your project. Where you can get an overview of all your used methods properties and constand etc etc. So a part of the story is that I don't know how to configure it.1 point
-
No problem at all. Welcome to the forums btw. I am sure it will all start to make sense very soon!1 point
-
In this case you probably just want: $session->redirect( $page->redirectTo ); because a URL field doesn't have a url property - it's just a string.1 point
-
FYI, we have observed that if the source image is a progressive JPEG, crops created by this module will always start at 0,0 (the top left corner), regardless of the position specified by the user when creating the crop. Re-exporting the source images as regular, non-progressive JPEGs allows them to be cropped correctly.1 point
-
1 point
-
1 point
-
Hey Alxndre', It's possible. Just add the options to the supported fieldtypes array.1 point
-
Did I forget something important? https://www.producthunt.com/tech/processwire#comment-2230241 point
-
Hard to say without seeing the <head> on the specific pages you're talking about. Google still says this though: IMPORTANT: We continue to support and recommend using separate locale URL configurations and annotating them with rel=alternate hreflang annotations. Discovering based accept-language is one thing (this targets the users), you should still use the hreflang tags and <html lang="…"> (this targets crawlers). This will give better results as it's not prone to interpretation I believe. I haven't seen anything weird on the sites I use the plugin on yet, but will be monitoring.1 point