Leaderboard
Popular Content
Showing content with the highest reputation on 05/01/2016 in all areas
-
Template Latte Replace Latte template engine support for ProcessWire Having wrote about this one for a few times and now here it is. The readme is not complete but should give a solid starting point. Feel free to ask if something's not clear. http://modules.processwire.com/modules/template-latte-replace/ https://github.com/rolandtoth/TemplateLatteReplace5 points
-
Hey Steve - thanks for your interest in this module and thanks for figuring out the issues with WireQueue - as you mention it will probably happen with others too so I need a way to exclude as necessary, or maybe it can be automatically dealt with - I'll take a look. The one main issue still remaining with this module is the slowdown when a template includes page fields - at the moment the module generates content for all fields from the templates of these page fields - this can take some time. I need to figure out a better way to do this. Connected to this is the delay from calling the http://loripsum.net API. Even though I make use of Faker locally for most things, the RTE fields still use http://loripsum.net because of their random text/image options. I would like to recreate this functionality directly with the Faker API as it would make it much quicker. Otherwise I think it is working well, although I would still like to add support for Profields etc.4 points
-
It's not just about finding in memory vs. finding in the database. Generally, you can only assume that relative timestamps work when you're callling find() on $pages/wire('pages'). In your example, you're calling find() on the comments fieldtype. You're not looking for pages (comments aren't pages but rather entries in a multivalued field, like an extended FieldtypeTextarea). FieldtypeComments::find casts a good number of selector values to integer when assembling the database query: if(in_array($f, array('id', 'status', 'created', 'pages_id', 'parent_id', 'created_users_id', 'upvotes', 'downvotes'))) { $_sql .= "AND $f$operator" . ((int) $value) . " "; Thus, you can assume that relative timestemps work when there's a $pages or wire('pages') (or $this->pages inside a module) in front of your find() call. It probably won't work if you are calling $somepage->somefield->find(), unless somefield is a page field. It won't work if you call it on a PageArray (or other WireArray), so $pages->find(someselector)->find(selector_with_relative_timestamp) will fail. Relative timestamps are hardcoded in core/PageFinder.php to work for "created", "modified" and "published". It would probably be feasible to modify FieldtypeComments::find to employ the same logic: if(in_array($f, array('id', 'status', 'pages_id', 'parent_id', 'created_users_id', 'upvotes', 'downvotes'))) { $_sql .= "AND $f$operator" . ((int) $value) . " "; } else if($f == 'created') { $value = (ctype_digit($value)) ? (int)$value : strtotime($value); $value = date('Y-m-d H:i:s', $value); $_sql .= "AND $f$operator'" . $value . "' "; I've taken the liberty to file a feature request on github.4 points
-
Try looking at the Network tab (make sure it is open before you upload the image). You should end up with a line that has an error - that will be the PHP error that will give you the info to figure out what is wrong. The error you are seeing in the console is a syntax error because the ajax call is returning the real error. My initial guess would be file/folder permissions, but if you let us know the error, we should be able to figure things out.3 points
-
Last week I mentioned we'd be continuing the documentation updates into this week and that's exactly what we did. All in all, these documentation updates involved 46 files and 5264 additions, so far. Read more about it in this weeks' blog post: https://processwire.com/blog/posts/processwire-3.0.16-continues-expanding-documentation-and-more/3 points
-
Hi Adrian, Thank-you for this module - I've been looking forward to trying it out for over a week and now have my chance. I just installed it in a PW 2.7.3 site and have given it a cursory try. Unfortunately, it seems to conflict with horst's WireQueue module. I have several queues set up and they all use the WireQueueFile queue type. When I installed AutoContent, the WireQueue children become inaccessible in the page tree, and via the API. Removing your module restored everything to working order, so I enabled Tracy and re-installed AutoContent to find out why. In the end, it turned out to be the auto-content generator getting called for the fields in the WireQueue templates. I changed the AutoContent hook code to the following and all started working with my site again. public function autoContent($event) { $p = $event->arguments(0); if($p->template == "admin") return; if($p->template == "wire-queue-tools") return; // Added for WireQueue compatibility if($p->template == "wire-queue-storage") return; // ditto $field = $event->arguments("field"); $value = $event->arguments("value"); //if not empty then display available real content if(!is_object($event->return) && $event->return != '') return; if(is_object($event->return) && count($event->return) > 0) return; //if MapMarker set to default then exit if(isset($event->return->lat) && $event->return->lat != '0.000000') return; $event->return = $this->generateContent($p, $field, $value); } Not sure what the best approach to handling this kind of needed exclusion might be, perhaps a multi-select of templates to be excluded from auto-content generation? Now, on with the trial of this module!2 points
-
You can also add your personal styles in site->modules->InputfieldCKEditor->mystyle.js Example: CKEDITOR.stylesSet.add( 'mystyles', [ { name: 'Credit Card Icon', element: 'i', attributes: {'class': 'uk-icon-credit-card-alt'} }, { name: 'Panel Title', element: 'h4', attributes: {'class': 'uk-panel-title'} }, ]); You could now select on-demand which <i> and <h4> you want to apply those styles.2 points
-
Well... the problem was with field which had ChosenSelect inputfield. Posted issue in module support board - https://processwire.com/talk/topic/8955-inputfieldchosenselect/ Q is closed so far.2 points
-
Just grab the latest version from git (if you get a message that configurable module test failed, repeatedly refresh modules until the message goes away), then go into the module configuration and select "Radios". You can exclude certain media pages from showing up for the user through a hook in ready.php: wire()->addHookAfter("MediaLibrary::getPageMediaLibraries", null, "filterLibraries"); function filterLibraries($event) { $media = $event->return; if(! wire('user')->isSuperUser) { $event->return = array_filter($media, function($v) { return ($v->id != $ID_OF_PAGE_TO_EXCLUDE); }); } }2 points
-
Hi everyone, This is an early (but mostly functional) version of a module that I am experimenting with for automatically populating all empty fields on a page. It is designed for use during site development and should be uninstalled once the site is live. https://github.com/adrianbj/AutoContent (anyone have an idea for a better name?) It currently supports the following field types: Text - outputs "This is an example Field Label", where "Field Label" is the label for the field Textarea (RTE and plain) - configurable content from http://loripsum.net/ and embedded images from http://lorempixel.com Datetime - honors output formatting and returns random date/time with configurable min/max datetime Integer - honors min and max settings Float - honors min, max, precision settings URL - returns a random URL Email - returns a random email address Image - you can specify image category (people, nature, business, etc), and the range for min/max number of images to generate. Page - creates runtime selected child page content for output - not well tested yet. MapMarker - not well tested yet! I will be adding support for Profields and other selected 3rd party fieldtypes shortly. Highly configurable content is provided by: http://loripsum.net/ http://lorempixel.com/ https://github.com/fzaninotto/Faker Generated content can be localized to your region - very handy for addresses, people's names, phone numbers etc: Many fieldtypes are configurable via the Input tab on the field's config settings, eg: Textarea: Text: Images: Datetime: In general I am designing this to work with minimal/no configuration so you can install and have all fields on all pages on your site immediately populated for testing layout and styling without the need for manually adding dummy content. There is also a dummy page batch creator and deletor (automatically tracks and deletes just the dummy pages) available from the module config settings page. Please let me know if you think you will find this useful - trying to get an idea of how much time to put into support for additional field types.1 point
-
Found Spectre.css framework during I searched the web... could be interesting, so I post it here. Spectre.css is a lightweight, responsive and modern CSS framework for faster and extensible development. lightweight and clean starting point for your project and prototype flexbox, responsive and mobile-friendly layout carefully designed elements built in useful components and utilities patterns and html templates soon email templates soon URL: http://picturepan2.github.io/spectre/1 point
-
Great, thanks! Both working fine. However, when going to the Media page in the admin, I get an error: "Call to a member function count() on null" line: https://github.com/BitPoet/MediaLibrary/blob/master/ProcessMediaLibraries.module#L41 I've removed the MediaFiles from the template, I guess that's why. Possible fix: foreach($this->pages->find("template=MediaLibrary") as $pg) { $MediaImagesCount = $pg->MediaImages ? $pg->MediaImages->count() : 0; $MediaFilesCount = $pg->MediaFiles ? $pg->MediaFiles->count() : 0; $tbl->row(array( "<a href='{$pg->editURL}'>{$pg->title}</a>", implode(' / ', array_map(function($item) { return "<a href='{$this->config->urls->admin}page/?open=$item->id'>$item->title</a>"; }, $pg->parents()->getArray())), $MediaImagesCount, $MediaFilesCount )); }1 point
-
Soma This Module just helped me with my Form / PostMark problem https://processwire.com/talk/topic/12322-mandrill-upcoming-changes/page-2#entry1192291 point
-
getTotal is not reevaluated as it's meant to be used for pagination and only the db can know the unlimited number of pages for a certain selector. That's why you need a single selector to select pages if you need to work with pagination.1 point
-
I'm still a bit stumped to read that find() on PageArrays works for you. I just tested again on 2.7 and 3.0.16, and in both versions, I don't get any results if try to filter a PageArray by a relative time. To illustrate that: $old = $pages->find("created>='65 days ago'"); // this gives back 8 results $fresh = $pages->find("created>='30 days ago'"); // this gives back 1 result $filtered = $old->find("created>='30 days ago'"); // this gives back an empty PageArray, though getTotal() still returns 8 ()1 point
-
https://github.com/ryancramerdesign/ProcessWire/issues/1803 Will see what Ryan has to say.1 point
-
Take a look at this post by soma: https://processwire.com/talk/topic/4530-how-to-get-a-list-of-all-pages-recursiv-without-admin-pages/?p=445081 point
-
You might find wireSendFile with the forceDownload option useful: https://github.com/ryancramerdesign/ProcessWire/blob/7e8c7c6836282b6b64de81263f5aaa8112fd51ae/wire/core/Functions.php#L5211 point
-
Thanks! Setting "/medialibrary1/medialibrary2" allows users selecting images from these pages now. I didn't wanted them to see or use images from "/medialibrary1" but it's something I can live with Now I can use it for common site-wide images, which will be a great plus. Have you considered changing the way Media Libraries are selected? The current selectbox doesn't seem too user-friendly UI-wise. Maybe radios would be better so they could see libraries with fewer clicks.1 point
-
I'm a little bit uncomfortable with allowing just any child under a media library, but I can understand the wish for nesting, so version 0.0.7 on github allows you to create libraries under existing MediaLibrary pages, and these child libraries (no limit for nesting) are also listed whenever their parent library is. For anybody planning to use MediaLibrary through the API, there's a new method that returns an array with all applicable media pages for a given page (following the under-parent-or-current-page rule): $ml = wire('modules')->get('MediaLibrary'); $mediapages = $ml->getPageMediaLibraries($page); foreach($mediapages as $mpage) { // ... } I've made getPageMediaLibraries hookable if anybody wants to apply further rules to which pages should be available.1 point
-
I got a client request to make Word template so she can create an image of the weekly menu of a restaurant to post on Facebook. I usually get sick when I have to deal with M$ Word - it's frustration and it's not meant to be used things like that. So I figured out a better system: PW + html2canvas.js. It took more time to finish but it was worth the trouble. The main issues were html2canvas versus some CSS issues, plus switching to different languages in PW on each line. Also, JavaScript cannot offer named downloads, only "download.png", so I had to use HTML5 attribute "download" on links to be able to add custom download filename. I used ProField modules Table and Matrix Repeater which allow very pleasant editing of menu items, even in multilanguage context. Front-end editing is created using the built-in front-end editor. I was about to achieve inline editing of menu items but it soon turned out that repeaters and tables can't be edited this way. Anyway, it's still better compared to my module FEEL because sections are reloaded using Ajax and the admin lightbox shows only the fields I choose. Here's a quick screencap - when the gray background turns to dark gray, then the menu is not HTML but canvas, that can be downloaded.1 point
-
Another option is to implement something basic. If you do not have too many levels, you can do it without going recursive: <ul class="menu-ul"> <? foreach ($children as $level1): ?> <li<? if ($level1->id == $page->id) echo ' class="active-item"' ?>> <a href="<? echo $level1->url ?>"><? echo $level1->title; ?></a> <? if ($level1->url != $homepage->url): ?> <? $children = $level1->children(); ?> <? if ($children->count() > 0): ?> <ul> <? foreach ($children as $level2): ?> <li<? if ($level2->id == $page->id) echo ' class="active-item"' ?>> <a href="<? echo $level2->url ?>"><? echo $level2->title; ?></a> <? $children = $level2->children(); ?> <? if ($children->count() > 0): ?> <ul> <? foreach ($children as $level3): ?> <li<? if ($level3->id == $page->id) echo ' class="active-item"' ?>> <a href="<? echo $level3->url ?>"><? echo $level3->title; ?></a> </li> <? endforeach; ?> </ul> <? endif ?> </li> <? endforeach; ?> </ul> <? endif ?> <? endif ?> </li> <? endforeach; ?> </ul>1 point
-
@Günter, Why not use one of the other examples of recursive menu methods in the forums?1 point
-
Thanks netcarver. I have an idea to collect such mini-modules into a one admin helper module but as usual I don't know when will I have to do that1 point
-
To start with, with DigitalOcean you can choose the location of your droplet, or spread your droplets across the world. You can activate / provision / switch off droplets via API. You pay by time and not by month, so if you need more resources at peaks, you just activate more. It's for different usage. HE is for "hosting", DO is for a scaling infrastructure that can be programmatically coordinated. docker-machine supports Digital Ocean, but not Host Europe. Besides, with DO you have a lot of choice between various OS and pre-configured systems, for example for tryout. And it comes without plesk, which to me is an advantage For you, HE is probably the best option. For others, it's something else1 point
-
New update to support random images within RTE textarea fields. You can specify whether to include images, and the positions that they might be placed in. You can reload the page several times and the images will change positions/alignment randomly. I would very much like to hear suggestions from anyone using this if they have any ideas for improvements - do you want more configuration options - eg size of the embedded images, captions, etc?1 point
-
Good work! Regarding best practises, the only suggestion I have is that the tutorial should be changed to use environment variables for the database connection. This has several benefits, for an example It would be very easy to launch a separate development site, which uses a different database, because all you need to change is the environment variable when launching the development web container You could easily use the same config.php as a template for new sites You don't have to store sensitive information in your version control The config.php becomes more cloud compatible (i.e. a twelve-factor app) Also since the MySQL-container is linked to the web-container, the config.php can directly use the environment variables set by Docker. An example config.php would be $config->dbHost = getenv("MYSQL_PORT_3306_TCP_ADDR"); $config->dbName = getenv("MYSQL_DBNAME"); $config->dbUser = getenv("MYSQL_DBUSER"); $config->dbPass = getenv("MYSQL_DBPASS"); $config->dbPort = getenv("MYSQL_PORT_3306_TCP_PORT"); Obviously launching the web container(s) would need to include these variables too, e.g. docker run -e "MYSQL_DBNAME=mypwdb" -e "MYSQL_DBUSER=mypwdbuser" -e "MYSQL_DBPASS=mypwdbpass" --name celedev-site -p 8088:80 --link database:mysql --volumes-from celedev-data -d php-5.6-pw-celedev Just my two cents1 point
-
Thanks so much Ryan for the active help! But finally we sorted it out, and she agreed to add the /var/.../phptmp folder, that was already there in the web root, to the php ini "upload_tmp_dir". Now it works again flawless. Anyway, the new available option you implemented may come in useful for someone.1 point