Peter Knight
Members-
Posts
1,377 -
Joined
-
Last visited
-
Days Won
5
Everything posted by Peter Knight
-
@soma I was trying to add an image to the left of each navigation link. As your docs mention, the following will grab the first image in a field I specify 'item_current_tpl' => '<div class="nav-icon"><img src="{images}"></div><a href="{url}">{title}</a>', I had a few challenges here and wondered about best approach Image Tag My images field may contain several images. I could create a separate navigation_images field but would love to call an image by tag Image size I can accomplish by CSS but wondered if I could apply the API width() Ultimately, my markup would resemble something like this. It's the getTag and width(300) which break the call 'item_current_tpl' => '<div class="nav-icon"><img src="{images->getTag('icon')->width(300)->url}"></div><a href="{url}">{title}</a>',
-
Shorter API calls - which do you use?
Peter Knight replied to Peter Knight's topic in Getting Started
Thanks for clarifying @LostKobrakai Something I'd been meaning to ask for a while. -
I noticed some example code provided recently had a very simple API format as follows: <a href='{url}'>{title}</a> Since I started using PW I've always preceded my field name with a variable and thought this was best practice. <a href='{$item->url}'>{$item->title}</a> What's the general advice here? Looking at the forums and blog I can see mention of a shorter syntax mentioned here https://processwire.com/blog/posts/processwires-roadmap-in-2015/ But then I can also see a post which seems to indicate that short tag-like syntax isn't necessarily a good thing https://processwire.com/api/why-php-syntax/ Edit: changed "proceeded" to "preceded"
-
Thanks. I was almost there. I can see where I went wrong with the second example too.
-
I really like the simpler markup here and I'm using it to echo a series of blog categories separate by a , <?php $page->blog_category->implode(", ", "title"); ?> Im unsure though how to wrap the title in a link. I'm thinking I first need to create a variable called $cats and associate it with my blog_category field. I then need to place an anchor before the title. <?php $cats = $page->blog_category; echo $page->blog_category->implode(", ", "<a href=\"$cats->url\">title</a>"); ?> As this produces no output and no error, I'm clearly doing something wrong. Looking at Ryans example of the new API, I can modify an example to include the url <?php $cats = $page->blog_category; echo $cats->implode(function($cat) { return "<a href='$cat->url'>$cat->title</a>"; }); ?> I know I'm close! Any help much appreciated.
-
Creating new responsive theme based on Foundation
Peter Knight replied to formmailer's topic in Themes and Profiles
After using both Bootstrap and Foundation for the past 2 -ish years, here's a list of stuff I wish I'd known "back then". Bootstrap comes with a nicer default styling. It shouldn't really matter as the point here is to put your branding on the top. Foundations default aesthetic isn't as pretty IMHO and I have to do more work on top of a Foundation install. Foundation doesn't have an x-small grid and starts at Small. Bootstrap on the other hand does have a =n x-small grid and I miss this when working with Foundation Foundation has slightly less code in setting up a row/column layout. Bootstrap has an extra Container class that each row everything needs to be wrapped in Both are pretty heavy in JS. Dont call all the JS. Just call the JS for the components you need That's pretty much it for me, I settled on Foundation but miss Bootstrap and am thinking of reverting or trying something much lighter. Heard good things about http://getskeleton.com/- 10 replies
-
- getting started
- responsive
-
(and 2 more)
Tagged with:
-
Hey Mike Nice Module. I've been using Redirects for a project and as mentioned I have 500 redirects to make. Actually, 400 left with 100 done. I might port to JL as I like the wildcard integration. Can I make a suggestion now that I've installed it? 1 The Destination column IMHO would be best displaying the new path and not the page title. Displaying the page title (to me) largely tells me nothing useful. 2 Minor point but the font sizes are different than the rest of the RenoTheme fonts. Not a biggie but when everything in Reno is so consistent it'd be nice to continue that. I appreciate you've 2 extra date columns and that could be reason for reducing font size. Otherwise, nice job. The 404 Monitor is great
-
My original comment referred to the Redirects Module though? Didn't realise there was a Jumplinks conversation here too.
-
They satisfy different use cases. If I don't know my page name but know where it's stored I will use the tree. Sometimes page names have changed. Likewise, in reverse... If I know the page name but not where it's located in the tree an auto complete field solves that And even if I know where a page is located in the tree, on large trees manually locating 500 pages takes a long time.
-
When you're Selecting a page to redirect to you're presented with the site tree. I'd love to see an additional auto-complete field here too. We have about 500 individual redirects to implement and it would drastically reduce our time. Is it on the roadmap or could it be?
-
Would this help? http://modules.processwire.com/modules/image-extra/
-
I have a homepage with a Page field which allows client to choose a single page. <?php foreach ($page->feat_home_pptv as $pptv) { echo"test" ;} ?> This echoes 22 "test" on the page even though the Page field is limited to a single Page Ok, I thought. Lets try this with some real content ... <?php foreach ($page->feat_home_pptv as $pptv) { echo"{$pptv->title}" ;} ?> The above produces produces an odd looking error referencing a CommentArray Error: Exception: Class 'CommentArray' doesn't yet implement method 'makeBlankItem()' and it needs to. (in /var/www/vhosts/domain.com/httpdocs/wire/core/WireArray.php line 131) #0 /var/www/vhosts/domain.com/httpdocs/wire/core/WireArray.php(1457): WireArray->makeBlankItem() #1 /var/www/vhosts/domain.com/httpdocs/wire/core/WireArray.php(443): WireArray->usesNumericKeys() #2 /var/www/vhosts/domain.com/httpdocs/wire/core/WireArray.php(464): WireArray->get('title') #3 /var/www/vhosts/domain.com/httpdocs/site/templates/home.php(88): WireArray->__get('title') #4 /var/www/vhosts/domain.com/httpdocs/wire/core/TemplateFile.php(182): require('/var/www/vhosts...') #5 [internal function]: TemplateFile->___render() #6 /var/www/vhosts/domain.com/httpdocs/wire/core/Wire.php(397): call_user_func_array(Array, Array) #7 /var/www/vhosts/domain.com/httpdocs/wire/core/Wire.php(332): Wire->runHooks('render', Array) #8 /var/www/vhosts/domain.com/httpdocs/wire This error message was shown because you are logged in as a Superuser. Error has been logged. The selected page's template doesn't have any comments markup html but it did have a comment field assigned to the template. I removed the comments field from the template and the selector produces no content <?php foreach ($page->feat_home_pptv as $pptv) { echo"{$pptv->title}" ;} ?> I'm running ProcessWire 2.6.14, MYSQL 5.5.41 Adding find('limit=1') works and produces no errors <?php foreach ($page->feat_home_pptv->find('limit=1') as $pptv) { echo"{$pptv->title}";} ?> I'm not sure why it needs that find('limit=1') as the field itself is set to only allow a single page
-
Module Pollino (Simple Polls for ProcessWire)
Peter Knight replied to Soma's topic in Modules/Plugins
I thought I needed to specify a template the content was based on or at least kick off with a selector. Thanks for the input. -
Module Pollino (Simple Polls for ProcessWire)
Peter Knight replied to Soma's topic in Modules/Plugins
Hi Soma Just tried the Pollino module and it's fab. I'm not very familiar with the delayed output method you recommend here // may needs modification as this examples uses delayed output // but you get the idea $content .= "<div class='pollino_poll'>"; $content .= "<div class='inner'>"; $content .= "<h3>$page->title</h3>"; $content .= $modules->Pollino->renderPoll($page); $content .= "</div>"; $content .= "</div>"; To get it to output anything, I needed to tweak as follows. That's the recommened way, right? <?php $page->children; { $content .= "<div class='pollino_poll'>"; $content .= "<div class='inner'>"; $content .= "<h3>$page->title</h3>"; $content .= $modules->Pollino->renderPoll($page); $content .= "</div>"; $content .= "</div>"; } echo $content; ?> -
Thanks Philipp That's pretty distorted alright. Possibly because I'm serving up a 2X image and scaling it down with a max-width selector in CSS. Will look into it right away.
-
For sure! Phase 2 is on right now!
-
Hi Guys, A new launch from us. Ensoul.co.uk - Interior Design, Architecture & Project Management, London. Background Based in London, Ensoul are Interior Architects specialising in high-end / luxury interiors, basement conversions, extensions, and residential renovations etc. We based the site on ProcessWire because it's agile, scalable and a pleasure to work with. Given that the Ensoul team will shortly be updating the site and blog in-house we needed a CMS that would also be intuitive for them to use. Overall the nature of the site is very visual and relies heavily on photography. It was essential the CMS had solid image management built in and this was another factor in choosing to run it on ProcessWire. More on that shortly. The plan This is Phase 1 (design and launch) of a multi phase project. Phase 2 consists of optimisation, refinement and a comprehensive SEO project. In particular we'll be redesigning the homepage, building a blog and looking to speed up page loads. With ProCache due to be installed very shortly, we plan to dramatically increase the site speed, minify a lot of the JS and gain points on Googles mobile speed test tool. Image Management I just wanted to highlight some of the nice image management features which ProcessWire brought to the table. 1. Background images Most of the pages have a large background image and we wanted the freedom to swap and change these on a page by page basis and test a lot of different photos. Given 80% of the page and background image is covered by content, not every image was going to work. We solved this simply by creating an image filed called Background Image into which we (or client) can drag and drop a photo of their choice. Any background photos are integrated into the jQuery Backstretch plugin In the case of the homepage where three background images are used, PW and Backstretch will create a slideshow instead. <?php // if Background_Image field contains more than 1 photo, echo the images in a slideshow // Mainly for Homepage if($page->Background_Image->count > 1 ) { $bgimage = $page->Background_Image; echo '<script>$.backstretch(["'; echo $bgimage->implode('", "', "url"); // results in url", "url", "url echo '"], {duration: 5000, fade: 1000});</script>'; } else // otherwise echo a single image on its own // Mainly for all other pages if($page->Background_Image->count == 1 ) { $bgimage = $page->Background_Image; foreach ($bgimage as $image) { echo" <script> $.backstretch('$image->url'); </script> "; } } ?> 2. Portfolio The Portfolio page is image heavy and features a masonry grid of photos which are then filtered by project type. On the front end, I was able to restrict each thumbnail and pop-up image to the size of my choice without having to crop each individual photo. To achieve this, I used a $thumb and $large variable and PW automagically handled the cropping. foreach($page->Images as $image) { $large = $image->width(800); $thumb = $image->size(340); echo ".... Creating the filters which toggle the display of rooms by type was surprisingly easy with ProcessWire. I used the image tag field which I hadn't really used before and quickly allowed me to tag a photo as a kitchen, bedroom or basement etc. It really was an eye opener into the power of PW: <div class="portfolioFilter"> <strong>View:</strong> <a href="#" data-filter="*" class="current">All</a> <a href="#" data-filter=".Kitchen">Kitchen</a> <a href="#" data-filter=".Bedroom">Bedroom</a> <a href="#" data-filter=".Bathroom">Bathroom</a> <a href="#" data-filter=".Sitting-Room">Sitting Room</a> <a href="#" data-filter=".Gym">Gym</a> <a href="#" data-filter=".Basement">Basement</a> <a href="#" data-filter=".Home-Office">Home Office</a> <a href="#" data-filter=".Kids">Kids</a> <a href="#" data-filter=".Garden">Garden</a> </div> <div class="portfolioContainer"> <?php foreach($page->Images as $image) { $large = $image->width(800); $thumb = $image->size(340); echo " <a class='fancybox-portfolio port-item {$image->tags}' href='$image->url' rel='gallery1'> <img src='$thumb->url' alt='$thumb->description' class='portfolio-thumb'> </a>"; } ?> </div> 3. Coverage Thumbs The client is receiving regular coverage in leading interior design magazines and at the end of the project I required a way to differentiate between Features and Opinion pieces. Again, PW made this very easy for me. I knew I could easily create a field called Coverage Type and select the type of coverage a publication should belong to. Traditionally I would have relied on the Page field to achieve this but I didn't need the initial more involved setup which that would require. Instead I opted for the new, simpler Options field instead. Featured Modules RenoTheme CoreConfig Upgrade Markup Simple Navigation CroppableImage FormBuilder ProCache (shortly) SEO Page Path History Redirects SiteMap XML ListerPro WireMail SMTP Conclusion That's pretty much it. I know some of the techniques here won't set the PW world on fire and probably are pretty basic but hopefully seeing the screengrabs and examples will help other beginners understand PW a little better. Thanks as always to the PW community who helped build this with their advice and answers along the way.
- 6 replies
-
- 20
-
Forklift looks great. Thanks for the tip Adrian. @elabx Transmit is good and I can recommend it. I think the version purchased via the Apple App Store has a sync limitation or can only sync via DropBox and not use it's native sync function. Also remember using it the first time and noticing that it prefers drag n drop over uploading a file. If you upload a file the normal way make sure "Linked Folder Navigation" is on so your folders will navigate in sync, local and remote, at the same time. Always found Transmit support very good too.
-
Next production version of PW, after 2.6.1?
Peter Knight replied to Peter Falkenberg Brown's topic in Wishlist & Roadmap
A lot of us are running the latest Dev version (2.6.13 right now) on live production sites with no issues. You have to make that decision yourself and ensure you have a backup etc but I've had no issues. I use the Upgrade module to keep an eye on what the latest Live and Dev version is. -
Hi abmcr Do any of your templates use the settings found under the Family tab? This ensures that new pages using certain templates can only be children of specific pages. I think that's fundamental to seeing the Add New option in the Pages menu,
-
Hi Rick I've read few intros on the PW forums and this seems to be a common experience (myself included). Can you recall why it didn't seem to match requirements initially and which version (approximately) was it at? P
-
Module Youtube And Vimeo Thumbnail Grabber
Peter Knight replied to adrian's topic in Modules/Plugins
Might be an option. I'll need to build out a few pages first. Luckily the videos my client is featuring are all cinema releases so they're almost always going to have a high res image in there. I noticed 0,1,2,3 pull in small thumbnails as opposed to a largeish screengrab of the 0,1,2,3 frames. Presume thats a YouTube thing (tiny thumbnails Vs decent W/H images) -
Module Youtube And Vimeo Thumbnail Grabber
Peter Knight replied to adrian's topic in Modules/Plugins
@adrian Thanks so much for building this. I just installed this for a site I'm building which features a ton of vids. I'm not familiar with YouTube's image settings etc but in general out of the following, which is most commonly used? maxresdefault, hqdefault, mqdefault, default, 0, 1, 2, 3 I'm tempted to pull them all in and allow my client to tag a thumbnail they wish to use. However, equally, I'd rather not take up bandwidth if I knew that by dafault, YT always has a default thumb etc. Obviously, 0, 1, 2, 3 are also good defaults. -
MarkupSEO - The all-in-one SEO solution for ProcessWire.
Peter Knight replied to Nico Knoll's topic in Modules/Plugins
Ah, thanks Nico. That was it