-
Posts
10,877 -
Joined
-
Last visited
-
Days Won
348
Everything posted by adrian
-
Error saving file coming from Pagefile (kinda urgent)
adrian replied to evanmcd's topic in API & Templates
Just a quick observation - there is a "//" in the from path -
Does parse_str do what you need? http://www.php.net/manual/en/function.parse-str.php
-
XML needs numeric character references, rather than named entities. I wonder if a nice addition to the RSS module might be to convert an named entities to numeric automatically. This would take care of preventing any errors when body/summary etc fields are included in the RSS output.
-
BTW hafa - please ignore my original answer - I really didn't read your question properly at all
-
Willy, thanks for the heads up about that PW function. hafa - here is the details of that function: https://github.com/ryancramerdesign/ProcessWire/blob/dev/wire/core/Functions.php I had to look it up myself
-
Take a look at PHP's strtotime() - it should handle every you need. http://us.php.net/manual/en/function.strtotime.php Let us know if you need any help making it work. EDIT: I should also add that you will probably want to make use of PHP's date() to then format the results from unix time to something human readable: http://php.net/manual/en/function.date.php
-
True - forgot about that - thanks for clarifying Soma!
-
If you do want to stay with TinyMCE there is a plugin to take care of formatting code in the editor: https://github.com/tinymce-plugins/codemagic
-
Filter results of selector using select/checkbox?
adrian replied to antknight's topic in General Support
Thanks - I should mention that this really comes in useful when you have lots of different categories assigned. You might want to change the generation of the $search_string variable depending on your needs. At the moment the different filters search such they match a resource with any of the selected options (ie OR), but between filters, the search works as AND. Hopefully that makes sense - have a play and you'll see what it does. Pretty easy to change this logic if needed. -
Filter results of selector using select/checkbox?
adrian replied to antknight's topic in General Support
This is some code I have been using to generate filter options based on the page fields in a template. I cleaned it up a little, but there is still some stuff in there that is specific to me regarding formatting/output, but might be a useful start for someone. Basically it gets all the fields in the template for the current page (except those you choose to exclude) and builds a filtering form with all of them. You will likely want to ditch the text search field. The reason I excluded body and then added it back in like this was for labeling and ordering changes, but this could be done other, less lazy, ways. This is a POST, rather than GET form. It could be adapted, but the GET that is returned by InputfieldForm is not clean. One thing you'll obviously need to change is where I have the format_results function. I am also using HTMLKickstart, so the output of the filter side div and the no results message won't look great without it. <?php $filter_formcode = ''; if($input->post->filter_save) { // Search selector builder $search_string = ''; $current_field = ''; foreach($input->post as $field_name => $field_result){ if (is_array($field_result)){ foreach($field_result as $f_value){ if($current_field == $pages->get($f_value)->template){ $search_string .= '|' . (int)$f_value; } else{ $search_string .= ',' . $pages->get($f_value)->template . '=' . (int)$f_value; } $current_field = $pages->get($f_value)->template; } } else{ //This is only needed if you want the text search field which is an optional add on below if($field_name == 'body' && $field_result != ''){ $search_string .= $field_name . '%=' . $field_result; } } } $search_string = trim($search_string,','); } else{ $search_string = ''; } $filter_form_page = new Page(); $filter_form_page->template = $page->child()->template; // Populate with the names of the fields you want to exclude OR include (see instructions below) // Leave empty to output all the fields $myfields = array('id','title','body'); $form = $modules->get('InputfieldForm'); $fields = $filter_form_page->getInputfields(); //This adds a text search field if you want it $field = $this->modules->get('InputfieldText'); $field->attr('id', 'Inputfield_body'); $field->attr('name', 'body'); $field->label = "Search term"; $form->append($field); // If array is not empty use it to filter the fields if ($myfields){ foreach($fields as $f){ // Output all the fields minus the ones listed in the $myfields array // Instead, to output only the fields that are in the array, remove the (!) from the condition if (!in_array($f->name, $myfields)){ $f->value = ''; $form->append($f); } } } else{ // Else, include all the fields $form->append($fields); } // Add find button $field = $this->modules->get('InputfieldSubmit'); $field->attr('id+name', 'filter_save'); $field->attr('value', 'Find'); $field->label = "find"; $form->append($field); // Process the form if($input->post->filter_save) { $form->processInput($input->post); } // render out form $filter_formcode .= $form->render(); $filter_formcode = strip_selected_tags_by_id_or_class('InputfieldPageAdd', $filter_formcode); //Strip out the option to add new item to page field (if this has been allowed through admin) even though it only appears to certain admin users $filter_formcode .= '<script> $(document).ready(function() { $(\'select\').css({"max-width":"270px"}); $(\'li\').removeClass("InputfieldColumnWidth"); $(\'li\').removeClass("InputfieldColumnWidthFirst"); $(\'li\').attr("style", ""); }); </script>'; //set select to max width and remove floating selects so each one on own line $out = ''; $out .= '<div class="col_8">'; $filter_results = $page->children($search_string); if(count($filter_results)==0){ $out .= '<div class="notice error"><i class="icon-remove-sign icon-large"></i> Sorry, there are no results, please change your search parameters.<a href="#close" class="icon-remove"></a></div>'; } else{ foreach($filter_results as $result){ $out .= format_results($result); } } $out .= '</div> <div class="col_4"> <h6>Find a Book</h6> <p>Leave filter options blank for all</p> ' . $filter_formcode . '</div>'; echo $out; EDIT: See this post for a cleaner version: http://processwire.com/talk/topic/3583-filter-results-of-selector-using-selectcheckbox/?p=36182 -
Awesome, I'll be using this with a couple of projects that are just winding up. I'll let you know if I come across any issues. If I find time I might try to go through and clean up that class too - there is a fair bit of unneeded code in there and lots of undefined variables. Thanks for your hard work on this.
-
On another note - just noticed that the uninstaller routine does not remove the indexer field.
-
Ok, I just tried integrating that original pdf2txt script I sent you into your module and it always returns nothing. However if I place the attached version in a web accessible location, edit the last line to point to a PDF file, it works perfectly (albeit with lots of non-fatal php errors that should be dealt with at some point). Can you try this and see if it works for you at least? pdf2txt.php
-
Just installed the module for the first time and received this error: Notice: Undefined index: maxlength in /xxx/site/modules/Indexer/Indexer.module on line 185
-
That is weird. I looked back at my php source downloads and I was running 5.3.3 at some point back in 2010 and that script was still working then. It is strange that none of those options are working. Let me know if there is any testing I can do at my end for you that might help. When I get a minute or two I might try implementing that class into your module and see how it works for me.
-
I haven't used this, but I went looking for other options and found this: http://pastebin.com/hRviHKp1 Might be worth trying.
-
I just installed this module and got exactly the same errors.
-
Hi Pete, I think PW needs a good forum integration option. My concern with Invision is that it's not free / open source. Ideally I would love to see an integrated PW solution, although it sounds like you have done considerable integration of Invision into PW, so maybe it would be ok. I have made use of apeisa's basic discussions module. This works well, but in some cases there is a need for something more feature rich, so I am definitely interested in other options. I don't like reinventing the wheel, but a PW specific forum would be cool - might be a good community-wide collaborative project to initiate?
-
Sorry you had no luck with that class. It has been working well for me - several hundred PDFs with no failures so far. I have attached one that definitely works so maybe you can figure out what the issue might be. EDIT: Notice that in the main function I changed it so it always uses the handleV2 function. The V3 one wasn't working for me, but you might want to look into that some more. ian_newsletter_405 (2).pdf
-
Looks good to me. The only feedback I have is that you could ditch the first line and replace $section in the second line with $page.
-
Looking forward to checking this out - thanks! I have been using the attached set of functions for a long time to extract text from PDFs. Probably not as powerful as poppler, but might do what you need. I made some poorly documented changes to the original. Anyway, maybe you'll find something useful in there. pdf2txt.php
-
Ability to sort and search through users in admin
adrian replied to adrian's topic in Wishlist & Roadmap
Thanks diogo - I hadn't actually used the admin search function before. Works a treat, although I still like the idea of column sorting spanning all users, rather than just those on the current page. -
One of my PW site has a LOT of users and I am finding myself wanting a way to find a user in the admin user interface. Search would be nice, but at a minimum, it would be good if the column sort functionality worked across all pages, not just the currently displayed one. I don't think this is currently possible, is it? Not sure if this should be a module or a core enhancement. Thanks, Adrian
-
Due to scope, you need to use wire('config') inside a function. Same is true for all the PW variables: http://processwire.com/api/variables/ If you'll be using it a lot in the function, you can do $config = wire('config') and then use $config as normal after that.
-
As an alternative, have you tried Ryan's Youtube/Vimeo module: http://modules.processwire.com/modules/textformatter-video-embed/