Leaderboard
Popular Content
Showing content with the highest reputation on 02/02/2014 in all areas
-
Follow up, (scripts) For this website I needed a way to insert JS & CSS files on demand. All blocks are controlled by the editors of the website. And I don't want to serve all scripts to the client. I 'needed' a way serve one file back to the browser but only containing the scripts it needed. Most blocks are essentially pages that get rendered. So from within that block I wanted to use $config->scripts->add('my-script-here.js') to register the scripts. That Filename array is picked up by the minify script. Each file gets minified and stored with MarkupCache if not exist, or if the modified date of the original file is higher than the cached version a new markup cache file is created. This allows me to edit and save the Javascripts while the minify template serve to updated file back. ( this feels the same as using a preprocessor ). Proper headers should be send to the client so that the client don't need to re-download the minified version over an over again. This handling & the concatenate is handled all in the template file. This all felt very good, so thats why I wanted to share this with the community. I started writing this module at that crazy last day voting for ProcessWire at Bitnami for the community. For those who are interested, I wrapped the whole thing in a module, template and class. The technic used is in production at pluimveeweb, but the module here is not. If you want to use it, you should test it thoroughly! For pluimveeweb i didn't used the CSS, that part is added while writing the module. Here ya go, github: BundleFilesMinify7 points
-
Pageimages suggests you have a image array and try to call heigth which of course doesnt work. I'm not sure this ever changed and was always like this. So I think you have some code that worked beacuse it was an single image.3 points
-
i do this sort of thing now a lot, thanks to Ryan's CMS Critic Case Study; this is almost the same as WillyC's code at the above link /** * This hook modifies the default behavior of the Page::path function (and thereby Page::url) * * The primary purpose is to redefine blog posts to be accessed at a URL off the root level * rather than under /posts/ (where they actually live). * */ wire()->addHookBefore('Page::path', function($event) { $page = $event->object; if($page->template == 'post') { // ensure that pages with template 'post' live off the root rather than '/posts/' $event->replace = true; $event->return = "/$page->name/"; } });3 points
-
The height method doesn't exists in Pageimages. So maybe you trying to get a height of a Pagefiles array, and not a single image object. Soma wins...2 points
-
Hi everyone, I'm in my first week of ProcessWire and loving it! I've next to no php experience but I'm figuring things out thanks to all your help on this forum. It took me about 5 attempts to understand this process but now I get it. What a clever way of doing this. It makes it so simple for the user to edit as well which is great. Thanks folks.2 points
-
Should've done this earlier, but I've just pushed to GitHub updated version of the module. This version is set to require "changelog" permissions and create it when the module is installed. Dragan and any others who've already installed the module: I suggest that you get the latest version, add aforementioned permission manually and then apply it to those roles that should be able to access changelog page.2 points
-
jacmaes, Sorry for the delay on this, but I have finally pushed a new version to GitHub and also submitted it to the modules directory. The modules configuration settings now allows you to specify a variety of image quality settings for JPG and PNG outputs, but please note that for this to function as expected you need PW 2.4 or a late 2.3 dev version that supports field dependencies. Please test and let me know if you have any suggestions. I'd also like to reiterate how important it is to have imagemagick compiled with rsvg - I was testing this for the first time on a server without it and the quality was not great. Added new screenshots and details to the first post above too.1 point
-
Many in here come from modx, my self included. I know clippercms, a forked modx evo. That's why I can say from my own experience (so this time no disclaimer needed here) that the decision you have to make is very easy: processwire is more easy as modx evo and revo, but with a much better core and api. We have been through this in both forums so many times already, how can you have missed all those posts on both sides ? Anyway what kind of help do you need ? Do you have to port many pages ? It can be as easy as setting up your templates in processwire and then copy and paste your old site content into the fields of processwire. Hope this helps, and welcome to processwire. Some more links here: Coming from modx http://processwire.c...ning-from-modx/ A MODX refugee: questions on features of ProcessWire http://processwire.c...of-processwire/ Code comparison between modx and processwire. http://processwire.c...ge-2#entry303491 point
-
pwired: social media shares are carried from round to round. edit: ah, you meant that pw mention. nice!1 point
-
True & true diogo and martijn. That's why I wanted to use susy. No markup, just a very flexible grid system. Sounds like neat is that too.1 point
-
Everytime I use a grid system, I find myself having too much work fight some inflexibility, but in most part I enjoyed http://neat.bourbon.io/ with best being that I didn't have to do absolutely anything in the markup. Work is 100% done in the stylesheet.1 point
-
@dragan...a clarification - if you have a chance, have a look at Wanze's code in his module Batcher. He creates a permission "batcher" which you can give a certain role. Although the batcher page appears under setup, it doesn't have to be moved manually from under setup in order for the non-supersuser (manager in your case) to see it. They will only see "batcher" or in your case "changelog" under the setup menu; nothing else. Try it and see! Speaking of batcher, I prefer the route batcher takes of creating a permission to give access to the module rather than applying it site-wide with a page-edit permission (Wanze was just giving an example above). Of course, there will be times you don't mind giving permissions site-wide....OK, enough rambling...Hope this makes sense! Edited for clarity1 point
-
Very good. Yes using it.1 point
-
Nothing simpler than that. You know that every page in Admin is a page under "Admin"? So you can drag the Changelog page from /Admin/Setup/ and drop it below the /Admin/Pages page.. et voila, the page is no longer displayed under "Setup"1 point
-
@dragan Add 'permission' => 'your-permission' to the array returned by the method getModuleInfo(). After this line: https://github.com/teppokoivula/ProcessChangelog/blob/master/ProcessChangelog.module#L35 Example: If all users who can edit pages should be able to access the module public static function getModuleInfo() { return array( 'title' => __('Changelog'), 'summary' => __('Keep track of changes (edits, removals, additions etc.)'), 'href' => 'http://modules.processwire.com/modules/process-changelog/', 'author' => 'Teppo Koivula', 'version' => 126, 'singular' => true, 'autoload' => false, 'installs' => 'ProcessChangelogHooks', 'permission' => 'page-edit', ); }1 point
-
And by fishing, I mean the sort with a line, hook and dinner attached to the end. http://harlestonanglingclub.co.uk/ I haven't done any of the content this time - it is all the clients work directly onto the site, including any images. It is mostly a pretty straightforward website with a few bits and pieces. They can change the main header image as well as the large site background image. They can manage the slideshow of course. There is a link system with categories that automatically generates a list of places that also sell tickets. Repeater fields are used for things like the ticket prices tables. The fixture list is a bit of fun and thanks to various people here for helping with that a few months ago. It automatically sorts into Years, then months, then days. Graphically, all I did was create their main header banner and a map on the contact page. Since the "management" have a pretty dry way of writing, my main concern was to give the site a lot of air and openness to try and take away from that a little. The site was built with Bootstrap 3 in about two days or so. It has taken nearly three months to get the content sorted out I had one amusing issue. When I uploaded to their host (having persuaded them to upgrade from the Zeus server they were still on), I discovered that the page name for the admin I had chosen, happened to be one of a pile of aliases the hosts use for their control panel. So I could not login. Oops. Thankfully, changing the page name in the database solved the problem.1 point
-
Just received an email with these great news. Following the recent acquisition of Jilion by Dailymotion, their main product SublimeVideo is now for free1 point
-
I just noticed that the complete ACE editor is bundled with TextformatterHannaCode. Wouldn't it be nice to make it a separate js module and use it if it's installed? Also there's already a ACE editor fieldtype from Adam. Since ACE editor source comes with 1million! files I think it would be the way to go. Much like jQueryDataTables or Magnific etc.1 point
-
Hi jacmaes, Yes, I am intending on adding some more options. I will have a need for some of these features myself shortly anyway. I'll see what I can do about getting them added sooner than later and then releasing this officially. Thanks for the nudge1 point
-
Made some changes to the demo files (CSS, template, readme) having to do with an unfortunate iOS7 discovery. Apple in their way has decided that we must not be allowed to affect volume via Javascript. I've not found a cure. The demo template and CSS are now set to omit audio controls if the user agent string looks like something from an iOS7 device. "On iOS devices, the audio level is always under the user’s physical control. The volume property is not settable in JavaScript." This is unfortunate for web based kiosk applications where you can't expect users to know how to find the iOS volume control and you don't want them using the physical buttons. Any suggestions?1 point
-
I just put this on GitHub. It's still a little raw. Tell me if anything should be tweaked before submitting it to the module list. The AudioMP3jplayer module uses FieldtypeFilePlusData. You need both. I have look into setting that up as a dependency. https://github.com/sb3d Nov. 26: There are now some demo files in the AudioMP3jplayer repo. You get a template file, an image showing PW's Edit Template screen for the template, a stylesheet for the player. With that and a little imagination you can probably make it work. If you grabbed copy yesterday, check again because I also made a small fix to AudioMP3jplayer module.1 point
-
I know the bulk of you are coders and likely can figure this out on your own but for those who are not, I thought I'd throw this solution in here just in case someone else has a need for it. I created a simple widget-google-plus.php file for those who want to add a Google Plus widget to their sidebar (or elsewhere) in Processwire. To use, simply upload the attached widget, changing the profile URL to yours and add the CSS / tweak as needed. I've no clue how to build a module so I am doing this as a tutorial. First the logic: If you are anything like me, you crave customization. I hated the fact that Google wouldn't let me remove the border from around their google plus badge so I decided to create a solution of my own. Here's how it looks straight from Google: To get rid of this obnoxious border, I created a new widget (attached) with this code: <div id="googleplus_widget"> <span> <div class="g-plus" data-width="275" data-height="69" data-theme="light" data-href="https://plus.google.com/your-profile-id-goes-here"></div> <script type="text/javascript"> (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/plusone.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); </script> </span> </div> As you can see, it's wrapped in divs which I then styled with the following CSS: #googleplus_widget{ width: 280px; height: 50px; } #googleplus_widget span{ width: 200px; height: 50px; float: left; overflow: hidden; background: #fff; } #googleplus_widget span div{ margin: -1px 0 0 -1px !important; position: relative; } To use, simply modify the attached widget-google-plus.php with your google plus profile URL, upload to your ProcessWire installations /site/templates directory and go to Setup and then Templates within the back end of your install. The new widget php file should show up under the "Templates found in /site/templates/*.php" , check it off, click add template and then add it to your sidebar if you choose to do so. That's it. Hope that helps someone. I know it's a minor contribution but at the very least, this is recorded for me to reference later when / if I forget BTW. If there's an easy way to make this into a module, I'd love to be able to do so even if just for myself and future newbs. widget-google-plus.php1 point
-
Something like this? $image = $page->images->first(); $img = null; if ($image->width >= $image->height) { // Lancscape $img = $image->width(900); } else { // Portrait $img = $image->height(900); } echo "<img src='{$img->url}' alt=''>";1 point
-
the.nature the real secret of category is the.world made of category. the world made.of page catpage in.catpage if you.know catpage.that world is made of you.make of it whatever you wish.1 point
-
@bcartier: The ImportPagesCSV-module can't do this as is. But I tried making a tiny addition to make it support FieldtypePage (those used to make page references) and it worked amazingly well. The only change needed was to add 'FieldtypePage' to $fieldtypes array (just before init() function if you take a look at the module file), like this: protected $fieldtypes = array( 'FieldtypePageTitle', 'FieldtypeText', 'FieldtypeTextarea', 'FieldtypeInteger', 'FieldtypeFloat', 'FieldtypeEmail', 'FieldtypeURL', 'FieldtypeCheckbox', 'FieldtypeFile', 'FieldtypePage', // add this line ); After that addition it's possible to choose a Page field when connecting the fields from the CSV to the ones in the chosen template. I had pre-populated categories at the target site and used their id's in the CSV file to reference those categories. Multiple categories worked like a charm as well, just use a pipe in between id's (123|456|789). Moreover, if you've got only one category per entry to reference, then you don't even need the id's of the categories - you can use paths as well. Here's a little example: cat.csv: title one two three four entries.csv: title,categories a,/cats/four/ b,/cats/three/ c,/cats/one/ d,/cats/two/ Import cat.csv using a template for categories with (at least) title field, under a page at /cats/. Then import entries.csv using a template for entries, having a title field and a page field. This should leave you with entries that are connected to categories. I hope this gets you somewhere. @ryan: Looks like page references could be supported very easily. I just used this successfully to import ~3500 pages with category references from an old site to a new PW one. But maybe there's still something else to be done before they're fully supported?1 point
-
It sounds like you are adding images to a PW page. Here's how you'd do that below. When you are manipulating values on a page, you usually want to have output formatting off. When that is the case, an image field will always behave as an array of images rather than 1 image. So the code below would be the same regardless of whether dealing with a single image field or a multi image field. The example also assumes your images field has the name 'images', but it can be whatever you want it to be. $page->of(false); // turn of output formatting if in template context, not necessary otherwise $page->images->add('/path/to/file.jpg or http://domain.com/path/to/file.jpg'); $page->save(); Note that $page has to exist (and have an 'id') before an file/image is added to it. So if you were creating a new Page, you'd have to do it like this: $page = new Page(); $page->template = 'name-of-template'; $page->parent = '/path/to/parent/'; $page->save(); $page->images->add('http://...'); $page->save(); If you want to delete an image, do the delete and save before adding another: $page->images->deleteAll(); $page->save(); // commit the deletion $page->images->add('http://...'); $page->save(); Or if you want to delete a specific image: $image = $page->images->first(); $page->images->delete($image); $page->save(); // commit the deletion $page->images->add('http://...'); $page->save(); Note that when you add() an image, if you are pulling from an http:// address then your PHP must support allow_url_fopen. Some web hosts have this disabled, though most don't.1 point
-
It's possible to use <repeater-name>.<field-in-repeater> as a field name. For example: $matches = $pages->find("title|my_repeater.my_field~=$q");1 point