Leaderboard
Popular Content
Showing content with the highest reputation on 04/21/2017 in all areas
-
Hello, I know there are a lot of installing processwire tutorials out there, but here I put mine (with images and other little things) https://dev.to/clsource/installing-processwire hope you like it8 points
-
This week we've merged the dev branch to the master branch for ProcessWire version 3.0.61 master. This replaces the existing master version 3.0.42. What's the difference between 3.0.42 and 3.0.61? Quite a lot! In fact, we might usually call this a major version and just name it ProcessWire 3.1, but we're saving that version number for when we get at least the new Regular site profile included (and perhaps the new admin theme), after Uikit 3.0 is out of beta. In this post, we'll cover some of what's new with ProcessWire 3.0.61 relative to the previous master version… https://processwire.com/blog/posts/processwire-3.0.61-master/8 points
-
I feel really sorry. I have had some problems in recent months that have caused my brain to stop working .. And so I hesitated to launch the module knowing I could not give support. Anyway, I'm better and I resume the development as soon as I have my internet connection operational (should be good for monday). Sorry again guys!5 points
-
This is a story of desire, stilted romance, triumph, and discovery of a simpler way. TL;DR: ProcessWire has hidden goodies in it, but it makes me wonder what else I'm missing. The other day I was thinking, "Hey, I make a lot of navigation. Lists of links, glossary-style HTML sitemaps with links and descriptions, nested menus, etc. I wonder if I could automate some of the markup and stuff by making a custom function?" So normally, I might build a navigation menu in ProcessWire like this: $menu = $pages->get('/')->children; $out = "<ul class='my-menu-class'>"; foreach($menu as $item) { $out .= "<li class='my-item-class'><a class='my-link-class' href='{$item->url}'>{$item->title}</a></li>"; } $out .= "</ul>"; Within this, there are only a handful of things I might want to handle differently for different menus: The classes, the HTML elements, the pages included, the sort, and the limit, for a few. After some amateur writing and testing, I came up with a new object class that would take some config and return a menu in HTML: $out = ''; require_once('./ClassMenu.php'); $menu_settings = array( 'pages' => $pages->get('/')->children, 'label_class' => 'my-label-class', 'label_tag' => 'dt', 'desc_class' => 'my-description-class', 'desc_tag' => 'dd', 'desc_field' => 'description', 'wrap_class' => 'my-list-class', 'wrap_tag' => 'dl' ); $menuzilla = new Menu($menu_settings); $out .= $menuzilla->render(); The above menu would return something like this: <dl class='my-list-class'> <dt class='my-label-class'><a href='/about/'>About</a></dt> <dd class='my-description-class'>About page description…</dd> <dt class='my-label-class'><a href='/products/'>Products</a></dt> <dd class='my-description-class'>Product page description…</dd> <dt class='my-label-class'><a href='/misc/'>Miscellanium</a></dt> <dd class='my-description-class'>Miscellanium page description…</dd> <!-- etc. --> </dl> It worked great, and it was pretty flexible. As I considered adding more complex functionality, I remembered Soma's tutorial about building forms with ProcessWire, and I wondered if I could learn something about building markup from ProcessWire's render method. That's when I found MarkupPageArray. MarkupPageArray, for those who don't know, adds a render method to page arrays, giving them the ability to generate HTML without further ado, like so: $out = ''; $menu = $pages->get('/')->children; $out .= $menu->render(); But what if you don't like ProcessWire's default markup or classes? You can override that simply: $out = ''; $menu = $pages->get('/')->children; $out .= $menu->render(array( 'listMarkup' => "<dl class='my-list-class'>{out}</dl>", 'itemMarkup' => "<dt class='my-label-class'><a href='{url}'>{title}</a></dt><dd class='my-description-class'>{description}</dd>" )); This renders the same HTML I posted above, using only ProcessWire's own API and no custom functions. It brings a tear to the eye. So my question is this: What other common site components are hidden in the API waiting to be uncovered by the hapless and meek in their thrashing about for wisdom?4 points
-
Why are the modules not listed on the public reference page? for example the MarkupPagerNav is listed (under Additional) but the MarkupPageArray, and many more of the core modules are not (although they can be browsed in the Pro module). Also I agree with @adrian - the ability to see where the file is located and quickly open it would be helpful for learning (see @adrian implementation in the Tracy debugger module). If the API explorer could be used to document our own templates, CSS, SAAS, JS etc. files, this "edit / open file" feature would be useful when collaborating with other developers and might also be a good way for new users to learn about PW from site profiles.3 points
-
Nothing to be sorry about @flydev. Thanks for your work. Really hope it will work out in your personal matters.3 points
-
Guys, if you have a lot of time to spare, you can kill some by checking out this list: https://github.com/neiesc/ListOfMinimalistFrameworks3 points
-
I really think that using frameworks for medium to complex projects can help a lot, reducing significantly the time required when dealing with browser issues. I can't see a REALLY good reason, from a technical and a business point-of-view, not to use one as nowadays as almost all of them have generally good documentation, are battle-tested in all major browser versions. I really don't want to remember you how it was like in the days of testing a site over and over again in Netscape and IE. When I'm planning a project I decide which framework to choose based on these questions: 1. Will the project have many different pages layouts? 2. The client's brand require a custom design? Meaning, will the developer spend a lot of time creating a layout that's specific for the project, or the project can have a more default layout (based on the framework's default styles/components) 3. How much time/budget do I have to work on the project? 4. In the future, will be other people maintaining the project of just me? And if so, are we going to be thankful as I used a framework with good docs or should I expect a desire to break my (own) knees with a baseball bat? The choices can be, for instance: Zurb Foundation – for projects that require a lot of different pages down the road and a lot of customization. And I always use the Foundation Stack to have maximum control of the settings. Foundation is, like they said, the most advanced framework out there. Twitter Bootstrap – If I'm creating something with Laravel and it's an internal project, tool, or just a prototype, as the Laravel community have a lot of things already done using Bootstrap that can help. UIKIT – If the project can benefit from its more opinionated designed elements, meaning: can I stick with the defaults and do just a little customization and call it a day? --- Unless your project really needs to have the smaller CSS/JS footprint possible, like if you are targeting some users with crappy 2G connections and/or old browsers, you can go with a framework like the above. I used a lot of Foundation's CSS components on ricardo-vargas.com and the CSS is less than 30kb gzipped. --- For personal projects, I usually search around and give smaller frameworks like Tachyons, Kube, Bulma a try as it's fun!3 points
-
It is very difficult to choose a framework, that's why I never use one . I just use SASS with normalize.css, bourbon bitter and a grid system I've built. This requires more work at first, but you avoid the bloat.3 points
-
Thank you for this quite useful "changelog"! It should be turned into a "custom"2 points
-
Okey, I see. From sanitizer docs: * Modules may also add methods to the Sanitizer as needed i.e. $this->sanitizer->addHook('myMethod', $myClass, 'myMethod'); So you can add custom sanitizer method and then hook __construct method of InputfieldName and set your custom method for some pages https://github.com/processwire/processwire/blob/master/wire/modules/Inputfield/InputfieldName.module#L192 points
-
@Mackski: please refer to the RFCs for email! https://tools.ietf.org/html/rfc2822#section-2.22 points
-
1 point
-
I think something along the lines "All the files related to the site are organized in this directory." might be better, since the "files that will contain the site logic" actually are in the templates directory and there are other directories in /site also. Haven't read it all but looks very thorough. Good job. Edit: Appreciate it, but there was nothing worth of a special thanks.1 point
-
@Zeka Will try your suggestion later on today and share if that works fine. Because I was thinking of another way to organize what is needed, but I don't want to flood the topic. Basically instead of finding matching pages I thought to add a field with PageSelect and pick up manually recipes that would have similarities. Doing so is not an automated process but in my case would allow to be used for drinks matching the recipe or other recipes that you would prefer to suggest (versus the automated). It is always good to have options so I appreciate your suggestion. Now I have an option to provide similar pages by tags, by "category" and manually select so it could even be set in the admin as a drop down box to choose which way to go1 point
-
Are you sure about namespaces? Do you declare them in _header.inc.php?1 point
-
I guess it would be pretty easy to hook the PW logs and post them to another server (local or over the internet). So another thing on the to-do list1 point
-
@Karl_T It's great of what you have done. I can feel your excitement about using Redis. Haven't had the chance to dig deeper into your code but of what I saw, you are not using session lock. Forgive me if I am wrong. I was using phpredis (the php extension) as a global session handler replacement in php.ini , but it lacks support for session lock. I was having trouble because of this and I wrote my own solution attached here. I just prepend it. When using session with files - the files system have lock on write. When using SessionDB - the database has a row or table lock depending on the table engine. Memcache have lock implemented and it's suitable for replacement in php.ini. Of what I saw in the phpredis code, there is no lock and have to be implemented externally. My issue because of this here. This guy here explained more about the session lock and session fixation. Here is the related issue/feature request at GitHub/phpredis. Magento's dev opinion here . Also many recommend igbinary as a php serializer of the session data before to be stored in Redis. Of course, it is not installed by default on a shared hosting. Just as a reminder, there were many ways to decrease the memory usage. Some prefer using "strings" instead of "hashes" as a datatype if not using millions of sessions and shortened keys for memory optimization. Also, just saw a cron job deleting the expired keys. Redis have native key removal for the expired keys and there is no reason for garbage collector or a cron job to delete the old keys. Sorry if I am wrong about your code. I am keen to test it in the morning. Hope this helps. Peace! session_handler_redis.php test_serializers.php1 point
-
Just wanted to say thanks for creating the Valet driver - it works well with the latest master and dev branches of PW. It is noticeably faster than MAMP, not to mention much easier to setup - just create a new folder and off you go. Also the ease of setting up SSL for local testing is very unique. I've not used it extensively but this feels like the best local development setup I have tried so far (for performance and ease of setup). Interested to hear if anyone has had any issues using Valet for PW development. I am also very impressed by homebrew - it has come a long way since my earlier tests and seems to be very solid since turning 1.0 with lots of additional help to make sure you don't mess anything up.1 point
-
@bmacnaughton Not sure, but maybe you are looking for allowDoubledReplacement (bool): Whether to allow two of the same replacement chars [-_] next to each other (default=false). See options argument https://processwire.com/api/ref/sanitizer/name/1 point
-
Sorry if this is overly simplistic, but if that is truly all you seek to do, could you just $url = str_replace("-", "--", $sanitizer->pageName($name, true));1 point
-
Very strange indeed, but I don't think they install bower for you. Are you sure you haven't installed it before for other projects? Anyways, don't lose your head over it. The differences between what can be installed are these: npm install foundation-sites This command will install only the CSS framework, you'll need to compile the Sass yourself. As their documentation says, you can use Bower OR npm. But, to install all the requirements to compile the Sass files (using node-sass), you should use their cli like below. This is useful if you do not have gulp setup yet for your project assets. npm install --global foundation-cli And, the final option, using Zurb template, which I recommend only if you are starting a new project and want to use their Panini library to build the pages statically and have an HTML prototype very quickly to show to a client and after their approval integrate with PHP. foundation new --framework sites --template zurb Be aware that it will install a lot of stuff!1 point
-
@FrancisChung, it sounds like a good idea, but I think I saw something like that before but couldn't find it. Although I've found a quiz on how to choose a JS framework, many questions can be adapted to create a new quiz using https://www.qzzr.com as well. Take a look: https://code.tutsplus.com/articles/quiz-choose-the-right-front-end-javascript-framework-for-your-project--cms-27739 And, maybe you haven't seen these two comparisons: https://www.vermilion.com/responsive-comparison/ http://usablica.github.io/front-end-frameworks/compare.html They can help a lot.1 point
-
1 point
-
@MilenKo $recipesCategoriesSelector = $page->recipe_categories->implode("|"); $related = $pages->find("template=recipe, recipe_categories={$recipesCategoriesSelector}, sort=random, limit=4);1 point
-
@Sérgio, you post made me think that it would be really great if there was a website where you answered some (or many?) multiple questions about your project and it would recommend a combo of frameworks based on your answers, as well as some alternatives. Of course, it may not be the best combination in all scenarios but it would save you a ton of time researching or thinking about it. And of course, Processwire would always be the recommended CMS of choice hehe.1 point
-
Take care of yourself. Hopping everything gets better for you soon.1 point
-
I'm using AdminRestrictBranch module on a similar site. There is only one code base and I use the URL to check which site to load. In the admin site owners can only see/manage their own pages. Some owners have custom domain and they all point to the same directory on the server.1 point
-
These are such micro performance improvements, that I doubt these causing the cpu spikes.1 point
-
1 point
-
u want.to set for.use serveors timezine no client not big prolem if.u set wrong1 point
-
Tinifying images is ONLY useful on the final variations. Tinifying an original source image is completly WRONG. This tinifying is often misunderstood. You can resize an image on upload to variuos varirations and also tinify them, if you exactly know which variations you will need around in your site. Here is an example how to hook into upload and process something with the image:1 point
-
1 point
-
My favourite books are "Thinking, Fast and Slow" and "Rework". I would strongly recomend them for those people who care about their business and team building. Luckily, they are not ones of those who try to proclaim their business in a hidden oe even open way; they are more practical.1 point
-
Here's how you might dynamically create it with ProcessWire without tinkering with .htaccess files. Create a new template, call it robots, and set its URLs > Should page URLs end with a slash setting to no, and Files > Content-Type to text/plain. You should tick disable Append file and Prepend file options as well. Optionally set its Family > May this page have children to no, and Family > Can this template be used for new pages to one. Family > Optionally Set allowed templates for parents to home only. Create a new page under homepage, set its template to robots, and name as robots.txt. Create a new template file at /site/templates/robots.php, inside it you type <?php namespace Processwire; // render different robots.txt depending on your own conditions. if ($config->debug) { // use PHP_EOL to create multiline strings echo <<<PHP_EOL User-agent: * Disallow: / PHP_EOL; } else { echo <<<PHP_EOL User-agent: * Disallow: PHP_EOL; } and done. You should be able to see robots.txt at the url /robots.txt.1 point
-
@ryan - another thought - could the API reference docs on the website link to the appropriate lines in the code on Github? Obviously the link would have to be to the exact commit that was used to generate the docs, but I don't expect that should be hard to implement. Also, even though I don't have the API Explorer module, I would still like to suggest implementing an editor protocol handler link so that users could click to open to the appropriate link in the code in their favorite code editor. I do this with the Captain Hook panel in Tracy and find it fantastic.1 point
-
I know this is an old post, but I just came across it while having the same problem. In the end, I have gone for a quick jquery solution. My field is within two divs, articlecontent and box, so I have made it very specific. $('.articlecontent .box p > img').unwrap(); This also takes into account images with captions - it doesn't effect those since they are not in a p tag in the first place. And that is that.1 point
-
When Migrator and MigratorWordpress were written, there was no system "published" field in Processwire. There is now, so I just pushed updates to both modules to support writing to that system field. Unfortunately untested at the moment (no time today), but hopefully will work as expected. With that in place, you should be able to delete that "date" field if you wish and use the "published" field to get the same information. Cheers, Adrian1 point
-
This should be seriously considered, even better: in a configurable way. Best thing would be to support user level configuration, meaning the user could overwrite the default (defined by the site's developer) on its Profile page, similarly to current Default/Reno option, but in this case the base of the layout could be configurable. We even have mockups of this!1 point
-
Thank you Philip. I'm new to PW but longer term users may not see that it is not an intuitive system in some areas. To see nice clear language tabs in the content and a nice clear Language area with name and title, to then have no idea how that relates to front end pages was a little frustrating. Above post sent me to Page -> Home -> Settings and all was clear. Not sure how long I would have been searching for that without this post. Better would be the more standard global URL approach here, for exmaple in Language settings, have a setting for name, title and url suffix which is for all pages, with page settings overriding this if entered? At least that would have been the intuitive route for me1 point
-
Are you running PW 3? In that case, make sure you use the FieldtypePDF module downloaded from the devns branch at github, not the one in the modules repo.1 point
-
Sadly, I wasn't able to do all the mock-ups this weekend as I was away. However I've managed to make a start on the edit page. @LostKobrakai - Thank you for your feedback, I let the sidebar in for this exact reason. I also have some ideas on how to fill out that space when only the Page link is available (due to permissions - editorial role). My idea is to have maybe the recently edited appear as like widgets in the sidebar - or something along those lines. I really need to think about it. This will be just be a theme I'll be building mostly to gain experience on the system but also to use in my personal projects. I will be releasing it for others to download. Anyway, here is the edit page (http://i.imgur.com/kp96yng.jpg):1 point
-
Since there are a lot of topics about the same theme, I decided to write a small module which overwrites the core function ___SetupPageName(). The module allows now to populate the page name using proprietary date() function. Works like PHP date() with follwing exceptions: Everything between the brackets is detected as format string, meaning no 2nd parameter possible. No need to use quotes around the format string. Spaces not allowed. from any page property, page field including subfields, parent property, parent field etc. Meaning everything what you get with $page->get(); including dot syntax. The function will give error and warnings in case of unproper settings, but creates the page with name 'untitled' anyway. Download here: http://modules.processwire.com/modules/process-setup-page-name/ Some Examples The following settings in parent template 'Name Format Children' will assign name immediately. date(Y) date('Y-m-d') parent.title parent.parent.title parent.id template.id assign name after page saving and/or population of depending field. Overwrites 'untitled' after all fields which are defined in parent template are populated. id (any other page property) pagefieldname, multiple pagefieldnames show a warning. pagefieldname (value not populated)show an error. date() // empty, no format assigned date(Y // missing closing bracket date(Y md) // unallowed space notexistingfieldname notexistingproperty existingfield.notexistingsubfield The function in the module ___SetupPageName() could be completely copied as is to the core class $pages. @Ryan Would be nice to see this in core. Related topics: https://processwire.com/talk/topic/8576-name-format-children/ https://processwire.com/talk/topic/8217-name-format-for-children-based-on-any-field-not-just-title/ https://processwire.com/talk/topic/11628-custom-page-name/ https://processwire.com/talk/topic/11349-page-add-step-not-being-skipped-when-name-format-for-children-is-set/ https://processwire.com/talk/topic/10701-automatic-page-name-using-processpageaddexecute-and-pagetable/ https://processwire.com/talk/topic/10208-pagetable-automatic-page-name-format-when-multiple-templates-allowed/ https://processwire.com/talk/topic/9979-name-format-for-children-for-multiple-allowed-templates-for-children/ https://processwire.com/api/modules/process-template/ Any recommandations after testing welcome. Download here: Download here: http://modules.processwire.com/modules/process-setup-page-name/ Edit: small enhancement to prevent display of warning twice. 23.12.15 multiple values possible now 24.12.15 made compatible with PW 3.x 27.12.15 Update Version 1.0.8 09.01.16 Update Version 1.1.01 point
-
You want to display pdf files as pages in frontend? Go here: Create a template file 'showpdf.php' <?php $file = $page->pdf->filename; header('Content-Type: application/pdf'); header('Content-Disposition: inline; filename="' . basename($file).'"'); header('Content-Length: ' . filesize($file)); readfile($file); Create field 'pdf' of type file and add it to your template. Create a page using the template 'showpdf.php' Add pdf to page field 'pdf'. Done. To get save option instead of display use 'attachment' instead of 'inline' like header('Content-Disposition: attachment; filename="' . basename($file).'"');1 point
-
Hi Michael, I have not seen any fields like that, but as an alternative you could try using a "page" type field. It would create a new page for each tag, but has a nice friendly interface for the user to manage them. 1. Add a new page in your tree called "Tags Collection", and make it hidden. 2. Create a new field called Tags and make it a "page" type. 3. On the input field settings, make the "Parent of selectable page(s)" the Tags Collection page 4. For the "Input field type" try one of : Select Multiple, asmSelect or PageListSelectMultiple (I prefer the asmSelect) 5. Check the “Allow new pages to be created from field?” to allow the user to easily add new tags directly from the field1 point
-
Thomas, I just today implemented something similar and remembered the logic from your post. Simple and great solution. I made few modifications - most notably I save the related pages into page field also. I also run this code only once per page, since this is part of the import script. Here is how I modified your code: foreach($page->tags as $tag) { $related_pages = $pages->find("template=article, tags=$tag"); foreach($related_pages as $related) { if($related->id != $page->id) $related_id[$related->id]++; } } arsort($related_id); // We limit it to three related pages at max $related_id = array_slice($related_id, 0, 3, true); foreach($related_id as $key => $val){ $rp = $pages->get($key); $page->related_articles->add($rp); }1 point
-
Are you sure that you need template caching? Template caching doesn't have to be used, it's just an optimization for situations where it makes sense, and this may not be one of them. But what Antti mentioned with using some JS for your dynamic parts can be a good way to go because even if the entire page is cached, the JS portion still executes when the page is viewed and can always be dynamic. Another option is that you could make a simple module that hooks Page::render and replaces your empty <div id='member_bar'></div> and <div id='comments'></div> with dynamically populated versions. This will work even if your template output is cached. Here's an example of such a module: <?php class PetesModule extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Module for Pete', 'summary' => 'Replace member_bar and comments divs with dynamic populated versions', 'version' => 100, 'autoload' => true, 'singular' => true, ); } public function init() { $this->addHookAfter('Page::render', $this, "pageRender"); } public function pageRender($event) { $page = $event->object; // abort for templates you know you won't be needing if(!in_array($page->template->name, array('template1', 'template2'))) return; $out = $event->return; $bar = "<div id='member_bar'> ...dynamic content... </div>"; $out = str_replace("<div id='member_bar'></div>", $bar, $out); $comments = "<div id='comments'> ...comments here... </div>"; $out = str_replace("<div id='comments'></div>", $comments, $out); $event->return = $out; } }1 point