Jump to content

Robin S

Members
  • Posts

    5,039
  • Joined

  • Days Won

    340

Everything posted by Robin S

  1. Just looked at this issue recently. This seems to do the job: $this->addHookAfter('FieldtypeRepeater::wakeupValue', function($event) { $field = $event->arguments('field'); // Only for a particular repeater field // Could also use page argument for other tests if($field->name !== 'my_repeater') return; $pa = $event->return; $pa->sort("-created"); // or whatever sort you want $event->return = $pa; });
  2. Could this go in a linked JS file rather than directly in the template?
  3. Could be you need to increase post_max_size
  4. iOS devices actually handle links with hover states quite well - first touch triggers hover behaviour. For Android/cross-platform check out @bernhard's solution: Using a hash in a link href is not great because it usually triggers a page jump when clicked. Using href="javascript:void(0)" is a bit better, but if you don't actually have an href you should probably be using a button element instead of a link. But my suggestion is if you're using Javascript to trigger your menu then just leave the parent href untouched and use preventDefault() in your Javascript. $('#my_link').click(function(e){ e.preventDefault(); // no page reload // show dropdown menu });
  5. A typical way to do this sort of menu doesn't involve a hash in the parent href, but rather you use CSS to show/hide the nested lists of child pages. li > ul { display:none; } li:hover > ul { display:block; }
  6. How about... foreach($pages->get("/filme/")->children() as $p) { $genres[$p->name] = $p->children("sort=random, limit=2"); } for($i = 0; $i <= 1; $i++) { foreach($genres as $genre) { if($genre->eq($i)) { echo $genre->eq($i)->title; } } }
  7. I'm seeing a layout issue in the default admin theme where tabs are overlapping the breadcrumbs. The "hasWireTabs" class is not added to the body.
  8. The inputfield you choose for your Page field has no impact on how you access the field value using the API. So it's just like any other Page field. The important setting is "Dereference in API as" and this determines whether your field value is a PageArray or a Page object.
  9. @ottogal An easy solution would be to change... [[audio file="LINK"]] ...to... [[audio file='LINK']] If you want Hanna Code Helper to insert single quotes around attributes I think you'll have to modify the module code. Change line 124 to: $attrs .= " $attrName='$attrValue'"; You can use SimpleXML in your Hanna Code to get the href from the link: $a = new SimpleXMLElement($file); $path = $a['href']->__toString();
  10. Not sure why it wouldn't work in your case, but try getting the page by ID instead: $p = $pages->get(1234); This may be something that has changed in PW3, because I found this old post from Soma that suggests you need to add 'include=all' when getting a page by path:
  11. I can get an unpublished page okay with: $p = $pages->get('/path/to/page/'); Are you sure your path/name is correct?
  12. @Michael van Laar, you could use a hook to set the value of the Page field after a new article page is added. In /site/ready.php: $this->pages->addHookAfter('added', function($event) { $page = $event->arguments('page'); if($page->template->name != 'article') return; // your logic here to find the right author ID $page->setAndSave('author', $my_author_id); });
  13. To avoid editing core admin themes you could use the Admin Custom Files module and append to the document title with jQuery: $(document).prop('title', $(document).prop('title') + ' • ProcessWire');
  14. @majake I did a bit of sleuthing and I think your website may be using the Spex module. http://modules.processwire.com/modules/spex/ I don't think this module is very widely used (it doesn't come up often in the forum) so there may not be many members here who can help you with it. But check out the links above and that may point you in the right direction. One more thing - your site seems to already have an RSS feed with the same content you are trying to output: http://www.roofcoonline.com/blog/rss
  15. @majake - I suggest you remove the config info in your previous post for the sake of security. You don't want to be posting your DB username/pass etc in a public forum. A couple of other ways that "main.php" might be appended: 1. The file is pulled in with an include in your RSS template. Probably not as I expect you would have noticed this. 2. It would be unusual, but I suppose the file could be appended in a hook. So you could try this: In your RSS template, insert this: <?php $no_main = true; ?> And at the first line of "main.php" (or whatever the file is called that contains your header/footer markup): <?php if(isset($no_main) && $no_main) return; ?> Edit: actually, could you post the contents of your RSS template file? That will help get to the bottom of the problem.
  16. Hi @majake and welcome to the PW forums. I haven't used this module before, but I think you're right about the problem being related to a "delayed output" strategy. There is probably a template file being auto-appended to your RSS template - typically this would be called "main.php", "main.inc" or something similar. The instruction to auto-append this template file will be in your site config: probably in the /site/config.php file unless your site is using the ProcessWire Config module that stores additional config settings in separate JSON file. If there is a template file being auto-appended you should see a checkbox to disable this for the RSS template: Setup > Templates > rss (or whatever your template is called) > Files tab
  17. Thanks for the confirmation @Zeka. I have created a Github issue and suggested your fix. The problem can be worked around for now using the size() method with cropping set to false. $my_image->size(400,400, array('cropping' => false)); @horst, the weighten feature in PIA is cool.
  18. In the blog post that introduces the $pageimage->maxSize() method, it is described like this: But when I use maxSize() in PW 3.0.37 I do get a cropped image. I have an image that is 1200x600 and if I do $my_image->maxSize(400,400)->url I get an image that is cropped 400x400 when I think it should be uncropped 400x200. Can anyone confirm? I'm sure this method used to work properly as described.
  19. You nearly had it $results = $pages->find("template=name-of-child-template, sort=parent.field-on-parent-template");
  20. A bit off-topic, but have you considered any alternative ways of displaying documentation other than the approach your taking? For instance, it seems like it would be a lot simpler if your documentation pages were displayed on the front-end. What I do for client documentation is this: 1. Create a documentation template. Don't give users edit access to pages using this template. 2. In the template file, perform a check that the user is logged in with the appropriate role, otherwise throw a 404. 3. Create documentation page(s) via the PW admin. I just use a single long page with a table of contents and anchor links but multiple pages would work equally well. 4. Insert links to the documentation page(s) into the admin theme for easy user access. I do this using jQuery via AdminCustomFiles because it's dead simple, but I think a hook would work too.
  21. I tested your issue in PW 2.7.2 and I can't reproduce it. Toggling back and forth between a default view of Rows and Grid updates as expected when the field is inside a repeater. You could consider upgrading to PW3 where images may be deleted from all thumbnail views. Or if you must stay with PW 2.7.2 you could try this module from @BitPoet.
  22. I don't think that's going to work. For starters, you can't use the "Custom PHP" option with Autocomplete. See the field description: Also, the type of dependent select you need only works for select inputfields. You could try having the second Page field use a select inputfield and use this as the "Custom selector": template=committee_event, committee_draft=page.committee_draft, include=all Not sure if dependent selects work with the first inputfield being anything other than a select, but it's worth a try. Edit: it doesn't work - both fields using this type of dependency must use a Select, Select Multiple or AsmSelect.
  23. Besides Repeater and PageTable, there are Table and Multiplier in the ProFields package that can be used for repeating content. But for a simple repeatable text string you could just use a textarea field and explode() on newline to get an array of values. $values = explode("\n", str_replace("\r", '', $page->my_textarea));
  24. If $config->domain is staging.domain.com (it already includes a subdomain) then that makes your httpHosts array resolve as: staging.domain.com, www.staging.domain.com, assets0.staging.domain.com, assets1.staging.domain.com, assets2.staging.domain.com, assets3.staging.domain.com So instead you probably want something like: $config->domain = 'domain.com'; $config->httpHosts = [ $config->domain, "staging.$config->domain", "www.$config->domain", "assets0.$config->domain", "assets1.$config->domain", "assets2.$config->domain", "assets3.$config->domain" ];
  25. Front-end editing works okay for me when using $page->render(). If you are using "Option A" for front-end editing make sure you have selected "Fields editable regardless of page". But a couple of observations: 1. Do you really need to be rendering pages? Can you not just get your pages into a PageArray and iterate over them, echoing the fields you want? $items = $pages->find("template=my_template"); foreach($items as $item) { echo "<h3>$item->title</h3>"; echo $item->body; // etc } If you're sure you need to render you might be better off using $files->render() as it is better documented than $page->render(). 2. In your code... ...you are overwriting the core API $modules variable. You should choose a different name for your variable.
×
×
  • Create New...