Joss
PW-Moderators-
Posts
2,870 -
Joined
-
Last visited
-
Days Won
47
Everything posted by Joss
-
HI Martijn Just noticed that the caption only works if the Description is set within the actual image field. So, if it is not, and the description is added when you insert the image, then that is not being added as alt text and is not therefore being picked up by the module. I am a bit confused as to whether this is a problem with the module or the CKeditor image plugin.
-
Get image from multiple pages based on current page selection
Joss replied to Jonathan's topic in General Support
Make sure the image field is set to 1 image only, otherwise it will be an array. You have taken the right route to get to the image field, though you don't really need to set up a separate $rating variable. $page->classification->image_field, and then add ->url to output the url echo "<img src='{$page->classification->image_field->url}' alt='{$page->classification->title}'>"; -
Ta much!
-
The PW image API allows you to create different sized, cached versions of images for use in different situations. For instance an original image might be 1000 x 700 px, but we can can crop and resize using: $newsize = $page->myimage->size(300,300); And produce a square, cropped and resized image 300 x 300 px. But how can we make this work in a responsive environment so that we choose an image varient created using the API based on viewport size? There are several ways to do this, but in this case, a bit of script called Response.js can be rather useful. Reponse.js allows you to set up a set of parameters for exchanging data on the fly. (Please note that this is NOT an ajax based system, for that, please look up enquire.js) So, you can tell it to look for a certain sized view port by setting breakpoints and then use that to choose what data you want to call in. So, for instance, on their website they give this example: <img src="lo-fi.png" data-src481="medium.png" data-src1025="hi-fi.png" alt="example" /> The default image is the smallest (thinking mobile first) and then there are two further images called depending on the viewport size. The "data-src481" bit relates to the set up code made for this page or site. You can see that it would be fairly easy to add the PW image api to that bit of html. So, onto a real world example I am using in a client's blog. I had two imediate problems - firstly the site uses EMs and by default, response.js uses px. Secondly, I wanted nice memorable names for my various breakpoints. The developer of response.js is a helpful fellow and he wrote me a nice bit of script to do exactly what I want: !function(Response) { var names = ['basic', 'phoneportrait', 'phonelandscape','smalltablet','largetablet','laptop','desktop']; var values = { phoneportrait: '(min-width:20em)', phonelandscape: '(min-width:30.063em)', smalltablet: '(min-width:33.125em)', largetablet: '(min-width:48.000em)', laptop: '(min-width:64.063em)', desktop: '(min-width:80.063em)' }; Response.addTest('view', function(breakpoint) { var query = values.hasOwnProperty(breakpoint) && values[breakpoint]; return !query || Response.media(values[breakpoint]).matches; }).create({prefix: 'view-', prop: 'view', breakpoints: names, dynamic: true}); }(Response); This script is in my sitewide javascript file so that it is available for anything I am doing. All this script is doing is setting my em min-width values against names and then using those to create the calls. So, I would call a breakpoint with: data-view-phoneportrait Just for interest, this reproduces a set of breakpoints I have using sass-mq for my sass development set up. Now all I have to do is mix that up with my images, In the example below, which is for a list of articles in responsive blocks (using the easy to use pocketgrid system) I just swap the image depending on the view port: $smallimage = $article->image_single->size(256,256); $mediumimage = $article->image_single->size(300,300); $largeimage = $article->image_single->size(371,371); echo "<a href='{$article->url}'><img src='{$smallimage->url}' data-view-smalltablet='{$largeimage->url}' data-view-largetablet='{$mediumimage->url}' data-view-laptop='{$mediumimage->url}' data-view-desktop='{$largeimage->url}'></a>"; Response JS can also swap data within a div, though as I said earlier, this does not use ajax, so is best for small bits and pieces. I am finding that with the huge versatility of Processwire, this plays very nicely not just with more complete systems like Foundation, but perfectly with far more versatile system made up of small utilities rather than one big do-everything solution. My tool box now consists of responsejs, enquire, boubon mixins (but I don't use NEAT), various cross browser helpers like respond.js and html5shiv, a very good media query mixin call sass-mq and then my own bits and pieces. So, the lesson here is that the PW api does not just output data, but is part of your toolset for creating powerful and capable dynamic, responsive, mobile first websites.
-
- 6
-
-
HI Martijn When I have debug on, I am getting this coming up on the front end: Notice: Undefined index: align in /public_html/site/modules/TextformatterImageInterceptor/TextformatterImageInterceptor.module on line 381 and Notice: Undefined index: align in /public_html/site/modules/TextformatterImageInterceptor/TextformatterImageInterceptor.module on line 388 Any thoughts?
-
Was that Stollen? (See what I did there?)
-
Okay, exactly how sad do you think I am? "And the DEVS were calling out for Processwire......"
-
Just remembered that I have a couple of Christmas songs too! The first is serious, the second is plain cheesy https://www.youtube.com/watch?v=u59_xmNSp54 and https://www.youtube.com/watch?v=w3dNmLCoeXk
-
Differentiate between update and upgrade on module settings page
Joss replied to owzim's topic in Wishlist & Roadmap
"install or die!" Sorry too direct? -
Thank you kids! And seasons greeting to both of you and to all the other Processwirers* here. (* Process Wirers? That would make us webtricians then!)
-
Differentiate between update and upgrade on module settings page
Joss replied to owzim's topic in Wishlist & Roadmap
Me too! I always say there are two reactions to hand holding - the wrong one and the right one: Wrong - "Stupid machine! It finks I am stupid or something? I am not some stupid person that shouldn't be let near a 'puter! Stupid Newbs! And I fink Bill Gates is STUPID, btw!" Right - "I have got thousands of things to do and remember - I will take any help I can" Guess who I like having round for tea? (Satire comes free .....) -
If you are worried that back end users might try and edit it, simply make sure that it's template is only useable by superadmins or whoever.
-
Differentiate between update and upgrade on module settings page
Joss replied to owzim's topic in Wishlist & Roadmap
I think that if a new version is released that would break a previous version for whatever reason, then that should be listed as a unique version, even if a note is placed on the old version saying there is a newer version. Strictly speaking, that is probably neither an update or an upgrade. I get confused between the two terms anyway, as does everyone else, from reading around the net. For instance with Debian you update the listings then upgrade the version - but the upgrade does not (or should not) break the usage of the previous and might only be minor. But software will often be announced as "the latest update" in press releases, the difference normally being described as "major" or "minor." Either way, you are right, there should probably be something in the system to allow a bit more information or flags. -
We are going to HAVE to put something about pages on the front of the site at this rate A page is only a data container - so it can be used as a complex thing with loads of fields contributing contents, or it can be used as just a single line of data for something like a drop down or a row in a table. it had to be called something and Page was it. But it is not like saving thousands of dreamweaver pages. As for scalability - well, by the time you get to millions of pages and millions of requests, really, you are probably going to be more concerned about the size of your server farm than anything else!
-
MarkupSEO - The all-in-one SEO solution for ProcessWire.
Joss replied to Nico Knoll's topic in Modules/Plugins
Just for interest, the fields I use in my sites are: Title - for the specific page title Meta Description (which is also used by og:description and twitter:description) Meta Author Google Profile address Business G+ profiles (which might be different) A featured image (that is resized as a square on the template) Twitter name Twitter Card (page field) Open Graph Type (page field) Both the last two have create new options. I am also thinking of adding bits for Schema, since those are also relevant to SEO, but obviously, if you added those, then people would have to manually add the relevant reference to their templates. -
MarkupSEO - The all-in-one SEO solution for ProcessWire.
Joss replied to Nico Knoll's topic in Modules/Plugins
On my own standard profile I have og type and twitter type as page fields so that I can also add new variations on the fly - especially useful with open graph as there are so many potential content types. -
I suppose this is an inevitable result of open source. If the company is solely responsible for all code, then they can put in tough QC measures in at source. Even then, they can get caught out by their own mistakes, but at least they know where to look. Having said that, you then might have security problems with the server, the OS or the language (PHP has had the odd issue...) The lower down the food chain you are and the more reliant you are on third party input, the more vulnerable you are. Or at least if feels like that from my one man band perspective.
-
We have the same in the UK - but it is impossible to insist that companies outside the UK take any notice. We made a mistake in telecoms many, many years ago by making numbers public by default; printed in a directory back then. Companies now believe they have an automatic right to your contact information unless you say otherwise. To me, that is fundamentally wrong. If a salesperson wants to sell to me, I expect them to go to the trouble of coming to my door so I can scare the bejeebers out of them!
-
Sitting here listening to the many scam phone calls my mother receives on her landline (and probably would on her mobile if she used it), I would love to have a little jokey functionality that simply did the following. On receipt of scam insurance, ppi, car accident, lottery or computer security call, she would simply press a button: SFX: Blaze of deafening siren down phone line (must make their ears bleed) SFX: (Under v/o) Dialling number bleeps (siren fades to background) Female VO (Authoritative): Your call has caused a security alert. Your number and location are being traced and security authorities have been notified. Please cease and desist, stay seated and place your hands on your head. Your company will now be subject to an official investigation. It is vital that you remain exactly where you are. Failure to do so will be seen as non-cooperation and will be subject to criminal proceedings. This message is an automated advisory. SFX: Bleeping and Siren stops abruptly. VO: Trace completed. Please wait for your local security forces. END Okay, so it is as fake as they are and they probably will only hear a few words of it before they hang up, but I would feel loads better having triggered it! PS: When I receive these calls, I now make it a policy not to hang up immediately as the gov suggest, but to get angry and foul mouthed and make their day as miserable as possible. If everytime they made a call they got an earful of very personal abuse, I am sure they would start looking for alternative careers after a while.... PPS: Multi language versions would also be cute .... PPPS: since so many of these calls originate from Indian call centres and English is the Lingua Franca of Calcutta, Mumbai and so on, do English speaking countries suffer from more of these than, say, German or French countries?
-
Self promotion is such an undervalued artform..... (I must write that down somewhere - one of my better ones)
-
True enough, Teppo - but like anything automated, it is a good way of starting the analysis. So you have 50 submitted modules to check, start by something automated and those that fail go straight in the bin. Those that pass, then go onto further scrutiny. It all fails when automated systems are the LAST stop rather than the first
-
I wonder if bugs were running the show, would they suffer from malicious humans?
-
The thing with Processwire, for the security conscious, is that you can create a huge variety of sites and address many different types of content WITHOUT touching any plugins other than what comes from Ryan's safe hands. You can add all the seo stuff you would ever need, add connections to social websites with links and opengraph or whatever, add caching and so on, without ever having to move outside the box - you just stick them in your template files and feed them from a field somewhere. And if you want singing and dancing with JQuery plugins, again, you just use them raw - you don't have to set up new database connections or anything else clever to make them Pw compliant - you only use the trusted API and keep the two well and truly apart. With WP, on the other hand, if you want anything more than the simplest of blogs, you are already on a plugin-fest from hell before you ever get going. Noting all that, I think it is VITAL that this principle is sustained with processwire with the vast majority of modules being about admin functionality (and vetted first as much as possible) and front end functionality left to the site development where the developers can make reasoned choices. If you want a completely plug-n-play CMS, unfortunately that will ALWAYS come with plug-n-play security issues ....
- 26 replies
-
- 11
-