Leaderboard
Popular Content
Showing content with the highest reputation on 07/18/2017 in Posts
-
PW featured in the article "10+ Free Alternative Open Source CMS Tools to Explore". https://designmodo.com/free-cms/5 points
-
@bernhard, try replacing this part of panel.js with... if(typeof panelURL != 'undefined' && panelURL.length) { var hash = ''; if(panelURL.indexOf('#') > -1) { var url_parts = panelURL.split('#'); panelURL = url_parts[0]; hash = '#' + url_parts[1]; } panelURL += (panelURL.indexOf('?') > -1 ? '&' : '?') + 'modal=panel&pw_panel='; if($toggler !== null && $toggler.hasClass('pw-panel-links')) { panelURL += '2'; // don't update target of links in panel } else { panelURL += '1'; // update target of links in panel } panelURL += hash; } Let me know if it works for you and if so I'll suggest it on the PW GitHub.4 points
-
I have yet another script found maybe it helps someone.... Is this : http://ricostacruz.com/nprogress/3 points
-
@webaff, just to spell out what @bernhard is suggesting... For each language-alternate field you have, you can add a datetime or text field to the template to store the modified date. Here is an example hook for a single language: $pages->addHookAfter('saveReady', function(HookEvent $event) { $page = $event->arguments(0); if($page->template->name !== 'basic-page') return; // match whatever template you need // Output formatting is off in saveReady so File fields are WireArrays regardless of field settings if(count($page->file_german)) { // Use the modified timestamp of the German file field if a file exists $page->modified_german = $page->file_german->first->modified; } elseif(count($page->file)) { // Otherwise use the default file field if a file exists $page->modified_german = $page->file->first->modified; } }); Then you sort by "modified_german" in your selector.3 points
-
The difference it that changing the field visibility is handled fully client side in javascript, whereas when it comes to saving the show_if/required_if selectors are validated on the server in php. So naturally having two implementations of the same might result in slightly different behaviour. With users and the roles field being quite restricted entities in processwire it's at least a bit understandable, that things might not work in all constellations.2 points
-
Hi @Dennis Spohr, most things can be done with hooks. Hooks are class methods that have 3 preceding underscores, so you may find them in the php and module files in the wire folder. (Using a "search-in-files" function of your Editor / IDE: "function ___"). Or go to Captain-Hook. Unfortunately or Fortunately, the part with sending emails on exceptions / errors seems to be completly different. It uses the native PHP register_shutdown_function, done in WireShutdown.php and therefore is not hookable through the PW system. But the PHP docs say that it is possible to register more than one shutdown-function, and that all functions get called on shutdown. So you can register your own one. If you want to have the ability to optionally bypass processwires shutdown function, you must register yours before PWs one. (I don't know how, but would try it in site/config.php first). Than, in cases where you don't want PWs function get called, you can exit yours with exit();. Otherwise other registered functions get called and executed too. Have a read in the WireShutdown::shutdown() function. There you see how to check if there were an error, how to get it and how to inspect it, etc. ----- Also there is the site/finished.php file, that gets executed at the end. But this one I haven't used til now and don't know if it get called on exceptions too. ----- If you test and further questions apear, come back and ask.2 points
-
I don't think there is any bug to report here - a $pages->find() selector must ultimately become an SQL query and the selector sort options become an ORDER BY clause. You cannot do something in an SQL query like "sort by some column but if that column is empty for a row then use some other column instead". But I guess you could make a request in processwire-requests in case Ryan can come up with some wizardry to allow OR sorting.2 points
-
A link like /page/edit/?id=123#ProcessPageEditDelete works as expected when used as a "normal" link, so I think this issue is about the limitations of pw-panel rather than the link itself.2 points
-
i don't know of any ready solution, but as soon as you have your data in some nicely structured way on the joomla-side it should be very easy to do on the pw side: for csv there are some modules available. maybe you can use an RSS module on the joomla side. or maybe just scrape the information from the HTML, for example i used http://simplehtmldom.sourceforge.net/ some times good luck and enjoy the move from joomla to processwire1 point
-
Not sure why it half-works with role names, but the Roles field is a Page field and the correct way to match a Page field in an inputfield dependency is by ID. https://processwire.com/api/selectors/inputfield-dependencies/#example-page1 point
-
@bernhard and @Robin S, it's all working. Thank you so much! Robin S, further up berhard proposes to file an issue at github. Do you agree?1 point
-
You can use the %=, ^= or $= operators to match the basename in a Files or Images field. $matches = $pages->find("file_upload%=$q"); You can use any of the operators on the description subfield. $matches = $pages->find("file_upload.description~=$q");1 point
-
I ended up getting this working, but instead of doing the assets folder I did the whole sites folder. That way I could install a module and it go to all http servers. I also added my ec2-user to the webapp group so I could sftp into the share and edit files.1 point
-
The %X format doesn't work very well for some locales in a combination with %p format but there is a far better and easier way to get the correct time format without the seconds on each locale. With the following method you can control all of the time outputs from all your datetime fields from just 1 field under each language! Create a text field and name it: time_format. Add the time_format field on the system's language template (Setup > Templates > Filters > Show system templates). Go to each of your languages under Setup > Languages and add their strftime format on the time_format field. For example if the language locale is en_US.utf8 then the time format should be %l:%M %P if the locale is fi_FI.utf8 the time format should be %H.%M and so on. Add the following code to your _init.php: $time_format = $user->language->time_format; and add this code on your templates you want to output the time from your datetime field: <?= strftime($time_format, $page->getUnformatted("your_datetime_field")) ?> DONE1 point
-
Thank you so much. To be honest, this is more programming and technical than I want to learn right now, but I will keep this information for when I have more time to sit down and get started with pw. Thank you for all the help tho!1 point
-
+1 Displaying a changelog before upgrading a module or even the core is badly needed. Also the changelog should be visible everytime on a module detail page.1 point
-
This is a tricky one, and the solution on the CMS side depends on how you want to do the frontend. You will not find a module that gets interactive 3d working on your frontend. PW modules mostly offer you ways of storing and retrieving info, but don't actually generate frontend widgets like slideshows and that kind of thing. First of all, the repeater is a go to module that you'll probably need somewhere along the road. Then just remember you can use file fields for storing 3d models or even JS that you load dynamically on the frontend, image fields for textures, and you have other field types for just about anything you can think of. For example, look at the nib selector on step 3 of your example. You can use a repeater to store each nib. Inside each repeater item you put in a title, an image file for the thumbnail, and a file field for the 3d model in whatever format you're going to use. Then you just have to figure out how to output that in your frontend so that the nib options can be managed from the CMS. Start by getting your frontend working statically. From there you'll see how to divide it into smaller chunks that can be served by PW and take it from there.1 point
-
1 point
-
If I understand your setup correctly you could do one field for each language then? Modified de ... Timestamp Modified en ... Timestamp You could populate all fields on save and then just sort on the appropriate field ('..., sort=modified_' . $lang)1 point
-
There could be a lot of people using the module version for image tags; I will revise the module code to check the core version or the is_dir and then load from core – it does seem that your tweaks are going to be essential for this, as that behavior of it submitting is definitely a problem, that i hadn't noticed (i always assumed that users would click and select, but now i see that they can type stuff in and try and hit enter..) Another issue is that there is the other module that uses selectize, namely the InputFieldSelectize (and the multiple version) which are page reference fields, and those also load the selectize library. I'm pretty sure there are at least a handful of people actively using that fieldtype, so maybe I will also need to use your modified version of the seletize library in the JquerySelectize base module, so that the selectize family of modules will all behave the same way, whether the library is loaded from the core or from the module, and in situations where someone is using InputfieldSelectize, but not image tags. if the core version of the library could include the skins, and in addition, your modified skin, then the module version could allow skin to be chosen (if it is installed), but if not installed, then the core version uses the default skin. In the module config for the JquerySelectize, besides offering the option of changing the skin (existing and new PW admin theme neutral version), that could be a place to specify which selectize library to load (core or module), to allow users with an existing setup to gracefully test and transition to the core version. Once they have tested their setup using the core version as specified in the module's config, they could choose to keep the module installed (for the extended skin options) or uninstall it and use the default skin.1 point
-
Thank you for the details! Very interesting! I thought about doing an rsync script approach like that for my setup, and having a master of sorts that sends files to the other instances, but I was thinking as you add ec2 instances, they could be a part of the load balanced pool before they have all of the files locally which could cause missing images on pages. It could be 15-30 minutes before the transfer starts, and that could take a bit if you have a lot of files, and if your master goes down, you can't admin without selecting a new master. I was thinking of going another route and using the Elastic File System service and having all of the EC2 instances mount it on boot and use it to store the assets folder. Sessions can be served out of RDS. That way any ec2 can be a master and can upload files to the network share and they are ready as soon as they boot.1 point
-
We aren't using a load balancer for this processwire.com server (just a single Amazon instance). But for the sites where we are (and running PW), there is a shell script that syncs /site/assets/ and /site/templates/, across the instances. I don't know exactly how it works, but can find out more. I know it runs every 30 minutes (cron job) and whenever a change is detected. Note that it also specifically excludes /site/assets/cache/ and /site/assets/sessions/, as those vary between the instances. Also important, is that when it comes to using the PW admin, we setup a separate hostname for that purpose (admin.domain.com) that always hits the same instance (which we call the "A" instance). This is the instance that the shell script considers the master when it comes to syncing files. That way, any changes that occur to the synced files always originate on the A instance. There is a setting in AWS that lets you lock a hostname to a specific load balanced EC2 instance. Then we keep any editing locked to that hostname by adding this to /site/templates/admin.php: if($config->httpHost != 'admin.domain.com') { $session->redirect('https://admin.domain.com/processwire/'); } And we keep non-authenticated requests out of the admin hostname by having this in the /site/templates/_init.php file ($config->prependTemplatefile setting): if($config->httpHost == 'admin.domain.com' && !$user->isLoggedin()) { $session->redirect('https://www.domain.com' . $page->url); } This ensures search engines don't get in and start indexing another copy of the site on the admin hostname.1 point
-
I'm not sure this will help, but try the following: $pages->find("template=file, sort=-fileField.modified") Especially if you plan on adding pagination to the whole thing sorting at runtime will bite you in the ass.1 point
-
You can make content blocks with Page Table or Page Table Extended, to display on any page. Create a Page Table field. Create templates for each of your content blocks, assigning the necessary fields (PHP files not necessary for these). Configure your Page Table field to use those content block templates. Assign Page Table field to your front-end template (template.php). In template.php, iterate over the Page Table field, and use PHP switch() to display different HTML and field data based on the content block name. If you want to get fancy, configure Page Table Extended to display rendered HTML on the admin side (Display Output Options).1 point
-
Adrian, let me first say "thank you so much" for this great module - it's incredibly helpful. I think I have found a small bug. When one or more quotes are used in the title of the page, the "edit" section breaks, see attached screenshot. I have now seen this across different installations, so I think it hasn't to do with my setup. Batch Child Editor is latest version 1.6.7, ProcessWire is 3.0.651 point
-
The demo site uses Lister Pro (it's debatable whether pro modules should be used in the demo site but that's another discussion) but you can achieve something similar by using a bookmark for the basic core Lister. Visit the "Find" lister and set up the filters and columns how you like to show the skyscrapers or whatever your pages are about. Then save that configuration as a bookmark on the Bookmarks tab. The bookmark appears as a child menu item of the Find section, but as @tpr suggests you can include a link to the bookmark in the main Pages menu using the NavItems feature in AdminOnSteroids.1 point
-
Thanks a lot I found a solution to find insatalled LC files with following code: print_r(ResourceBundle::getLocales('')); it lists all installed LC files names. Then i found "tr_TR" and additionaly try to add ".utf" and it works1 point
-
here you go: it's very simple, yet extremely comfortable for clients. you just need one simple javascript function: function editLink($pageid) { if(wire('pages')->get($pageid)->editable()) { // add page if action == add // check permission first! ob_start(); $editid = "editlink_" . uniqid(); ?> <div style="position: relative;" class="editlink" id="<?= $editid ?>"> <div style="position: absolute; right: 0; top: 0; z-index: 100;" class="uk-text-right"> <a href="/admin/page/edit/?id=<?= $pageid ?>&modal=0" target="_blank" class="uk-button uk-button-primary editmodal" style="color: white;"> <i class="uk-icon-edit"></i> edit </a> <?php // next floating button here ?> </div> </div> <script type="text/javascript"> $(document).ready(function() { $("#<?= $editid ?>").parent().addClass("editlinkparent"); // paddings must be adjusted when window is resized $(window).on("load resize", function () { // remove top and right margin var paddingright = $("#<?= $editid ?>").parent().css("padding-right"); var paddingtop = $("#<?= $editid ?>").parent().css("padding-top"); //$("#<?= $editid ?>:first-child").css("border", "1px solid blue"); $("#<?= $editid ?>:first-child").css("right", "-" + paddingright); $("#<?= $editid ?>:first-child").css("top", "-" + paddingtop); }); // colorbox /*$(".editmodal").colorbox({ iframe:true, width:"90%", height:"90%", onClosed: function() { location.reload(); }, });*/ }); </script> <?php return ob_get_clean(); } else return false; } and little CSS: // edit link .editlink {display: none;} .editlinkparent:hover {outline: 3px solid #ddd;} .editlinkparent:hover > .editlink {display: block;} note that i'm using markup for UIKIT css framework. what it does: let's say you have a blog-template showing all the children as postings. all you need to do when you want them to be editable on mousehover would be this: <?= editlink($page->id); ?> <section class="uk-grid uk-margin-left uk-margin-right uk-margin-large-top"> <div class="uk-width-large-3-4"> [...] <?php foreach($posts as $post): ?> <div class="uk-grid"> [...] <div class="uk-width-medium-3-4"> <?= editlink($post->id); ?> <h4><a href="<?= $post->url ?>"><?= $post->get('headline|title') ?></a></h4> [...] </div> </div> <hr> <?php endforeach; ?> the result is something like that: note that it needs only 2 lines of code! you can easily add this to any existing website in minutes... in FREDI you have to define your editable fields. that can be an advantage, but i prefer to only rely on the ID of the page (or the posting or the widget...) and have the user redirected to the right page in the backend. as you can see in the commented section of the function i also had this working with a colorbox and using modal=1, but it's more foolproof having it open in a new tab. using only the ID has the advantage, that if something changes with my field settings i don't have to change anything on frontend. how does it work? it injects some jquery javascript inline (it's only for logged in users so that won't affect your "public" markup of the page!) add HTML for the edit-button with edit-link add javascriptadd "editlinkparent" to parent DOM element this makes it possible to show the border around the affected content on mouse hover remove spacing so that the edit-button is on the very topright position of the highlighted div that's all again: i would love to pack that into a module so that it gets reuseable across other CSS frameworks with different markup and you don't have to care about adding the function and the css, but i don't know when i can find time for that. if anyone wants to try - all the info is above and i'm always willing to help1 point
-
Very, very nice! And thanks for talking through your approach to some interesting points1 point
-
When I need a calculated field that will be used for sorting, I like to add a hidden (or regular, doesn't matter) field to the template to store the calculated value. The value gets automatically calculated on page save. A hook like this in your /site/templates/admin.php can do the work for you: $pages->addHook('saveReady', function($event) { $pages = $event->object; $page = $event->arguments(0); if($page->template == 'rider') { $miles = 0; foreach($page->rides as $ride) { $miles += $ride->miles; } $page->miles_ridden = $miles; } }); Then when it comes to sorting, you just sort on your calculated field: miles_ridden. If you are adding this to an existing PW installation, then you'd need to establish the initial values for each rider's miles_ridden. This could be done with a quick bootstrapped script: /setup-riders.php <pre><?php include("./index.php"); foreach(wire("pages")->find("template=rider") as $rider) { $rider->save(); echo "$rider->name: $rider->miles_ridden miles ridden\n"; } Then you'd just load domain.com/setup-riders.php in your web browser, and then delete the file when done.1 point