Jump to content

kongondo

PW-Moderators
  • Posts

    7,480
  • Joined

  • Last visited

  • Days Won

    146

Everything posted by kongondo

  1. Following up on my post above...Say you wanted to embed a YouTube video...for whatever reason...in the page edit context.. <iframe width="420" height="315" src="https://www.youtube.com/embed/Bohhf3aK8gU" frameborder="0" allowfullscreen> </iframe> That's it!
  2. Aah, I see. That's a cool usage of the module you got there! . Using wireRenderFile() keeps the module's input clean, circumvents limit of text allowed in that field plus makes the module much more versatile. One can do all sorts of flexible includes from within the file rendered by wireRenderFile(), depending on the context. I have tested and it works fine here creating a new page (see below). Cloning a page on the other hand leads to a cyclical error (or memory issue) and crashes Apache. In details tab of this module I have: return wireRenderFile('test'); In /site/templates/test.php $out =''; $f = $modules->get("InputfieldText"); $f->label = "Copy Title";// @note: doesn't seem to work $f->attr('id+name','name'); $f->required = 1;// @note: -ditto- $out= $f->render(); // append the field to the form // oh a submit button! $f = $modules->get("InputfieldSubmit"); $f->attr("value","Create Copy"); $f->attr("id+name","createcustomcopy"); $out .= $f->render(); $currentPage = ''; $process = wire('process'); if($process && $process->className() == 'ProcessPageEdit') $currentPage = $process->getPage(); if(!$currentPage) return; echo $out; // let's create a copy $copy = $input->post->createcustomcopy; $title = $sanitizer->text($input->post->name); if($copy) { if(!$title) { $this->error('You need to specify a title for the copied page!'); return; } $p = new Page(); $p->template = $templates->get($currentPage->template); $p->parent = $currentPage->parent; $p->title = $title; //sanitize and convert to a URL friendly page name $p->name = $sanitizer->pageName($p->title); //check if name already taken within same parent. if the same name exist, don't create a new copy // @note; without this line pages were being created in duplicates if($p->parent->child("name={$p->name}, include=all")->id) return; else { $p->save(); $this->message('Created a copy of the page with the title: ' . $title); } }
  3. @BernhardB, You should be getting a couple of errors with that code (if you have debug on). In that context, PW doesn't know what $modules and $input are (see similar issues on page 1 of this thread). You need to use $this-> or wire('modules'). Secondly, the module will only return a string or integer. You need to save string/integer output in a variable (e.g. $out) and return $out;
  4. Hi Mario, Welcome to ProcessWire and the forums. Currently, that's not possible but it is something I've been thinking about. Please see the post above yours. There's no ETA for this at the moment. Meanwhile, you can try this. Edit: Even with the addition of 'extra attributes' such as data-xxxx, it will still not be possible to have both the inner <div> and inner <ul>, unless you try the solution I linked to above if you still want to use Menu Builder for this.
  5. Hi Jakob, That's not possible currently but you could do a pre_match on $blog->renderPosts($page) to remove the link...Sorry, short on time and can't give an example at the moment...
  6. Yeah, it needs to be refreshed (the button, i.e.)... You can use JS for that. Which reminds me, This module comes with an empty InputfieldRuntimeMarkup.js...in which I foolishly state: ...as if those wouldn't be overwritten on the next upgrade, grrr! Anyway, I will either let the module check for and if found include an 'InputfieldRuntimeMarkupCustom.js', which won't get overwritten on upgrades, or simply, I will ship the module without a 'InputfieldRuntimeMarkup.js' (and without a 'InputfieldRuntimeMarkup.css' as well). In that case, PW will autoload those files if found and they'll never get overwritten. So, to your solution. Add the following to your 'InputfieldRuntimeMarkup.js': @note: I added an id="archives" to your button $(document).ready(function(){ $('button#archives').on('click', function(){ //refresh button (remove 'ui-state-active') (only needed for default theme) $(this).button().button('refresh'); }); }) The code could probably be optimized to only run if default admin theme is in use. Maybe could even be used inline but this is cleaner. Maybe there's better solutions as well. The blue (on Chrome) outline around the button can be removed using CSS.
  7. It should work (@adrian) but for some reason the modal quickly closes, so something on PW side doing that. Maybe @adrian used fancybox or something else and you are calling modal.js? I have no idea really. @adrian, thoughts? Thanks.
  8. Obviously I don't get the full picture but a couple of things come to mind.. Use IDs to log duplicates? At review stage, use limit and pagination to get listings in batches (i.e. don't get all the 5K children!), ordered by surname or other criteria that will ensure duplicates appear on the same list then do whatever...?
  9. Hi Chris, Welcome to the forums. In addition to what @adrian said, I am wondering why you can't check for and reject duplicates at the point of creation? If listings are pages and they all share a single parent (id #1070) and they are created by users, you should be able to reject listings when they are being created...Something like: $p = new Page(); $p->title = $sanitizer->text('Some Title'); $p->parent = $pages->get(1070); $p->template = $templates->get('listing'); $p->surname = $sanitizer->text($l);// or however you sanitize if($p->title) $p->name = $sanitizer->pageName($p->title);//sanitize and convert to a URL friendly page name //check if name and surname already taken within same parent if($p->parent->child("name={$p->name}, surname= $p->surname, include=all")->id) { // if the same name and surname exist, don't create the listing page $msg = 'That listing already exists'; } else { $p->save(); $msg = 'Successfully created listing'; } echo $msg; This way, you will never have duplicates. What about shared surnames?
  10. This gave made me chuckle. Pun intended? Moth => light, LoL Lovely site, very snappy. How are you handling the data, each moth is page?
  11. Sorry haven't had time to test yet; please clarify...apart from the 1 issue you mentioned a couple of posts up, this should work just fine in PW 2.7.x? Thanks.
  12. Or maybe we just wait for 'Media Manager' ...could save us a few brain cells, huge folders and a couple of monkeys at the zoo will be the merrier... The person developing MM...(I know him/her from the forums) has recently told me it should be out for sale very soon. Fingers crossed...
  13. Yeah, you do need to read up on get() and find() and the lot... What you statement is saying is this: Go and get the page 'url-one' If you got that page, echo one.css Else (if you didn't get the page 'url-one') echo two.css Pausing for a moment, do you see where your mistake is? ...As long as you have a page called 'url-one', $styleSwitcher will always be true irrespective of which page is currently being viewed and one.css will always get loaded. What you really want is to check if the current page (being viewed) has a url that is equal to the page 'url-one' URL. You haven't done that in your conditionals/logic. That's what you are missing. Quick tip: sometimes it is best to write down the logic you are after in 'plain language/word form' and the translate that to code. OK, I think I've given you enough hints to get you going....I'm trying to help you to learn. If you get stuck, let us know and we'll help
  14. Definitely a CSS issue. (blog.css). Keep in mind thought that blog.css as well as the blog-xxxx.php template files that come with Blog are all demos just to get you started. In those demos I use pocketgrid.css which will apply a float:left to all divs with the class 'block'. If you wish to use the demo files, you will need to adjust your CSS to use whatever CSS framework you are using as well as check that all the code in the template files apply to your particular need..
  15. @_NameLess_, Please go ahead and file an enhancement/bug request for this, thanks.
  16. Check or prevent? If prevent: $u = new WireUpload('files'); $u->setValidExtensions(array('pdf','xps','pptx')); // etc..
  17. Hi @holmescreek, Welcome to ProcessWire and the forums. You might want to have a read here first about various approaches to categorising site content. I have only had a quick glance at the PDF. I notice you are creating the ABBA page directly under POP then also having the possibility to select POP (the parent page) within ABBA. That's not the 'usual' way we got about this. What would work best is something like this (page tree): Genres (template genres) Pop (template genre) Foreign Rock Artists (template artists) ABBA (template artist) U2 Rolling Stones Then, in the template artist (for individual artists), add a page field of type multiple, called, for example, genres. In the page field genres, in template of selectable pages, set that to 'genre'. Then, in your artist pages, say when editing ABBA, you can choose all the genres you want for the band, e.g. 'Foreign' and 'Pop'. In the front-end end you can then do something like: // grab all pop bands (if many, you may want to place a limit and use pagination) $pop = $pages->get('/genres/pop/'); $artists = $pages->find("template=artist, genres=$pop"); // or, if users are viewing the POP page $artists = $pages->find("template=artist, genres=$page"); Of course, it is possible to search for multiple genres in a single query. See the selectors' docs here. This type of organisation keeps duplicity to a minimum.
  18. For questions specific to MarkupLoadRSS, please ask them at the module's support board here.
  19. This looks awesome @adrian, thanks! I've just a quick glance, could this do breakpoints and step-throughs as well or its more of a logger?
  20. @jtborger, You are not wasting anyone's time. The fact of the matter is that overall, there is still a lot of room to improve ProcessWire's documentation and tutorials across a range of topics spanning both basic and advanced stuff. It is something we are aware of and are keen to improve. Part of the Road Map for 2016 is exactly that...'continued and greater focus on documentation and tutorials'. Of course this does not mean everything will be done and dusted by the end of play 2016 but there should be some positive advances nevertheless. Whilst there are some great examples in the forums regarding various uses of the ProcessWire API, those cannot and should not be considered as a long term solution in lieu of proper documentation. In the meantime though, they are a good place to start if you are searching for particular answers. Welcome back to the forums
  21. And we are back... I now recall I have seen this error before (when I was playing around with enhancing the Comments Manager). Yeah, the error is not very intuitive. ProcessCommentsManager should at least catch the error and give a more informative message. What is happening is this. In line #92, Comments manager is calling a constant from the Comment Class. The Comment Class is not a module but a .php file. It is loaded/required_once in FieldtypeComments.module line #22. So, unless you at created at least one field of type Comments, you will get that error. That field does not have even have to be added to a template yet for this to work. If such a field is present, it calls FieldtypeComments.module which in turn loads the Comment.php class and everything is fine and dandy. So, long story short, first create a field of type Comments before attempting to load ProcessCommentsManager. I would also file a request on GitHub for @ryan to consider catching the above error and returning a more meaningful error message for supersusers.
  22. Hi @_NameLess_, Not a great start, eh? Welcome to the forums. I am going to test in a minute but I have not seen this error before. It seems to me you installed the module on your own custom path? Is there a reason for that? i.e. you should let PW determine the path. Is this a local install or remote? I'll test and get back to you
  23. Tony, You are looking in the wrong place. renderArchives() is only responsible for all archives (e.g. /blog/archives/) and year archives (e.g. /blog/archives/2015/). For month archives (e.g. /blog/archives/1/) it is all about renderPosts(). Have a look at line # 33 in blog-archives.php. Just before that is where you need to pass your options. I am assuming you are using the blog-archives.php demo template file that ships with Blog. $options = array('post_count' => 0, 'post_comments' => 0, 'post_author' => 0); $content .= $blog->renderPosts($posts, true, $options);
  24. @kixe, Thanks for pointing these out in advance. I am not being naughty but as you can tell from here, Blog is only compatible with ProcessWire 2.4 - 2.7 . I have been so busy I haven't even had a chance to install, let alone play with ProcessWire 3.X. So for now, I am not able to support Blog for that version of ProcessWire, but I do appreciate people catching such bugs in advance (although, PW 3.X is still an evolving beast)
×
×
  • Create New...