Leaderboard
Popular Content
Showing content with the highest reputation on 03/15/2016 in all areas
-
Yahoo! Seems like our little campaign was successfull! Not without some changes in the alternativeto.net's inner workings (I do not know where that cyn.in went and how Joomla lost 2 voices), but anyway! Something to count as success at the end of the year. Edit: Interesting, have we got any trafic increase from there?9 points
-
You might want to try to set the the dbHost in /site/config.php to: $config->dbHost = '127.0.0.1'; // Use an IP address instead of localhost Also on Mac don't use .local domains like mywebsite.local. This can be very slow due to some internal routing stuff. There are others too with slow admins. Small hint6 points
-
https://processwire.com/api/user-access/permissions/#user-admin-permissions6 points
-
$child->image->url If this only does give you the path to the folder, your image field is multiple and not a single image field. If you change your field to only allow 1 image, then this would give you the full url to the image.4 points
-
In permissions, I see: user-admin-all, user-admin-staff, user-admin-customer, user-admin-administrator. Have you tried to only give the administrator role permissions for user-admin-staff and user-admin-customer. I think you have, or not? If so, they will see in a user edit page the role of administrator too, but they cannot select/change them, like with the guest role. If one try to select / change the role, it is displayed a red warning: (You may not change this role). Or do you ask how to hide those roles?4 points
-
Ah, sweet! So that was added not long ago then, like Ryan once again knew I'd need this soon (get out of my head! ).3 points
-
Replace the fuel() call with wire('all') or wire('*') should get it working in 3.0, as LostKobrakai pointed out in this thread.3 points
-
If I understand right, you use: <a href="<?php echo $config->urls->root; ?>"> but you should use: <a href="<?php echo $pages->get('/')->url; ?>">2 points
-
From a glimpse into PageFrontEdit.js, I don't think there is, but it might be worth a feature request to let inlineSaveClickEvent fire a custom jquery event on completion.2 points
-
Without changing the admin theme code (JS and/or CSS?), I think @Martijn's JS admin module could do the trick. I can't seem to remember its name atm...I'll check then edit this post Edit: The name is Admin Custom Files http://mods.pw/7i https://processwire.com/talk/topic/7588-admin-custom-files/ Edit 2: Or use the Reno Theme2 points
-
How to add custom format tags to CKEditor? Maybe this was posted before but here it is if somebody is in a desperate need of this. Here I add 'section' and 'small' tags to the Format dropdown. Entering additional tags in the field's settings in the admin ("Format Tags") doesn't work, results in a JS error: Uncaught TypeError: Cannot read property 'type' of undefined Drama. Searching for a solution everybody suggest two things: adding extra config options to config.js ("config.format_section = {element: 'section'}") plus editing language file (eg. "en.js") and add strings to these new tags that will appear in the dropdown I started this route but soon turned out that PW is not picking up languages from "/site/modules/InputfieldCKEditor/lang/" directory. Editing ones in "wire" dir works, but that's more of a drama as they will be wiped out on next update. Adding extra config options to config.js worked, but the new tags didn't have names (they were only empty lines in the dropdown, however, they worked). Finally I found that adding a "name" along with the element works (in "/site/modules/InputfieldCKEditor/config.js"): CKEDITOR.editorConfig = function (config) { config.format_section = {element: 'section', name: 'Section'}; config.format_small = {element: 'small', name: 'Small'}; }; Now these extra tags will appear in the Format dropdown and they'll also have names (titles). Also you'll need to add the extra tags in the "Format Tags" field in the admin (found on the ckeditor field's "Input" tab): p;h2;h3;h4;h5;h6;address;section;small The best would be if we could set these either only in the admin or in config.js, so not in two separate locations. I couldn't find a way to achieve this but it's still relatively easy to add.2 points
-
MediaLibrary Update: MediaLibrary can now be found in the official module list. Out of necessity, I've started to implement a simple media library module. The basic mechanism is that it adds a MediaLibrary template with file and image fields. Pages of this type can be added anywhere in the page tree. The link and image pickers in CKEditor are extended to allow quick selection of library pages from dropdowns. In the link picker this happens in the MediaLibrary tab, where you can also see a preview of the selected image. In the image picker, simply select a library from the dropdown at the top, everything else is handled by standard functionality. I've put the code onto github. This module is compatible with ProcessWire 3. Steps to usage: Download the module's zip from github (switch to the pw3 branche beforehand if you want to test on PW 3.x) and unpack it into site/modules Click "Modules" -> "Refresh" in the admin Click "Install" for MediaLibrary For testing, create a page with the MediaLibrary template under home (give it an expressive title like 'Global Media') and add some images and files Edit a differnt page with a CKEditor field and add a link and an image to see the MediaLibrary features in action (see the screencap for details) Optionally, go into the module settings for MediaLibrary Note: this module is far from being as elaborate as Kongondo's Media Manager (and doesn't plan to be). If you need a feature-rich solution for integrated media management, give it a look. Feel free to change the settings for MediaFiles and MediaImages fields, just keep the type as multiple. There are some not-so-pretty hacks for creating and inserting the correct markup, which could probably be changed to use standard input fields, though I'm a bit at a loss right now how to get it to work. I've also still got to take a look at error handling before I can call it fit for production. All feedback and pointers are appreciated (that's also why I post this in the development section). Edit 09.03.2016 / version 0.0.4: there's now also a "Media" admin page with a shortcut to quickly add a new library. Edit 01.05.2016: Version 0.0.8: - The module now supports nested media libraries (all descendants of eligible media libraries are also selectable in link/image picker). - There's a MediaLibrary::getPageMediaLibraries method you can hook after to modify the array of available libraries. - You can switch between (default) select dropdowns or radio boxes in the module configuration of MediaLIbrary to choose libraries. Edit 10.10.2018: Version 0.1.3: - Dropped compatibility for ProcessWire legacy versions by adding namespaces - Allow deletion of libraries from the Media overview admin page - Added an option to hide media libraries from the page tree (optionally also for superusers)1 point
-
Template Cache and $page->render($options) If you ever use the $page->render() to render out partials (of another page using its template file) and use template cache for the pages you're going to render and the page where you render it, it will create a cachefile. So if you go to that previously rendered and cached page, it will render that partial. If the page is accessed before a cache is created, it will cache this one and render that in as the partial, so kinda turned around. Funny effect. And many mmms and oaaahhhs To get a better understanding what's happening read on. Simple example code from a list page to render partials of articles (likely) // from the list pages template $markup = ''; foreach($products as $key => $child) { $markup .= "<dl>"; $markup .= $child->render(array('isOverview' => true, 'class' => $class)); $markup .= "</dl>"; } echo $markup; And in the template of the article // in article template file if(isset($options['isOverview']) && $options['isOverview'] == true) { // render small partial $class = $options['class']; $markup = "<dd class='$class'> <h4>$page->title</h4> <p>$page->summary</p> <a href='$page->url'>details</a> </dd>"; } else { // render complete article $markup = "<div class='product-details'> <h1>$page->title</h1> $page->body </div>"; } // output echo $markup; So now the render call $markup .= $child->render( array('isOverview' => true, 'class' => $class) ); in the list template will cache the page it renders (the small view of it). Thus if you access the page directly it will serve the cached small view of it. Ups. Solutions This is without specifying a different template file in the first argument in the render(). The effect doesn't happen when you, let's say create a new template file (ie article-small.php) and use that to render the page. Since this new template file is not connected to the template in PW it also has no cache for that render. To show what I mean is the following with the first argument the file you want the view to render. $markup .= $child->render("product-small.php", array("isOverview" => true, "class" => $class)); Still following me? Ok there's also another method to not allow a cache file to be created. There's a default options set in the render() in PW. Bingo! allowCache is what we can also use. $markup .= $child->render("product-small.php", array( "allowCache" => false, "isOverview" => true, "class" => $class )); And everything's back to normal. Just wanted to write down a little thing, as I stumbled over this recently, to scatter some keywords about this here . I think this isn't really documented somewhere but I thought it was maybe mentioned by Ryan in a thread about when he added this feature: http://processwire.com/talk/topic/3145-multiple-views-for-templates/page-2?hl=%2Brender+%2Bcaller#entry32876. Edit: Zaaakkkk and it's in Google 9 minutes !1 point
-
It occurred to me that a good addition to the forums would be some way for PW users to indicate support for a module idea. Similar to the Wishlist subforum but for functionality that belongs in a module rather than in the core. I'm thinking mainly of commercial modules, although if someone wanted to take up a module request and release it freely that would be cool. So users could propose a module idea, then others would vote for it (using likes or some special voting option) so that a vote means "I'd buy that", with the expectation of pricing in the general ballpark of Ryan's pro modules and Apeisa's PadLoper. As a beginner-intermediate developer I'm really enjoying working with PW and learning as I go - the API is so intuitive that I've been able to build my own solutions to things that in another CMS I would have been reliant on someone else's module to achieve. But there are things that I know are beyond my current skills, and for those things I look to third-party modules. My clients are non-profits and small businesses so I'm never likely to have the budget to commission a custom module alone. But there might be other PW users out there with similar needs and maybe that demand would make it worthwhile for an experienced developer to take on a proposal and release it as a commercial module. Currently there isn't a way to measure the demand for modules apart from occasional forum posts like "Is there a module that...?" Any thoughts on this? Here's a module request to start off with: I would be happy to buy a full-featured event calendar module. I've searched the module directory and the forums and Lindquist's module is the most feature-rich I've seen, but it's in an alpha proof-of-concept state and some important functions aren't implemented. Features I would be looking for are: Calendar grid interface in admin, allowing for easy addition and editing of events. (Nice but non-essential) Week and day views in admin, in addition to month view, with drag editing for event date and duration (I'm dreaming of something awesome like the dhtmlxScheduler interface or Fullcalendar interface). Although drag operations would really need an undo to correct accidental edits, so this may be more trouble than it's worth. Events are edited in a modal window, to avoid losing one's place in the calendar. Recurring events, with user-friendly selection of recurrence options. The ability to individually edit or remove an event that is a child of a recurring event (i.e. make an exception for that individual event). (Nice but non-essential) A couple of out-of-the-box minimal rendering options for the frontend (read-only calendar view, list view). This is the kind of module I need frequently. I've been lucky that I haven't had a client request a full event calendar since I've been using PW, but it's only a matter of time. I'm sure there are other PW users who need this and who would, like me, be happy to pay for such a module.1 point
-
$config->urls->root doesn't have anything to do with the pagetree, especially on multi-language setups. It's much rather intended to be used as variable if processwire is installed in the root directory ( /… ) or in a subdirectory ( /mySubdirectory/… ).1 point
-
How to fix admin header (e.g. where menu is) on top of the page, making it unscrollable? Admin menu is one of most frequently used elements of UI at my site, so original header scrollability is a bit annoying. It would also be better for notifications behavior as currently it breaks workflow by scrolling to the top as new notification event occurs.1 point
-
Without much testing: install AdminCustomFiles module, create /site/templates/AdminCustomFiles/ProcessPageEdit.css with: #masthead { position: fixed; height: 2.8em; width: 100%; z-index: 1; } #breadcrumbs { padding-top: 4em; }1 point
-
Hmm. It's not as straightforward as that. I was planning this as a commercial module so there are long term economic considerations to take into account. I am ready to listen to different proposals (and maybe we should start a new topic) about the way forward. What I have been working on is a full-blown calendar with a couple of bells and whistles - reminders, multiple calendars, categories, tasks, contacts, etc...the works...basically, a suite of features that a modern day calendar should have (but without going overboard with features to rival desktop alternatives ). We have a couple of alternatives to consider. Don't change a thing; go ahead as planned Fully funded by community - released for free to the community Fully funded by community - available for sale at a subsidized price Fully funded by community - released for free but with paid support Fully funded by community - initial release free, paid for upgrades Other variants of above, etc...1 point
-
1 point
-
Inexplicable 403 errors in CKEditor's dialogs are 99% of the time caused by apache's mod_security.1 point
-
I sent two pull requests: TemplateEngineTwig: adds setMultiple and latest twig version using composer TemplateEngineFactory: adds setMultiple and renderChunk methods Example: How to use a chunk In template file: /site/templates/view/template.twig <?php foreach ($nav_pages as $p): ?> <?php $page->renderChunk('chunks/nav-item', array('page' => $p)); ?> <?php endforeach; ?> /site/templates/chunks/nav-item.php <?php namespace ProcessWire; $foo = 'do some logic // something with the contextual data'; $author = $this->page->createdUser; $view->setMultiple( array( 'author' => $author, 'item' => $this->page, 'foo' => $foo )); /site/templates/view/chunks/nav-item.tpl Author: <?= $author ?> <br /> <a href="<?= $item->url ?>" title="<?= $foo ?>"> <?= $item->title ?> </a>1 point
-
Your approach will not work. If you want to go on with repeaters you have to use nested repeaters. Other options: Page/ PageTabel Field or ProFields Matrix. More Information about nested repeaters and ProFields Matrix here: https://processwire.com/blog/posts/more-repeaters-repeater-matrix-and-new-field-rendering/ I would do this job with a simple Page or PageTable Field Create some fields (currency, period, percent) Create a template 'rate' and assign the fields above Create some pages (rates) with template 'rate' USD 12m 5% USD 6m 5% EUR 6m 6% Create a Page Field 'rates' and use template 'rate' for selectable pages Assign this Page Field to the 'loan' template.1 point
-
1 point
-
Why not make this a community funded module? I'd be more than happy to contribute to financing it.1 point
-
Just made a v0.4 release and a new support thread over at https://processwire.com/talk/topic/12667-wiremail-mailgun/. I would really appreciate someone testing this on 3.0 and report how it's working, I don't have much time to test this out right now.1 point
-
I think this is good idea. Personally I have a number of module ideas but have no firm idea what to prioritise. Something like this would be of benefit to me. As for a calendar module, I have been working on something for a while now. These are very old screenshots and will change. The module was based on dhtmlxScheduler but that will definitely change. Maybe I should release this module next1 point
-
Hi all! Here is a very small website that we made for this event promoted by two landscape architects. This is a one day event where private gardens in Freiburg are open to the public. There are also some planned workshops and other activities. http://freiburger-gaerten.de/ This is one of the simplest websites we did. A one pager with smooth scrolling based on anchor links. The PW part was very easy, the content of each section is in a children of home, so on the home template we simply have to iterate all the children and render them.1 point
-
Ah, sry wire('all')->toArray() or wire('*')->toArray() will get you the part you want. Might be because of the changes to the wire() function call to allow for multi instance. I've just looked into the 2.7 core files and the keys 'all' and '*' are also present there. I'm not sure for how long these are supposed to be used as replacement for fuel() calls.1 point
-
Replace 'fuel()->getArray()' with 'wire()->getArray()' and it should work. fuel() is already marked as deprecated for a good amount of time.1 point
-
a other option for own admin pages with custom stuff....would be the AdminCustomPages Module https://processwire.com/talk/topic/3474-admin-custom-pages-module/ so you could assign the process AdminCustomPage and choose a "normal" PHP Template....but this not shows up the /settings/ page - this could be used for own output and dashboard like views that could be easy created without the need of a own module in the backend.... For editing /settings/ pages that are not under the /admin/ branch jlahijani's tip should do this.. @jlahijani if you got the time you could send this to the https://processwire-recipes.com/ project...it's a god home for such good hints... regards mr-fan1 point
-
Here's a tip for making your global settings / global options page easily accessible in the admin, without having to create a custom process module or going to the page using the pagetree. Let's say the page name of your settings page is called "settings" and it's directly under home. Now, create a *new* page under the admin page in ProcessWire. Use the "admin" template. Call this page "settings" as well. After saving, it will now give you the option to choose which process module this admin page will utilize. Choose "ProcessPageEdit". Now you will have a link in the main navbar to this Settings page, but when you go to it, it will error saying "Unknown page" + "the process returned no content". What you need to do is make this page load the /settings/ page you originally made. Using the special "/site/ready.php" file (create ready.php if it doesn't exist), you can add the following line of code to it: if($page->template=="admin" && $page->name=="settings") $input->get->id = $pages->get("/settings/")->id; Now go to the Settings page in the navbar. Nice, easy and "official" feeling.1 point
-
Hi! Look for Custom Editor JS Styles Set in the field configuration and enter a path for .js file. In this file you can define your custom styles like this: CKEDITOR.stylesSet.add('mystyles', [ // Block-level styles { name: 'Heading 1', element: 'h1'}, { name: 'Heading 2', element: 'h2'}, { name: 'Heading 3', element: 'h3'}, { name: 'Introduction', element: 'p', attributes: { 'class': 'introduction'} }, // Inline styles { name: 'Link button', element: 'a', attributes: { 'class': 'button' } }, { name: 'Highlight', element: 'span', attributes: { 'class': 'highlight' } }, // Object styles { name: 'Stretch', element: 'img', attributes: { 'class': 'stretch' } }, ]); Also make sure you have Styles toolbar item enabled.1 point
-
Often I use the internal domain names ( in hosts file ) with the extension .local. Sites developing with that extension responds as it should in safari (mac). On Google Chrome however, the respond is very slow. It looks like Google wants to collect as much data posible and before the request is send to apache the data is send to mighty Google. Changing the extension from .local to .loc (in host file ) solves the lagging for me. Hopefully this post is helpful for people experience the same issue.1 point
-
Thanks for posting Soma, this is an interesting approach and not one I've seen before, but it looks great. The underlying concept and result is similar to the approach I usually use. Since you posted a good description, I'll try to do the same for mine. The only reason you see head/foot files in the default PW profile is because it seems to be simpler for new users to grasp. But I almost never use that approach in my own sites. Like your system, I have a main.php file which is my main markup file. But unlike your system, main.php is included from all the other template files (rather than main.php including them). The other template files focus on populating the key content areas of the site, specific to the needs of the template. Examples of key content areas might include "main" (for center column/bodycopy) and "side" (for sidebar/related info), though often includes several other identified areas. But I'll keep it simple in this case. Here's how it works: basic-page.php <?php $outMain = "<h2>{$page->subtitle}</h2>" . $page->body; if($page->numChildren) $outMain .= $page->children->render(); // list the children $outSide = $page->sidebar; include("./main.php"); main.php <html> <head> <title><?php echo $page->title; ?></title> </head> <body> <h1><?php echo $page->title; ?></h1> <div id='main'><?php echo $outMain; ?></div> <div id='side'><?php echo $outSide; ?></div> </body> </html> The benefit of this approach is that basic-page.php can setup whatever it wants in the key content areas ($main or $side) whether simple like in this example, or something much more complex. I actually prefer for the variables representing the key content areas to be optional. In the scenario above, $outMain and $outSide would have to be defined by every template or they would end up as uninitialized variables in main.php. As a result, I actually use $page as an anonymous placeholder for these variables (making sure they don't conflict with any existing field names) and then let main.php assign defaults if the calling template didn't specify one of them. For example: basic-page.php <?php $page->outMain = "<h2>{$page->subtitle}</h2>" . $page->body; if($page->numChildren) $page->outMain .= $page->children->render(); // list the children // note: no $outSide specified include("./main.php"); main.php <?php // setup defaults when none specified if(empty($page->outMain)) $page->outMain = $page->body; if(empty($page->outSide)) $page->outSide = $page->sidebar; ?> <html> <head> <title><?php echo $page->title; ?></title> </head> <body> <h1><?php echo $page->title; ?></h1> <div id='main'><?php echo $page->outMain; ?></div> <div id='side'><?php echo $page->outSide; ?></div> </body> </html> Final thing to point out here is that main.php is the only template actually outputting anything. Because basic-page.php (or any other template) is determining what's going to go in that output before it is actually sent, your template has the opportunity to modify stuff that you might not be able to with other methods. For instance, the <title> tag, what scripts and stylesheets are loaded, etc. Here's the example above carried further to demonstrate it: basic-page.php <?php // make a custom <title> tag $page->browserTitle = $page->rootParent->title . ": " . $page->title; $page->outMain = "<h2>{$page->subtitle}</h2>" . $page->body; if(count($page->images)) { // display a clickable lightbox gallery if this page has images on it $config->scripts->add($config->urls->templates . "scripts/lightbox.js"); $config->styles->add($config->urls->templates . "styles/gallery.css"); $page->outMain .= "<ul id='gallery'>"; foreach($page->images as $i) { $t = $i->size(100,100); $page->outMain .= "<li><a href='{$i->url}'><img src='{$t->url}' alt='{$t->description}' /></a></li>"; } $page->outMain .= "</ul>"; // add a note to $page->title to say how many photos are in the gallery $page->title .= " (with " . count($page->images) . " photos!)"; } if($page->numChildren) $page->outMain .= $page->children->render(); // list the children include("./main.php"); main.php <?php // if current template has it's own custom CSS file, then include it $file = "styles/{$page->template}.css"; if(is_file($config->paths->templates . $file)) $config->styles->add($config->urls->templates . $file); // if current template has it's own custom JS file, then include it $file = "scripts/{$page->template}.js"; if(is_file($config->paths->templates . $file)) $config->scripts->add($config->urls->templates . $file); ?> <html> <head> <title><?php echo $page->get('browserTitle|title'); // use browserTitle if there, otherwise title ?></title> <?php foreach($config->styles as $url) echo "<link rel='stylesheet' type='text/css' href='$url' />"; foreach($config->scripts as $url) echo "<script type='text/javascript' src='$url'></script>"; ?> </head> <body> <h1><?php echo $page->title; ?></h1> <div id='main'><?php echo $page->get('outMain|body'); // use outMain if there, or body otherwise ?></div> <div id='side'><?php echo $page->get('outSide|sidebar'); // use outSide if there, or sidebar otherwise ?></div> </body> </html> More than half the time, I'll actually just re-use page variables like $page->body and $page->sidebar rather than $page->outMain and $page->outSide. That way there's no need to consider defaults, since $page->body and $page->sidebar untouched technically are defaults. <?php $page->body = "<h2>{$page->subtitle}</h2>" . $page->body . $page->children->render(); But technically you've got a little more flexibility using your own self-assign anonymous variables like outMain and outSide, so figured I'd use that in the examples above. outMain and outSide are just example names I came up with for this example and you could of course name them whatever you want.1 point