-
Posts
733 -
Joined
-
Last visited
-
Days Won
9
Everything posted by SamC
-
The timing of this couldn't have been better. Big thanks
-
I got a local one set up right now. I've got no problem with blowing it up either, mistakes are vital. Well, learning from them rather than repeating them... Incidentally, I see @bernhard has just posted a large guide on process modules. Perfect timing
-
I thought a module was a module. Then I hear about process module. Gonna look into this, but surely need to improve my php first and learn more about how classes work etc. in order to extend existing ones (and have a rough idea what I'm actually extending). I'll have a good read through the code of the (process) modules listed so far. No doubt I'll be back to that gif face again.
-
I’ve never used the access settings on fields, only on entire templates so I’m not a great deal of help here. Maybe set restrictions on only the templates first, then try it. If it works as intended, try add a restriction to a field within one of those templates, then try again. I’d just be trying a load of combinations the old fashioned way until it worked. I’m sure another member would have a quicker solution though.
-
Ha yeah, me looking at the hello world module looks something like this: Not that I won’t keep trying though until I can do it.
-
Looks ok now? Bodged an svg together before I look into other image options suggested above.
-
Wow, great suggestions! You mean I can finally use my wacom sketch thing after owning it for about 5 years (in the cupboard)?? Guess I know what I'll be doing for the next few days. Affinity presents a problem though: "We license Affinity Software for iPad and Mac OS through their respective App stores, independently of Windows and the license is not transferable and needs to be bought for each independent OS (Windows/Mac/iOS) you wish to use it on". I use a macbook and a desktop pc. Guess I'll try gravit.
-
Yeah it's really weird. Works fine on android boat browser too. In safari 11.0.1 on OSX 10.13.1, when you shrink the screen so the menus are vertical, tapping the touchpad doesn't work either, but click does. The menu items on the left work fine with touchpad and click. Think it's something to do with the top menu item, behaviour is different on that one for some reason. I attempted a video with giphy to demonstrate. HSI.mp4 Maybe this'll help.
-
I don't think so. I think it's just me. I'm not like some of the members here with years of PHP experience so I've just never used a tool like this before. I'm sure over time, the usefulness will become much more apparent. I mean, I still use ST3 instead of an IDE because I don't make anything with enough complexity to require one. I'm interested in learning more about the PW classes though and how things actually work together in the background. I have done a Java course at the Open Uni so did stuff like classes/creating objects/getters/setters/interfaces/inheritance/abstract classes/overloading. Was basic but probably enough to get me started. Yep, it's a png exported from the original svg I made. Tbh I suck with svg. I use inkscape purely because I can't justify the monthly cost for illustrator although I'd love to give it a shot. I guess I need to change the font in the logo to a path in order to actually see the correct font in the resulting svg when it's displayed on a webpage. Of course, always open to new ideas! I thought this might come up. Would be awesome to have 'posted by displayName', which links to a page listing all the posts written by whatever name. I bet connect page fields could be used for this somehow, maybe a page ref on the user template which links to the existing page ref on the blog posts (the one already linked to the page ref on the tag-entry template). Not sure how to handle the actual content creation though, I didn't plan on having a user registration form. Maybe I could create a user by request or something. Thanks for the feedback everyone, it's very useful
-
When the screen goes white and the spinner starts, that's usually my cue for the back button to find a resource that just loads up normally. Why? Simply because I don't know how long it's going to take and haven't the patience to wait and find out. This is a complete self opinion with no factual backup whatsoever so obviously some actual user feedback would be very useful. I don't even care about a fout either tbh. If you want a big one, check this out: https://www.diy.com/find-a-store I noticed it the other day. It's a major company in the UK with mega money for developers.
-
On twitter @pwtuts I made this site to: a) help get beginners up and running with PW. b) give something back to a community that has been very helpful (and patient) to me. c) improve my own knowledge because writing about it really drills it home. Modules: AOS - lots of useful admin tools Connect page fields - made tagging and related posts very easy indeed Custom inputfield dependencies - used to hide fields (on child pages) in a multipage post because all blog posts use the same template ProFields: repeater matrix - used for all body content (image, RTE and code fields) Markup Sitemap XML - for submission to google search console ProFields: Auto links - I have a bunch of pre-determined strings in here (that I need to print out and stick on the wall...) Tracy Debugger - still can't use properly IMagick image sizer - very fast compared to GD, especially when some posts have 5+ images and the originals are 2500px wide Tools: NodeJS with the usual suspects: "devDependencies": { "autoprefixer": "^7.1.2", "cssnano": "^3.10.0", "gulp": "^3.9.1", "gulp-postcss": "^7.0.0", "gulp-rename": "^1.2.2", "gulp-sass": "^3.1.0", "gulp-sourcemaps": "^2.6.0", "gulp-uglify": "^3.0.0", "postcss-flexbugs-fixes": "^3.0.0" }, "dependencies": { "bootstrap": "^4.0.0-alpha.6" } Bootstrap 4 (npm) SCSS In short: had a bunch of fun making this, learned loads. and looking forward to updating with more tutorials.
- 13 replies
-
- 22
-
@benbyf I always enjoy seeing your work, a real fun site this one I am browsing on the iPad though in portrait mode and the top menu items to the right press but don’t go to the intended links. A long press triggers the safari modal to open the link. They work in landscape as a single horizontal menu. I know this thread is old but just a heads up.
-
This is incredible! Well done @bernhard wish I could do like 1/10th of that stuff.
-
Hi @devonic and welcome to the forum. Could you post the errors? Did you set access restrictions on just the templates or on the fields themselves?
-
Understatement of the year. This is how I saw it: I'm guessing none of their guests are visually impaired. Come to think of it, I can't actually even read the logo properly.
-
Make variables in _init.php available inside functions in _func.php
SamC replied to SamC's topic in General Support
Oooooo, I like this! Maybe I should have mentioned that I use the function a few times. The full section looks like this. <meta property="og:type" content="article"> <meta property="og:title" content="<?= $page->get('altTitle|title'); ?>"> <meta property="og:url" content="<?= $page->httpUrl; ?>"> <meta property="og:image" content="<?= getMetaImage()->httpUrl; ?>"> <meta property="article:author" content="@pwtuts"> <meta name="twitter:card" content="summary"> <meta name="twitter:site" content="@pwtuts"> <meta name="twitter:title" content="<?= $page->get('altTitle|title'); ?>"> <meta name="twitter:description" content="<?= $page->get('metaDescription|summary|title'); ?>"> <meta name="twitter:image" content="<?= getMetaImage()->httpUrl; ?>"> <meta name="twitter:image:alt" content="<?= getMetaImage()->description; ?>"> Thanks for the help -
Make variables in _init.php available inside functions in _func.php
SamC replied to SamC's topic in General Support
I just checked, it is NULL indeed. Thanks for pointing that out. So using info from the previous two replies, I can either: // _func.php function getMetaImage() { $imgOptions = wire("config")->custImages; //... $metaImage = $page->parent->postThumbnail->size($imgHeight, $imgWidth, $imgOptions); //... } // /includes/header.php <meta name='twitter:image' content='<?= getMetaImage()->httpUrl; ?>'> OR pass it into the function. // _func.php function getMetaImage($imgOptions) { //... $metaImage = $page->parent->postThumbnail->size($imgHeight, $imgWidth, $imgOptions); //... } // $imgOptions is available from prepended _init.php <meta name='twitter:image' content='<?= getMetaImage($imgOptions)->httpUrl; ?>'> If I use the second option here, I don't need it anything on config no? I could just use a regular variable and leave config alone: // _init.php $imgOptions = array("upscaling" => true, "cropping" => "center", "quality" => 90); Would there be a preference over one way or the other? -
Make variables in _init.php available inside functions in _func.php
SamC replied to SamC's topic in General Support
Hi @Robin S yeah I thought I was aware of scope. However, my code now looks like this: // config.php /** * * Global image sizing options * */ $config->custImages = array("upscaling" => true, "cropping" => "center", "quality" => 90); // _init.php $imgOptions = $config->custImages; // Include shared functions (if any) include_once("./_func.php"); // _func.php function getMetaImage() { $page = wire("page"); $pages = wire("pages"); // max height of uploaded landscape image = 1200px $imgHeight = 1200; $imgWidth = 1200; // if /tutorials/blog-entry/ if ($page->postThumbnail && $page->parent->id === 1017) { $metaImage = $page->postThumbnail->size($imgHeight, $imgWidth, $imgOptions); } // if /tutorials/blog-entry/blog-entry/ elseif ($page->parent->postThumbnail) { $metaImage = $page->parent->postThumbnail->size($imgHeight, $imgWidth, $imgOptions); } // default image on /site-settings/ else { $metaImage = $pages->get(1319)->postThumbnail->size($imgHeight, $imgWidth, $imgOptions); } return $metaImage; } ...then I call it in a template: // /includes/header.php <meta name='twitter:image' content='<?= getMetaImage()->httpUrl; ?>'> ...and no error. The 1200px x 1200px image is created just fine (and it's def using imagemagick too, these images are being created way faster than before). I can't get my head around why this working yet my original example right at the top threw an error. Any ideas? -
So, I've got: // config.php /** * * Global image sizing options * */ $config->custImages = array("upscaling" => true, 'cropping' => "center", "quality" => 90); // _init.php $imgOptions = $config->custImages; // card.php <?php if ($entry->postThumbnail): $thumb = $entry->postThumbnail->size(800, 450, $imgOptions); ?> Imagemagick is installed. So, does this mean the cropping will be applied? Will imagemagick even be used in this case, or GD? This is what's confusing me. = EDIT = Correct me if I'm wrong but everything seems to work now. Images are being cropped, and FAST! Where has imagemagick been all my life??
-
Make variables in _init.php available inside functions in _func.php
SamC replied to SamC's topic in General Support
Lol, now I'd hate that to be on my conscience. I'll create a custom option then. This is linked to my other post: Trying to juggle between the two here. -
Thanks @horst still not 100% here. For number 2, imagemagick doesn't have a crop setting so that is set in number 3. How does the crop happen in this case?
-
Make variables in _init.php available inside functions in _func.php
SamC replied to SamC's topic in General Support
Aha, I see, thanks. -
Make variables in _init.php available inside functions in _func.php
SamC replied to SamC's topic in General Support
I did this now: /** * * Global image sizing options * */ $config->imageSizerOptions = array("upscaling" => true, 'cropping' => "center", "quality" => 90); Did you mean adding the whole line to config.php? // Global image options $options = array("upscaling" => true, 'cropping' => "center", "quality" => 90); I'd rather have them as a variable like this, then I can override when required inside my templates (say I want a 'nw' crop in one place). I don't mind passing the extra $options to each image resize. = EDIT= Sorry, maybe you mean, use the line in the first code block, then access like this: $thumb = $entry->postThumbnail->size(800, 450, $config->imageSizerOptions); -
Totally. One of my main interests is how other people organize the backend to make it as easy as possible for clients. It's the different backends used on production sites that people new to processwire don't ever get to see, only their own one. How a client interacts with the backend is of major importance IMHO. Great video @maxf5
-
Tutorial: Simple file downloads with ProcessWire
SamC replied to dotnetic's topic in Getting Started
Nice! Thanks @jmartsch