-
Posts
5,039 -
Joined
-
Days Won
340
Everything posted by Robin S
-
@adrian, Thanks! So quick and the new commit works great. Actually, the title was working properly for me (video title was saved to image description field). Although not now with the new commit because I guess you have removed the code for that while you look at implementing something different.
-
I'm trying this module for the first time but get an error when the module attempts to grab the thumbnail. Same error on localhost and live server. PW 2.7.3 All module settings are at their defaults apart from specifying template to search, URL field and images field. My URL field: Error message is When opening the URL of the thumbnail the module is trying to grab from it looks like this size does not exist. It seems the largest available size is: http://img.youtube.com/vi/NIMgEEASoWQ/hqdefault.jpg But is it correct that with the default settings the module is meant to check for the largest available thumbnail and grab that? Edit: another issue is the one Pete raised previously about selecting an image field to hold the thumbnail - if that field has a limit (e.g. 1 image) the limit is ignored. My preference here would be to follow the admin behaviour and replace the existing image. And folks can just have the sense not to check "All available" if they have chosen to use a limited image field.
-
@slave: I didn't notice your produktkategorie pages are not direct children of Home. Try making a PageArray of your menu items and giving that to MSN as the root argument. <?php $nav = $modules->get("MarkupSimpleNavigation"); // load the module // make PageArray of your menu items $menu_pages = $pages->find("template=produktkategorie")->prepend($pages->get("/")); echo $nav->render(null, null, $menu_pages); // render the menu ?>
-
@slave <?php $nav = $modules->get("MarkupSimpleNavigation"); // load the module // set options $nav_options = array( 'show_root' => true, 'selector' => 'template=produktkategorie' ); echo $nav->render($nav_options); // render the menu ?>
-
Many thanks!
-
My project has a page that I want to store archived versions of. This isn't for version control or anything like that - it's just a page that gets regularly updated and visitors should be able to browse the previous versions of it. So my idea is to have a page structure like this: My PageMy Page - 16 April 2016 My Page - 9 April 2016 My Page - 28 March 2016 The top "My Page" just pulls in the content from the most recent child page and then displays a list of links to all children but the most recent. To create a new version of the page an editor will create a new child of "My Page". But I don't want them to have to enter a page title - the title should always be "My Page - [creation date]". I hadn't had reason to use the "Name format for children" template option before and I thought it was going to be the solution. But now I see that it just sets the name and not the title of child pages. Which puzzles me a bit. Is this option mostly intended for if you change Title to be non-global and then remove it from the template? Wouldn't it be better if this option automatically set the title rather than the name and then derived the name from the title as per normal? Anyway, main question: is there something I can hook into to either Fill out the title field in the first step of the Add New page process (and ideally make it non-editable by the user) Or fill out the title field in the second step of the Add New page process. Then I can skip the first step via the "Name format for children" option and set the title field visibility to locked so it's not editable. This might be the better option.
-
@cstevensjr: Do you always use the same URL or is it different for every site you develop? If it's different do you have a method for deciding what to use for the admin URL? BTW, I'm not requesting you reveal a real admin URL here.
-
Every time I do a new PW install I pause at the Admin Login URL field and wonder if I should be doing something here to improve security. My thinking goes like this: I'd like to place some sort of obstacle to discovering the admin URL to keep out nosy-parkers and casual abusers. But I don't want to make things unnecessarily difficult for my editors, who shouldn't have to hunt out the URL or end up stuck if they need to edit the site on a device that doesn't have the admin URL bookmarked. In other words, it has to be something that can be remembered by a normal mortal. In the end I just stick with the default /processwire/ URL because it seems a good trade-off in that it's not as obvious as /admin/ but is memorable. Also, it's a word that isn't a household name to the wider public but familiar to an editor has been working with the site for a while and looking at the PW logo in the admin banner. Is there a best-practice around setting the admin URL? What are others of you doing with this? Is anyone setting admin URLs like /84tpt28hgs5y/ ?
-
I've also wondered this, and I think it would be good to have an option in the module config to disable Ace so it can be removed altogether for those who would prefer this. The Code tab for all my hannas looks like this: <?php include($config->paths->templates . "hannas/my_hanna_code.php"); ...because I much prefer to edit hanna codes in my IDE. So I don't really need Ace bundled into the module.
-
Fair enough. Looking a bit closer at the native edit modal I see that the normal Save button is hidden and a replacement Save button is rendered as part of the modal frame. I don't see how that could work with a 2-step page creation process. And keeping the modal open for errors is something I hadn't considered - it's actually a bit of a shortcoming of the native edit modal, which closes without displaying required field warnings, etc.
-
The latest update to this module is really great. I notice that when adding a new page in the modal window the "Save" button does not close the modal like it does when using the native modal page edit feature (for AsmSelect). Could the Save button action be consistent with the native modal edit Save action, or do you think it's better to keep the modal open after save for newly added pages?
-
Intermediate template structure without string concatenation
Robin S replied to Pete Jones's topic in API & Templates
My preference is to use output buffering. Works great with IDE completion, matching, etc. <?php ob_start(); // $band1_content ?> <div class="w-container inset-container tabs filter-options"> <a class="w-inline-block pr-tabs" data-group=""><div class="pr-tabs-text">All</div></a> <a class="w-inline-block pr-tabs" data-group="<?= $pages->get(1015)->name ?>"><div class="pr-tabs-text blue"><?= $pages->get(1015)->title ?></div></a> <a class="w-inline-block pr-tabs" data-group="<?= $pages->get(1016)->name ?>"><div class="pr-tabs-text blue"><?= $pages->get(1016)->title ?></div></a> <a class="w-inline-block pr-tabs" data-group="<?= $pages->get(1017)->name ?>"><div class="pr-tabs-text blue"><?= $pages->get(1017)->title ?></div></a> </div> <?php $band1_content = ob_get_clean(); ?>- 13 replies
-
- template
- intermediate
-
(and 1 more)
Tagged with:
-
I think maybe you mean not being able to use pagination when using results not directly from a single find query. And I believe that's true - if you build a PageArray in memory like $notViewed in gebeer's example then you can't use the pagination module on it out-of-the-box. But there are solutions. Do a find query on your PageArray IDs like this: $pages->find("id=$notViewed, limit=10, sort=-created"); Or check out Soma's techniques here.
-
You don't need to do anything different with your CSS than you would do on a static website - that goes for the MSN module, any PW module and PW in general. Your CSS just sits in a file linked in the <head> of your template. If I understand correctly you had an HTML page "start.html" and in PW you have successfully added a template "start" associated with template file "start.php". Lets use a simplified example and say start.php looks like this... <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title><?= $page->title ?></title> <link rel="stylesheet" href="/site/templates/css/mystyles.css"> </head> <body> <ul> <li><a href="/page-1/">Page 1</a></li> <li><a href="/page-2/">Page 2</a></li> <li><a href="/page-3/">Page 3</a></li> </ul> <?= $page->body ?> </body> </html> ...and that unordered list is your menu. Let's also assume you have added those 3 pages to your PW website via the admin. Now you want to replace the static menu with a dynamic menu generated by MSN. You replace the menu markup with the call to MSN. No options are needed because your menu markup doesn't have any classes or anything not generated the MSN default. <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title><?= $page->title ?></title> <link rel="stylesheet" href="/site/templates/css/mystyles.css"> </head> <body> <?php $nav = $modules->get("MarkupSimpleNavigation"); // load the module echo $nav->render(); // render default menu ?> <?= $page->body ?> </body> </html> But suppose your static menu does have some classes and also an item for the Home page. <ul class="main-menu"> <li class="menu-item"><a class="menu-link" href="/">Home</a></li> <li class="menu-item"><a class="menu-link" href="/page-1/">Page 1</a></li> <li class="menu-item"><a class="menu-link" href="/page-2/">Page 2</a></li> <li class="menu-item"><a class="menu-link" href="/page-3/">Page 3</a></li> </ul> Now you do need to set some options for MSN. <?php $nav = $modules->get("MarkupSimpleNavigation"); // load the module // set some options $nav_options = array( 'show_root' => true, 'outer_tpl' => '<ul class="main-menu">||</ul>', 'list_field_class' => 'menu-item', 'item_tpl' => '<a class="menu-link" href="{url}">{title}</a>' ); echo $nav->render($nav_options); // render the menu ?> Get the idea? So if you were using a bootstrap menu in your static website then you just need to use the MSN options array (and occasionally a hook if you have some more unusual markup) to tell MSN to generate the markup you want.
-
Module: AIOM+ (All In One Minify) for CSS, LESS, JS and HTML
Robin S replied to David Karich's topic in Modules/Plugins
A feature request: Sass support (specifically SCSS). Thanks! -
A couple of requests to make working with templates in Admin more streamlined: 1. Display the "Label" field in the "New Template" screen - I always like to label my templates and currently this requires you to re-open the template you have just created. Also, I'd rather have the template screen remain open after adding a template rather than be sent back to the Templates overview. These changes would make the "New Template" process more consistent with the "New Field" process. But of course the likely reason for no Label field and the closing of the template screen is because it's actually "New Templates" plural not "New Template" singular. Myself, I've never felt the need to add multiple templates at once but I expect others do. Maybe "New Template" and "New Templates" could be separate commands? 2. When duplicating a template (Add New Templates > Duplicate fields used by another template) it would be nice if field overrides (widths, descriptions, etc) were included in the new template(s). It can be quite time-consuming to set these up, and if you are duplicating fields of an existing template I think you also want to duplicate the overrides more often than not.
- 3 replies
-
- 12
-
-
Module Visual Page Selector (commercial page picker module for ProcessWire)
Robin S replied to kongondo's topic in Modules/Plugins
Would you mind making the README available to prospective purchasers? Likewise the README for Media Manager? -
For images in an images field, you can create any sizes you need via PW's native resizing methods. For images inside an RTE field you can use a textformatter module. The idea would be to detect images in the RTE block and replace them with your own custom srcset markup. The Image Interceptor module is a good one to look at if you want to get ideas for a custom module. But there is already the TextformatterImageSRCSET module ready to go. And also check out the ImageToPicture module.
-
Rather than define a parent for selectable pages in your page field, try the "Custom PHP code to find selectable pages" option... return $pages->find("parent=/clients/{$this->user->name}/categories/");
-
@BitPoet: Incidentally, one reason I thought a sister "Page Child Templates" module would be useful is that it avoids any potential difficulties there might be in extending the "Add New" feature (which normally requires allowed templates to be configured for both parent and child templates, although it's not clear to me why the parent template restriction on children is logically necessary for this feature). If it were possible to specify for a given page what template(s) may be used for child pages then the Page Add Bookmarks feature could be used in place of the original "Add New" feature. The Page Add Bookmarks feature just adds a page under a given parent in the tree, but if a "Page Child Templates" module has locked down allowed templates for that parent then you have a pretty foolproof substitute for "Add New" without having to add extra unnecessary templates for those parent pages. My understanding of the relationships required is pretty limited, but looking at your code for the Template Parents module it looks like it could be adapted for a Page Child Templates module. The way I imagine it working is that for any page that has allowed templates for children configured, the module stores a row in a database table containing allowed template IDs for that page ID. Then when a new page is added, the filterAllowedParents function hooked to ProcessPageAdd::getAllowedTemplates filters the list of allowed templates according to any template IDs that are stored for the new page's parent page ID. But I might be overlooking some complexity here. I'll probably have a tinker with your Template Parents module to see if I can adapt it myself but I'm a bit of an amateur.
-
Loving this module - perfect for a site I'm currently developing. Just noticed a bug: allowed parents selected from Setup > Templates > Edit Template are not saved successfully (no selection is saved). Allowed parents selected from Setup > Template Parents are saved okay. Another thought: how about a sister module for Template Parents, "Page Child Templates"? So for any page you can define allowed templates that may be used for child pages. Now I'm just being greedy
-
I'm thinking of the same "Add New" functionality you get when you use the core "Allowed template(s) for parents" + "Allowed template(s) for children" + "Show in the add-page shortcut menu" options. It lets you add a new page of a particular template in one step because PW "knows" where in the tree a page of that template is allowed to go. In theory this functionality could also apply to templates with a parent page restriction defined with your module, but I'm not sure how difficult it would be to extend the Add New functions to allow for this.
-
Thanks for the replies. @elabx: Yeah, I'm already doing a similar workaround using the ->not method. $page_array_1 = $pages->find(selector_1); // do some stuff with $page_array_1 $page_array_2 = $pages->find(selector_2); // do some stuff with $page_array_2 // then to subtract $page_array_1 from $page_array_2... $page_array_2->not(selector_1); But it seems wrong to have to use the same selector again when you already have the PageArray you want to remove. I figured there has to be a better way... ...and there is, but it's not in the docs or cheatsheet. Thanks BitPoet.
-
There is a remove method for WireArray/PageArray that removes a single given item from the array. But how about removing all the items in one PageArray from another? So basically like PHP's array_diff for PageArray - any suggestions for this?
-
BitPoet, many thanks for this module! When attempting to go to the settings page for Template Parents Process in PW v2.7.2 I get an error: "Undefined index: inheritSettings in ...\site\modules\TemplateParent\ProcessTemplateParents.module on line 232" Also, do you think there's a way to have templates that have been given a parent page restriction with this module appear in the "Add New" menus?