Jump to content

SamC

Members
  • Posts

    733
  • Joined

  • Last visited

  • Days Won

    9

Everything posted by SamC

    [[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]] [[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]] [[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]] [[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]] [[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]] [[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]] [[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]] [[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]] [[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]] [[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]] [[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]] [[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]] [[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]] [[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]] [[Template core/front/system/searchResult is throwing an error. This theme may be out of date. Run the support tool in the AdminCP to restore the default theme.]]
  1. This reminds of something I did a while back. There's another way of grabbing the first item: Possibly a bit late to the party here but knowing an extra method can't hurt. http://cheatsheet.processwire.com/pagearray-wirearray/sorting-and-filtering/a-not-selector/ Nice mockup btw @mike62
  2. I'm trying to get my head around the new markup regions. I've come across a problem. How do you wrap tags around two regions in a template file (a container) if '_main.php' is responsible for all output? This example renders the correct output: _main.php <region id="main"> FULL WIDTH OR SIDEBAR IN HERE </region> basic-page.php <region id="main"> <div class="container"> <div class="content"> Content in basic-page.php </div> </div> </region> home.php <region id="main"> <div class="container"> <div class="content"> Content in home.php </div> <div class="sidebar"> Sidebar in home.php </div> </div> </region> But how do I make the sidebar a region so I can populate it at will depending on which template is loaded but also add a container (which will be required)? _main.php <div id="main"> FULL WIDTH OR SIDEBAR IN HERE </div> <div id="sidebar"> THE SIDEBAR </div> I could just wrap a container around both in '_main.php': <div class="container"> <div id="main"> FULL WIDTH OR SIDEBAR IN HERE </div> <div id="sidebar"> THE SIDEBAR </div> </div> ...but then EVERY page on the whole site would not be able to have full width elements. It's not possible to render tags via the page template files unless they are inside a tag/region with an id as they will be printed before the <html> tag. I'm probably missing something here about markup regions. I know @bernhard mentioned using them recently so may be able to shed some light. Any hints would be great, thanks.
  3. Ha, yep. Guilty of not reading the issue properly until after posting... Thanks @Robin S this issue was really offputting for me.
  4. Removing the first run of 'setGridSize' function above this block seems to work: //console.log('initInputfield'); //console.log($inputfield); //setGridSize($inputfield, size, ragged); << THIS if($inputfield.hasClass('InputfieldImageEditAll') || mode == 'list') { var listSize = getCookieData($inputfield, 'listSize'); setListSize($inputfield, listSize); // runs when 'verbose list' console.log("setListSize ran"); } else { setGridSize($inputfield, size, ragged); // runs when 'square grid images' and 'proportional' console.log("setGridSize ran"); } Work for all views now at my end.
  5. Hmmm, I tried it and it didn't seem to fix What I noticed is that when I save the page, the image starts at the correct previous size, then resizes a fraction of a second later to a smaller version, so I: setGridSize($inputfield, size, ragged); if($inputfield.hasClass('InputfieldImageEditAll') || mode == 'list') { var listSize = getCookieData($inputfield, 'listSize'); setListSize($inputfield, listSize); console.log("setListSize ran"); } else { setGridSize($inputfield, size, ragged); console.log("setGridSize ran"); } ...and the output showed that this runs twice (I never noticed it runs before the if block).
  6. So I looked into this a bit but I'm way over my head staring at the /wire/modules/Inputfield/InputfieldImage js file. What I did notice was that after I dragged the slider fully to the right, the left column is 39% and the right column is 61% (at the bottom). These change depending on the slider value, but both together equal 100% width. When the page is saved, the width of the left column always reverts to 260px wide. I'm having no luck tracking down where this 260px comes from in the first place, so would need someone more experienced to look at this.
  7. Starting to see the point of regions now after playing around with it this morning. Need to keep reminding myself that '_main.php' is the LAST file that is output. This does seem to have (at least) one advantage over my last approach. Namely, I don't have to set '_main' as the alternate template filename anymore for each template. =EDIT= Another thing I've noticed, if you include a file from '_main.php' (which is not a known system template), the include must have... <?php namespace ProcessWire; ?> ...at the top or it doesn't output.
  8. At present, all templates are rendered via '_main.php' but each template that needs to be a rendered page (basic-page, blog-index, blog-entry etc.) uses the alternate template filename instead of '_main.php' being appended. Hence: // _main.php <?php include("./includes/header" . ".php"); ?> <?php include("./views/{$page->template->name}" . ".php"); ?> <?php include("./includes/footer" . ".php"); ?> and the header which is included on every page: <?php namespace ProcessWire; ?> <header> <div class="container"> LOGO, MENU ETC... </div> <?php if ($page->template == "tag-entry") { $title = "Processwire " . strtolower($page->title) . " tutorials"; } elseif ($page->parent->template == "blog-entry") { $title = $page->parent->title; } else { $title = $page->get("altTitle|title"); } ?> <div class="container pt-5 pb-6"> <h1 class="display-3"><?= $title; ?></h1> <?php if ($page->subtitle): ?> <p class="subtitle"><?= $page->subtitle; ?><p> <?php endif; ?> <?php if ($page->template == "blog-entry" && $page->parent->template == "blog-entry"): ?> <p class="date-and-cat"><span>Posted on</span> <strong><?= renderPostDate($page->parent) ;?></strong> <strong><?= renderTags($page->parent); ?></strong></p> <?php elseif ($page->template == "blog-entry" && $page->parent->template == "blog-index"): ?> <p class="date-and-cat"><span>Posted on</span> <strong><?= renderPostDate($page) ;?></strong> <strong><?= renderTags($page); ?></strong></p> <?php endif; ?> </div> </header> So, using another method such as markup regions, not sure how to render this. Maybe something like: // _main.php <?php if ($page->template == "tag-entry") { $title = "Processwire " . strtolower($page->title) . " tutorials"; } elseif ($page->parent->template == "blog-entry") { $title = $page->parent->title; } else { $title = $page->get("altTitle|title"); } ?> <region id="header"> <div class="container pt-5 pb-6"> <h1 class="display-3"><?= $title; ?></h1> <?php if ($page->subtitle): ?> <p class="subtitle"><?= $page->subtitle; ?><p> <?php endif; ?> <region id="date-and-cat"></region> </div> </region> and a blog page for example: // blog-entry.php <region id="date-and-cat"> <?php if ($page->parent->template == "blog-entry"): ?> <p class="date-and-cat"><span>Posted on</span> <strong><?= renderPostDate($page->parent) ;?></strong> <strong><?= renderTags($page->parent); ?></strong></p> <?php elseif ($page->parent->template == "blog-index"): ?> <p class="date-and-cat"><span>Posted on</span> <strong><?= renderPostDate($page) ;?></strong> <strong><?= renderTags($page); ?></strong></p> <?php endif; ?> </region> Not really sure here. I also have include files inside loops and stuff like that. I think my best bet is to start with empty templates and build it up rather than modifying my existing ones which is just confusing me no end. Don't really want to divert this thread too much though.
  9. I think includes() would be faster because it is a function built into php. It's like whatever's in the include file is simply written right into the page. The markup regions have to be processed by PW first to see what goes where, then put it all together for final output. I'm not convinced on markup regions tbh. I'm just not getting how you dynamically change just parts of the regions instead of having to define what goes in the entire region in every template. Maybe just tired! I'll carry on tomorrow.
  10. You're in luck because I just tried this. // _main.php <region id="header">HEADER</region> <region id="main"></region> <region id="footer">THIS IS MY FOOTER</region> ...and a template: // basic-page.php (used to make the /about/ page) <?php namespace ProcessWire; ?> <region id="header"></region> <region id="main"> <div class="container py-5"> <div class="row justify-content-center"> <div class="col-md-8"> <?= $page->body; ?> </div> </div> </div> </region> <region id="footer"></region> Then on a page made with the basic-page template. The header and footer are hidden completely (from view and source).
×
×
  • Create New...