Jump to content

adrian

PW-Moderators
  • Posts

    11,241
  • Joined

  • Last visited

  • Days Won

    374

Everything posted by adrian

  1. Nice - the only thing I was thinking by the approach I suggested is that it would allow you to also set the status to hidden, or any other option you wanted.
  2. It might be best to go with something like: $form->pagestatus = 'unpublished'; That way the module could simply grab "pagestatus" and add it to the page using addstatus before saving. I'll see if I can find a few minutes to modify the module to handle this.
  3. I don't think Ryan has that option in the module. The module code could be enhanced to handle that, or you could do something like this after rendering your form. $newpage = $page->children->last(); $newpage->removeStatus(Page::statusUnpublished); $newpage->save(); I think this should work. EDIT: added the necessary save line at the end. EDIT #2: Actually not sure if this will work at all - this could get messy if the form is rendered and not submitted and if someone else submits while another form is still being filled out. Sorry, might need to rethink this and go with editing the module code properly. Ignore all the above and see http://processwire.com/talk/topic/59-module-want-form-builder/?p=41431
  4. Oh, I see - you are actually using Ryan's module from the first page of this thread - sorry, my bad! I assumed you were using diogo's code. There is a line in that module: $this->contact->status = Page::statusUnpublished; The easy hackish option would be to remove that line from the module code.
  5. Just before: $mypage->save(); which I mention a couple of posts above, you just need to add: $mypage->removeStatus(Page::statusUnpublished); EDIT: although I thought they were published by default and you actually had to add: $mypage->addStatus(Page::statusUnpublished); to set them to be unpublished.
  6. But if they are showing up on your reader page where you are using: echo $rss->render("http://undpw.local:8888/rss-vacancies"); I don't really understand, because they were not included in the XML output when viewing that page (http://undpw.local:8888/rss-vacancies) directly in the browser. Is that correct?
  7. Ok, sorry, I thought you were using the feed generator module on the reader side for some reason. My mistake! It is all starting to make more sense now. Your code for MarkupLoadRSS (RSS Feed Loader) looks correct - sorry for the confusion there. So I guess the issue is still the generation of the feed at that url on the other site. I am at a loss for why it is showing selector-test (which it shouldn't) and nothing else. Strangely, when looking at the output for your reader page, it seems like it is actually showing results of pages from the PW default profile (eg: Child page example 1).
  8. I know you are doing some unusual things with the include, but you still can't (unless there is something I am missing about the module), do: echo $rss->render("http://undpw.local:8888/rss-vacancies"); Try this instead: $rss->render($items); You shouldn't need to be echo'ing it either. At least try this standard approach first so you know the module is working as expected for you. Then perhaps you can figure out and better explain your other needs regarding the two site approach to all this.
  9. I just re-read this bit: I think I get what you are trying to do, but I don't think this can be done with an include. You certainly can't call $rss->render on a url like that. It needs to be on a page array. I think you might be able to make it work with a screenscrape approach. There might be better ways, but I still don't understand the connection between the feeder and reader sites. Are these separate domains? Again I am not really sure what you are after, but simplepie (http://simplepie.org/) might be useful if you are trying to parse an RSS feed from one site and display the results on another. I think we still need more details to help you to figure out what you are trying to do.
  10. The code to render the rss feed should be placed in a template/page called "rss" or similar, not in the template for a "normal" page that includes content that you want in the feed. Try that and let us know how you go.
  11. Thanks Willy, I guess I am suggesting that Ryan remove the 255 limit since this is the default for the built in title field. Admittedly long titles like these are somewhat of an unusual case, but I have a few sites where the client is entering newspaper articles and scientific journal articles and the titles of these can be very long and I don't want them truncated. Ryan mentioned that the title should never be truncated, so just trying to ensure that this actually is the case by default.
  12. Hey Ryan, Little bit of confusion on my part - I was using an older version of PW to test these changes. Now testing on dev, so this should all work fine. Regarding the title field - it is being truncated by the input field: <input id="Inputfield_title" class="required InputfieldMaxWidth" name="title" type="text" maxlength="255" /> Of course the DB field "data" is a full text, so it is not being truncated there, so firstly, can we remove the maxlength from the input field for the title? Also, there is a line in InputfieldPageTitle.js which is designed to truncate "var" to 128 characters. So, what I have done in InputfieldPageTitle.js is: //var val = $(this).val().substring(0, 128); var val = $(this).val(); Then in InputfieldPageName.js: //if(name.length > 128) name = name.substring(0, 128); if(name.length > 128) name = $.trim(name).substring(0, 128).split("-").slice(0, -1).join(" "); Does that all makes sense? Would you rather I submitted this as a pull request?
  13. I can't say I understand why you are getting just those page being detected, especially the selector-test page. It also shouldn't be finding your /rss/ page in the pages list. Can you please show us exactly the selector you are using, along with a list of the pages that are returned with the selector test tool, or with the following, where {selector} is the selector code you are using: foreach(wire('pages')->find( {selector} ) as $page){ echo $page->title . '<br />'; } Maybe also post the complete code that you have in your function. Also, just for the fun of it, can you see what happens when you don't put the rss render code in a function. Maybe also write out the page tree for your vacancies pages, including the templates for the parent and child pages. I am sure we can figure it out.
  14. If this is in a function like your previous post suggests, then you need to do: $items = wire('pages')->find ... If that is not the problem, what happens if you go back to back to the standard: $items = $pages->find("limit=10, sort=-modified"); Does it work like that? I am also wondering about "include=all". Do you really want items that have been added to the trash to show up in your feed? Do you have debug on? Any php errors?
  15. Inside functions you need to use: wire('modules')-> Same goes for wire('pages') etc. This is due to variable scope issues: http://php.net/manual/en/language.variables.scope.php If you are ever writing a long function where one of the PW variables is used many times, you can always define it at the top of the function: eg: $modules = wire('modules');
  16. Hi and welcome to PW. I haven't used vagrant, so I am not sure why there would be an issue with the PHP session path, but have you checked that PHP can write to: /vagrant/rhythm-site/site/assets/sessions
  17. It looks like he has taken care of the image stretching too much on the last line (or if there is only one image): https://github.com/ed-lea/jquery-collagePlus/commit/a31bd4e661f22eda169266e4b70c0212bae62211 Regarding the issue of waiting for all images to load before displaying anything can be taken care of by simply removing the: $(window).load(function () { in your plugin. Since all the images you are sending to it have width and height attributes, it doesn't need to actually load them all before starting to display them.
  18. Hey Ryan, Using the following in InputfieldPageName.js seems to do the trick. if(name.length > 128) name = $.trim(title).substring(0, 128).trim(this); I was looking at InputfieldPageTitle.js and noticed that it doesn't actually do the truncate to 128. The browser is truncating to 255, but I think it is missing something like: $titleField.val(val).trigger('blur'); Also, I am not sure why, but the approach in the first code block above doesn't work for the title. Instead, I had to use: if($titleField.val().length > 128) val = $.trim($titleField.val()).substring(0, 128).split(" ").slice(0, -1).join(" "); But, I guess I am not sure what you actually want to do with the title field. Do you want it truncated to 255, or 128 to match the length of the name field? Some potentially more robust ways of doing this: https://github.com/micjamking/succinct/blob/master/jQuery.succinct.js https://gist.github.com/ChrisCinelli/5688048 Neither tested so far, as I don't think we need them. In particular, the succinct plugin was designed to deal with a couple of edge cases that I don't think should affect us: http://stackoverflow.com/questions/4637942/how-can-i-truncate-a-string-in-jquery
  19. Stefan, I believe the only reason why your code wasn't working is because you were using $this->addHookAfter. You'll notice that the code I put together uses $this->addHookBefore. You need to populate the value before rendering the field. As for the automatic filling error. Ryan has autocomplete="off" set for the form when editing an existing page. I have also seen this browser produced warning - it is not actually an error. Did you try the module I put together? You can easily change the fields that are being dynamically set to whatever you want.
  20. Horst - I don't think that module will work for the title field, will it? Although I am still not sure if bytesource is looking to make the title field unique anyway - I guess we'll wait and see
  21. Hey Ryan, Some feedback from the dev on these issues: https://github.com/ed-lea/jquery-collagePlus/issues/6#issuecomment-22058143 https://github.com/ed-lea/jquery-collagePlus/issues/5
  22. I think this would actually be quite easy to implement, and yes you might well be able to make use of the code that is used for the module recommend button. In fact, here is the javascript that is used for that recommendation button: http://modules.processwire.com/site/modules/FieldtypeLikes/likes.js The "number_of_likes" field could have its visibility set to "Hidden, not shown in the editor". I actually think a new option to show field values, but make them read-only would be really nice in the admin (but I digress). You could make use of diogo's http://modules.processwire.com/modules/process-admin-custom-pages/ module to easily create the table of liked pages. Before we go reinventing things, let's see what Ryan says about handing over the php code that processes the ajax call from the likes.js file.
  23. Just curious - you say that you want to make the title field unique, but in your code you are trying to set the value of the invoice_number field. This should do what you want, assuming you actually want to set the title field. <?php class MarkupTitleField extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( 'title' => 'Markup Title Field', 'version' => 100, 'summary' => 'Set the title field to predefined value', 'singular' => true, 'autoload' => true, ); } public function init() { // add before-hook to the inputfield render method $this->addHookBefore("Inputfield::render", $this, "renderField"); } public function renderField(HookEvent $event) { // // get the current field $field = $event->object; if(($field->name == 'title' || $field->name == '_pw_page_name') && $field->value == '' ) { $last_page_id = wire('pages')->get("include=all,sort=-id")->id; $id = date("Y") . "/" . ($last_page_id+1); // example for a possible id value $field->set('value', $id); } } } Edited code to get the id of the page that is about to be created. Not sure if this is completely robust. You might want to consider a different unique identifier.
  24. Glad you got it working. Have you seen the API cheatsheet? http://cheatsheet.processwire.com/ path vs url is explained there for use in both $page-> and also $file-> Your best way to really figure some of this stuff out is to echo the results to the page. echo 'url: ' . $child->webfont_archive->url . '<br />path: ' . $child->webfont_archive->path; That way you can see exactly what is being returned.
  25. Welcome to PW! Try using "->path" instead of "->url" as you need the full path to the file on the server when using include. That said, do you really want to "include" the stylesheet? Do you simply want: <link rel="stylesheet" href="'.$stylesheet.'" type="text/css">
×
×
  • Create New...