-
Posts
5,008 -
Joined
-
Days Won
333
Everything posted by Robin S
-
That's the organisation pricing. You're an individual customer so it's $89. And you don't need to pay anything beyond that. See the license details. The ongoing "subscription" is if you want to receive updates (sort of like the system with Ryan's Pro modules), but the reality is that an IDE is a glorified text editor - it's not like they're bringing out must-have new ways to edit text every other month. So you'll be fine with the current version for some years to come.
-
Hi @adrian, What do you think about the idea of adding a filter search to the Captain Hook panel? Much of the time when I use this panel I know the name of the class and method I want to hook and I'm just wanting to check what the arguments are (and it's a handy way to jump to the method in my editor). Not sure how tricky that would be to implement. Even if it just worked on the top level (the file names) it would be cool.
-
Welcome to the forums @Smoo. The markup is the content, but if you are seeing tags rendered like that then it could be caused by encoded entities. Check to make sure you do not have "HTML Entity Encoder" selected under "Text Formatters" in the field settings.
-
FieldsetTab is not supported by the core "show if" dependency, but it turns out it is possible to support it in this module. Please update to v0.0.5.
-
Perhaps some exception or PHP error is occurring. Do you have debug mode on or (even better) Tracy Debugger installed to make sure you see error messages?
-
Let's do a comparison of how you would do this with the typical delayed output approach vs Markup Regions. When it comes to the Markup Regions example I'll do it a little differently than you've proposed it, with a dedicated <region> for scripts instead of appending to <head>. Delayed output _init.php $scripts = ''; _main.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <?= scripts ?> </head> //... template-which-needs-js.php if(strpos($page->name, 'special') === 0) { $scripts .= "<script src='{$config->urls->templates}assets/js/my-script_2.js'</script>"; } else { $scripts .= "<script src='{$config->urls->templates}assets/js/my-script_1.js'</script>"; } Markup Regions _init.php Nothing needed here because one of the nice things about Markup Regions is that you don't need to initialise a markup variable. _main.php <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <region id="scripts"></region> </head> //... template-which-needs-js.php <region id="scripts" pw-append> <?php if(strpos($page->name, 'special') === 0): ?> <script src="<?= $config->urls->templates ?>assets/js/my-script_2.js"></script> <?php else: ?> <script src="<?= $config->urls->templates ?>assets/js/my-script_1.js"></script> <?php endif; ?> </region> So comparing a markup region to a variable: Use pw-append where you would have used $some_var .= 'something' Use pw-prepend where you would have used $some_var = 'something' . $some_var Use neither pw-append nor pw-prepend where you would have used $some_var = 'something' But Markup Regions are even more powerful because you can have multiple nested markup regions in _main.php, which is something you cannot do with variables.
-
Pretty sure that's just a typo, and should read "This does the same as above". You can do anything with Markup Regions that you can do with the typical delayed output approach. Each markup region serves the same purpose as some variable that you would put markup in and output in _main.php, like $sidebar or whatever. There are a few ways. Here is one... _main.php (just showing the main content part - of course there will be <head>, footer, etc in this file too) <region id="main-content"> <region id="top"> <div class="full-width-coloured-bg"> <div class="container-1400px"> <div>SOME STUFF IN A CONTAINER</div> </div> </div> </region> <div class="container-1400px"> <div class="row"> <div class="col-10"> LEFT SIDE </div> <div class="col-2"> SIDEBAR </div> </div> </div> </region> basic-page.php This file can be empty because _main.php is based on the markup needs of basic-page. But until this bug is fixed you might want to include some dummy region in basic-page.php or else the Markup Regions parser won't be triggered and <region> tags in _main.php will not be removed. home.php <region id="main-content"> <div class="container-1400px"> <div>SOME STUFF IN A CONTAINER</div> </div> </region> services-page.php <region id="top"> <div class="full-width-coloured-bg"> <div class="container-1400px"> FULL WIDTH STUFF </div> </div> <div class="container-1400px"> <div>SOME STUFF IN A CONTAINER</div> </div> </region>
-
Just a heads up regarding a possible fix posted in the GitHub issue: https://github.com/processwire/processwire-issues/issues/411#issuecomment-340139239
-
I whipped up a module for this:
-
In response to a wishlist request... Field Save + Add New Adds a "Save + Add New" button when editing a field. Usage Install the Field Save + Add New module. When editing a field, click "Save + Add New" if you want to save the current field and start the process of adding a new field. Note: The button will not redirect you to "Add New" if you are performing some special action such as duplicating a field or adding a field to a template. https://github.com/Toutouwai/FieldSaveAdd/
-
I agree with @abdus that field rendering is the solution. But if you're just wanting a tidier way of doing what you are already doing then you can rewrite it as: <?php foreach($foos as $foo): ?> <div class="foo"> <h1 class="foo__title"> <a href="<?= $foo->url ?>"><?= $foo->title ?></a> </h1> <?php if($page->headline): ?> <h2 class="page__headline"><?= $page->headline ?></h2> <?php endif; ?> </div> <?php endforeach; ?>
-
@SamC, I don't entirely follow what you are saying, but here are a few things that might help. 1. You can remove elements in _main.php by using "pw-remove" in a template file. _main.php <div id="main"> FULL WIDTH OR SIDEBAR IN HERE </div> <div id="sidebar"> THE SIDEBAR </div> basic-page.php <!-- Remove #sidebar --> <div id="sidebar" pw-remove></div> 2. You can have as many nested ID'd or region elements in _main.php as you like, and then modify/replace any of them from your template. _main.php <region id="main"> <div class="container"> <div id="main"> FULL WIDTH OR SIDEBAR IN HERE </div> <div id="sidebar"> THE SIDEBAR </div> </div> </region> home.php <div id="sidebar"> <p>Just customise the sidebar.</p> </div> basic-page.php <region id="main"> <div class="container"> <p>Use a completely different #main on this template.</p> </div> </region> 3. The three blog posts about Markup Regions can be a bit confusing because the spec changed as the feature was developed and none of the posts cover the entire set of available keywords and syntax. Check out the comments in WireMarkupRegions.php for a more comprehensive spec. /** * Identify and populate markup regions in given HTML * * To use this, you must set `$config->useMarkupRegions = true;` in your /site/config.php file. * In the future it may be enabled by default for any templates with text/html content-type. * * This takes anything output before the opening `<!DOCTYPE` and connects it to the right places * within the `<html>` that comes after it. For instance, if there's a `<div id='content'>` in the * document, then a #content element output prior to the doctype will replace it during page render. * This enables one to use delayed output as if it’s direct output. It also makes every HTML element * in the output with an “id” attribute a region that can be populated from any template file. It’s * a good pairing with a `$config->appendTemplateFile` that contains the main markup and region * definitions, though can be used with or without it. * * Beyond replacement of elements, append, prepend, insert before, insert after, and remove are also * supported via “pw-” prefix attributes that you can add. The attributes do not appear in the final output * markup. When performing replacements or modifications to elements, PW will merge the attributes * so that attributes present in the final output are present, plus any that were added by the markup * regions. See the examples for more details. * * Examples * ======== * Below are some examples. Note that “main” is used as an example “id” attribute of an element that * appears in the main document markup, and the examples below focus on manipulating it. The examples * assume there is a `<div id=main>` in the _main.php file (appendTemplateFile), and the lines in the * examples would be output from a template file, which manipulates what would ultimately be output * when the page is rendered. * * In the examples, a “pw-id” or “data-pw-id” attribute may be used instead of an “id” attribute, when * or if preferred. In addition, any “pw-” attribute may be specified as a “data-pw-” attribute if you * prefer it. * ~~~~~~ * Replacing and removing elements * * <div id='main'>This replaces the #main div and merges any attributes</div> * <div pw-replace='main'>This does the same as above</div> * <div id='main' pw-replace>This does the same as above</div> * <div pw-remove='main'>This removes the #main div</div> * <div id='main' pw-remove>This removes the #main div (same as above)</div> * * Prepending and appending elements * * <div id='main' class='pw-prepend'><p>This prepends #main with this p tag</p></div> * <p pw-prepend='main'>This does the same as above</p> * <div id='main' pw-append><p>This appends #main with this p tag</p></div> * <p pw-append='main'>Removes the #main div</p> * * Modifying attributes on an existing element * * <div id='main' class='bar' pw-prepend><p>This prepends #main and adds "bar" class to main</p></div> * <div id='main' class='foo' pw-append><p>This appends #main and adds a "foo" class to #main</p></div> * <div id='main' title='hello' pw-append>Appends #main with this text + adds title attribute to #main</div> * <div id='main' class='-baz' pw-append>Appends #main with this text + removes class “baz” from #main</div> * * Inserting new elements * * <h2 pw-before='main'>This adds an h2 headline with this text before #main</h2> * <footer pw-after='main'><p>This adds a footer element with this text after #main</p></footer> * <div pw-append='main' class='foo'>This appends a div.foo to #main with this text</div> * <div pw-prepend='main' class='bar'>This prepends a div.bar to #main with this text</div> * * ~~~~~~
-
Bug in default image grid mode: vertical list (verbose)
Robin S replied to SamC's topic in General Support
Yes, the suggested fix in the GitHub issue is to replace the all the code in the "problem" block with the code in the "fix" block. -
That's an 11MB page you have there! And just wondering: how come the map is an image (2MB alone) instead of a real map?
-
Bug in default image grid mode: vertical list (verbose)
Robin S replied to SamC's topic in General Support
That's actually a different issue with a different cause. But I think I've found fixes for both issues. The new issue is here: https://github.com/processwire/processwire-issues/issues/419 -
I tested with the core Checkbox fieldtype. You can check the fieldtype by opening the field (Setup > Fields > Your field) and looking in the Type dropdown. Not sure why it wouldn't work for you, but there is no real harm in just sticking with what you are doing (combining two PageArrays together) unless you have a huge number of children.
-
You might find it easier to debug this and get it working by using a PW page to respond to your AJAX requests. So you create a template named "web-service" (for example) and put the code above into the template file (minus the bootstrapping line). Then create a page named "web-service" that uses this template and use this page's URL in your AJAX request. You might be able to get pagination working simply by enabling pagination for the template, or you might need to get the page number using the API and use it in conjunction with the "limit" to get the "start" for your selector. I haven't tried AJAX pagination myself.
-
Displaying the most recent blog posts using different layouts for each
Robin S replied to mike62's topic in Getting Started
You should check out the keyword search feature in your browser. https://support.google.com/chrome/answer/95426 http://kb.mozillazine.org/Using_keyword_searches -
This is known as duplicate content and you want to be careful with this to avoid harming your SEO. Have a read of Google's guidelines: https://support.google.com/webmasters/answer/66359?hl=en https://support.google.com/webmasters/answer/139066 But if you want to show all the content from one page on another, one simple solution is to add a Page Reference field to your template. Then at the top of the template file: if($page->page_reference->id) $page = $page->page_reference;
-
https://github.com/ryancramerdesign/skyscrapers2 This repo is from Ryan and it consists of the template files used in the Skyscrapers v2 demo site. There is no data with it and it is not an installable site profile. https://github.com/dadish/pw-skyscrapers-profile This repo is from @Nurguly Ashyrov and is a complete installable site profile, including the skyscrapers data and required modules. It was made by combining the data from the old v1 Skyscrapers profile with the v2 templates. The creation of the profile is mentioned in this video: https://github.com/ryancramerdesign/SkyscrapersProfile
-
Hi @abdus, Do you know if it's possible to use this technique to add config fields such as minWidth and maxWidth to the template context for InputfieldImage? My first attempt isn't working: // Add more image config fields to template context $this->addHookMethod('InputfieldImage::getConfigAllowContext', function (HookEvent $e) { $allowables = ['minWidth', 'minHeight', 'maxWidth', 'maxHeight']; $e->return = array_merge($e->return, $allowables); }); I have a feeling that the reason this doesn't work is because those config fields are inside a fieldset. Adding the whole fieldset would be fine, but the problem is that the fieldset doesn't have a name to add to getConfigAllowContext(). Any ideas? ----- EDIT: have sussed it out. I used another hook to give names to those fieldsets. // Give names to image config fieldsets $wire->addHookAfter('InputfieldImage::getConfigInputfields', function(HookEvent $event) { /* @var InputfieldWrapper $wrapper */ $wrapper = $event->return; $f = $wrapper->getChildByName('maxWidth'); $fieldset = $f->parent; $fieldset->name = 'maxDimensions'; $f = $wrapper->getChildByName('minWidth'); $fieldset = $f->parent; $fieldset->name = 'minDimensions'; }); // Add more image config fields to template context $this->addHookMethod('InputfieldImage::getConfigAllowContext', function (HookEvent $e) { $allowables = ['maxDimensions', 'minDimensions']; $e->return = array_merge($e->return, $allowables); });
-
For a proper draft/approval workflow there is ProDrafts. But for a simple system you can just use Lister (Pages > Find) to show unpublished pages.
- 1 reply
-
- 3
-
-
- approval
- moderation
-
(and 1 more)
Tagged with:
-
Have narrowed down when the issue occurs. There are two conditions needed to observe the problem: 1. A page using a template containing a repeater is created via the API and is never edited and saved in admin. This means that the parent page of the repeater items under Admin > Repeaters > repeater_field is not yet created. 2. A new repeater item is added via the API to the page created in step 1. When the parent page is created to hold the repeater item, Page Rename Options attempts to rename the parent page but this is not allowed because the parent uses a system template. The existing test for system templates in Page Rename Options fails because the page ID is 0 at this point. The fix goes here, changing a check for $p->id to $p->template: // $p->template check is because it is not available for ProcessPageAdd if($p->template && $p->template->flags & Template::flagSystem) return false; // exclude system templates eg. users etc
-
There is a little error in your hook code: //... $field = $event->object; $href = $this->config->urls->admin.'page/add/?parent_id='.$page; $field = $this->modules->get('InputfieldButton'); //... In this hook, the event object is ProcessPageEdit, not a field. And you also overwrite $field two lines below. Rather than removing the existing button and adding a new one, you can change the text of the existing button. Here is another way it could be done: $wire->addHookAfter('ProcessPageEdit::buildFormChildren', function(HookEvent $event) { $form = $event->return; // The InputfieldWrapper on the "children" tab $ppe = $event->object; // ProcessPageEdit $page = $ppe->getPage(); // ProcessPageEdit contains a method to get the page being edited if(in_array($page->template->name, ['event_events', 'event_dates', 'event_businessvacations', 'event_specialbusinesshours'])) { $button = $form->getChildByName('AddPageBtn'); // Get the button if($button) $button->value = 'Add new event'; // Change the text } });
-
I just installed the module brand new today. The latest version in the directory is 1.0.1.