Jump to content

adrian

PW-Moderators
  • Posts

    11,182
  • Joined

  • Last visited

  • Days Won

    372

Everything posted by adrian

  1. I think I have found a small bug with this. It only affects sites that have $config->pagefileSecure = true; and if you are using the paste option, instead of uploading the csv file. This line is the problem: $csvFilename = $this->config->paths->files . $this->page->id . '/data.csv'; Obviously it is not accounting for the "-" that is prepended to id of the page in the admin /assets/files/xxxx folders. This seems to fix it: $csvFilename = $this->config->paths->files . ($this->config->pagefileSecure ? $this->config->pagefileSecurePathPrefix : null) . $this->page->id . '/data.csv';
  2. The first option won't work because php is server-side and runs before the page loads. The second option has potential, but you are echo'ing: $input->post->utoffset; when the name of your hidden field is "vt" and not "utoffset".
  3. Hi Nikola, I also just discovered this theme - not sure how I missed it before - really beautiful and functional. I actually moved the "latest" sections content to below the Pages/Setup/Modules/Access items. As slick as the collapsible sidebar was, it just seemed like unnecessary use of screen real estate to me. This way I can still see it and I can easily set the width of main content area to 95% of the screen width which helps to simulate the look of the front end of the site which uses RWD. Thanks again for my new favorite theme! EDIT: One thing I noticed is that page number buttons on the users page (yes I have more than one page of users) are still pink/grey and need styling to match the theme.
  4. I have started a GitHub repo for Page Tree List JSON files: https://github.com/adrianbj/ProcessWirePageLists I will add new ones as the need arises for me. Still not sure if this is the best place for these. I am tempted to set up a simple site to house them that hooks into the Github API like the PW modules page. Will see once I get an idea if people will actually use these or not. Might be more useful once I have taken care of some of the ideas in the above post.
  5. Regarding the debugging element to this thread, "error_log()" is one of the things I find incredibly useful. Very handy way to spit out the value of a variable, or even just "test" at a certain point in the code to confirm that bit is being processed. This is useful for times when it is not easy to echo content to the page for whatever reason, or if you are **shudder** trying to fix something on a live site and don't want the output littered with your debug code as you are working on it.
  6. That is REALLY cool - will be amazing for selecting from long lists!
  7. Hey Soma, Thanks for all the input. I have seen some discussion about export/import and I understand the challenges. I have also had a look through Antti's ProcessDataImport module. When I put this together I really wanted it to just handle simple page lists, so I wasn't planning on worrying about all the context settings and other issues that are a more challenging prospect. Thanks for spotting the functions inside the method - this really was a quick and dirty initial effort designed to quickly copy some page lists to a new site I am working on. I'll make a note to reorganize those. I remember seeing getArray in the cheatsheet some time ago, but didn't think about it for this use case at all. Could be very handy in making this module more capable - thank you! Seems like the only superfluous information are the roles settings - might be easiest to remove these from the array before json_encode'ing. I guess I am trying to figure out how far to take this: It seems like it should be quite easy using getArray to grab most of the settings and iterate through them to set them on the new site. Are all of those settable via the API? - noGlobal etc? I think I should add support for all levels of children, grandchildren etc. Plus an option to export/import structure (templates and fields and category pages) only - ie don't migrate the lowest level child pages - using a gallery example: Gallery --Nature ----Image 1 ----Image 2 --People --Kids It would migrate all the templates and fields for "Gallery" and all levels of nested pages, but it wouldn't migrate the Image pages themselves if "structure only" setting was checked. I think those enhancements would facilitate Marty's thoughts for migrating and setting up a full page hierarchy with templates and fields for a gallery etc. Or perhaps it wouldn't be a big deal to also download any template files as well and include those in a zip along with the JSON file. The catch there might be permissions issues on the templates folder as this won't be writeable by default on most setups. Copying files from assets/files should be easy enough, but could result in a huge download package and also it might become interesting trying to reconnect these files to their appropriate new pages_id I think for now at least, I'll aim for option 1. It seems like option 2 is something best tackled by Ryan as I am sure there are some big picture considerations that I'll miss at the moment. It would also become difficult deciding where to stop. For example I don't think a module like this should ever tackle migrating template access roles - I think it would be logical that these sorts of setting would be best redefined on the new site. Marty - can you think of anything I am overlooking in Option 1 for making this work for your idea?
  8. I agree I think this could be cool. The profile exporter is great if you want to copy an entire setup, but it would be great for example to be able to "install" the pages/templates/fields for an image gallery from an existing site onto a new site with a couple of clicks at any point in the development of the site (unlike the site exporter where it is the entire site and you need to do it at the start). Perhaps I could also add an option to just export/import the page/template/ field structure without the data! I'll have to experiment with this in the next few days. Thanks for the feedback
  9. Interesting thought Marty - I hadn't considered that at all, but I don't see why not Of course it would mean all the fields would initially be added to the template of that child page, but I guess no big deal. I wonder whether it would be worth taking it beyond its original goal and give it the ability to export all levels of children, grandchildren, great grandchildren etc, so an entire site of pages, templates and fields could be migrated. Obviously there are lots of issues to make this work, and is not why I built this. If I tried for that functionality, it would still fall short of the Profile Exporter, because it wouldn't support copying of template and other files, but it might still be a useful tool.
  10. Yep, It creates all required templates and fields using the settings from the original version. It won't re-create or modify a field if it is already existing, but it will add an existing field of that name to the required template. I did think about separating the metadata and content - went with the lazy option to start with until I get some feedback on what changes to functionality might be good. At the moment, the first item is the parent, parent template and child template info. The second is the field info. The rest are the data.
  11. GitHub: https://github.com/adrianbj/ProcessMigrator This module has gone through lots of iterations with lots of new functionality each time. It is now a fully fledged content migration tool. *** Please be sure to read the GitHub ReadMe to find out what it can do now as most of the posts in this thread are no longer correct regarding its functionality Once it is release worthy, I'll create a fresh thread with all the details. This modules allows export, sharing, and import of page lists via JSON files. It takes care of replicating all the pages, as well as creating any templates and fields that are needed. I have defined "Page Lists" as page trees (parent and children) that store selector values for a Page fieldtype. An example would be a list of countries that would be used to populate a countries drop-down select field. The fields might include: Country Name, 2-digit code, 3-digit code, number code. I would like to suggest a place where we can post json files to be shared and updated - maybe a dedicated github repository? Start of a repo of lists ready to import is now available: https://github.com/adrianbj/ProcessWirePageLists It might handle migrating other simple pages trees as well, but it should not be considered a tool for migrating general pages as it does not handle associated files, nor does it handle fields which store arrays. Probably lots of other things it doesn't handle either It now handles migrating all (I think) field types, including repeater fields, page fields, all Profields fields, multi-language versions of fields etc. The only omission is the actual uploaded files and images in file/image fields. WARNING: This should be considered an Alpha module - please don't use this on a live site at the moment and be sure to back everything up before testing. Would appreciate any feedback on the concept, the code, and the idea of a shared and community edited resource of these files. Also, would love to hear what page lists would be good to share. Here are a few quick ideas: States (separate files for each country) Measurement units Languages Religions Race Academic subjects (chemistry, biology etc) Publication types (book, journal article, newspaper article, newsletter, thesis etc) Car makes and models Anyone have a better idea for a name, or how to better describe "Page Lists"?
  12. I can't really tell if you made any changes to the comments module itself, or if all your changes are in your template The error suggest that you are missing line 315 of the commentForm.php file: 315/ $this->page->setOutputFormatting(false); 316/ $this->page->save($this->commentsField->name); You can read more about the setting here: http://cheatsheet.processwire.com/?filter=setoutputformatting If that line 315 is still intact, then we need to look further. Can you post the exact code you have for the security_field trick? EDIT: Based on that post of Ryan's (http://processwire.com/talk/topic/960-comment-spam-filtering-alternatives/), I am guessing the only php change you made was to use: echo $page->comments->renderForm(array('requireSecurityField' => 'security_field')); which should be fine.
  13. Hi Vallery, Did you think about using a Page fieldtype for this? That seems to be the PW way of assigning categories to a page. Set up a parent page, with child pages for each category. Then create a field with the "Page" fieldtype and in the input tab have it point to the parent of the category pages. Choose Asm select (or other) from the Input field type and you should be good to go. I get the feeling you are populating this from the front end? These fields can also be populated via the API, so no problem there. I am not completely sure of your goal, so maybe I am off base here, but I think this approach will give you more flexibility. A bit of a read on the pros/cons of serializing: http://www.mysqlperformanceblog.com/2010/01/21/when-should-you-store-serialized-objects-in-the-database/
  14. If I am understanding you correctly it is quite simple to do by setting a variable to the current category and then only echo out the category title if the category is different to the category from the last echo'd result. $current_category = ''; foreach($wor as $result) { if($result->cat != $current_category){ echo "<span class=\"catem\">{$result->cat->title}</span>"; } echo **all the name, location, result output** $current_category = $result->cat; } Hope that makes sense and works for you.
  15. Are you getting errors when trying to delete or add new repeater fields, or is just nothing happening? Sorry - you show the error in the subject I really haven't used repeater fields much at all, but if you are having problems deleting existing fields, you can do that through PMA as well. I wouldn't recommend deleting anything through PMA generally, but since you have already ventured in there and deleted all those pages, it sounds like that might have broken some things already anyway. Go into the "fields" table and delete the appropriate lines as well as deleting the "field_fieldname" tables. Or if you are cautious, wait for a more authoritative answer
  16. This is still not really finished. It definitely works and has been tested on a couple of different sites for several months now, but I think it still needs some refining before being ready for prime time. It is now on GitHub: https://github.com/adrianbj/ProcessPDFImageCreator Will wait for module directory submission until I get time to make some refinements though.
  17. Actually I think it is kind of a useful example that highlights what Martijn and I said above. ucwords won't work on capitalized strings, which is why that example of kongondo's doesn't show Meine Seite
  18. Is the page title already all caps? ucwords needs a strtolower first if that is the case. Although you tested diogo's suggestion, so I am guessing this is probably not the problem unless the string you tried was all caps as well. Do other php functions work in that context, or is it just ucwords that doesn't work?
  19. OK, the predefined and custom formatting options have been added and pushed to github / modules directory. Lots of changes - I have updated the first post to reflect these. If by chance you have started using this already, it might pay to delete any existing fields and recreate them. Not sure if there will be issues or not, but I had to change the db field type from "int" to "char" so it could handle leading zeros. Would really appreciate a code review from those more experienced in module development to see if there is anything I could have done more efficiently.
  20. You can leave the setting at 0. Using first(), last(), or eq(n) will allow you to access whatever image you want from a multiple images field. ->url will get you the path from the root. eg. /site/assets/files/xxxx/filename.jpg
  21. Ok, I think I might know what is going on. You say "If my image is called image1-cover". Is "image1-cover" the filename of the image, eg image1-cover.jpg or is it the name of the image field in PW? You need to reference the image by its field name. On a page you can do: echo $page->image1_cover->first()->filename; This line references the current page, then the image field name (the first image if the field is a multiple image field), then the filename of that image. You can also reference fields from other pages, but I'll leave it simple for now. Does that help?
  22. I haven't updated the code in the modules directory yet, but take a look at the attached screenshot. I have set up custom formatting options, similar to the way the DateTime output formatting options work. The user can choose from some pre-defined options, or edit an existing format to output as they want. So now you can choose an output format and then output the formatted phone number on the front-end with: $page->fieldname->formattedNumber or you can manually format by using the component parts as described in the initial post above. The formatted version is generated on the fly and not stored in the database. Now I am wondering how many predefined formats I should set up. There are quite a lot of different formats, but not sure that there are any official standards: http://en.wikipedia.org/wiki/National_conventions_for_writing_telephone_numbers Anyone out there an expert on phone number formats, or have any strong thoughts/ideas on this? Also, does anyone have any comments on the format code syntax I set up, which you can see in the screenshot. Does this seem intuitive? Any other ideas? I might attach the revised code here soon and ask for some feedback before updating it on github/module directory. One more thought - wonder if it might be useful to have a format over-ride option - an extra subfield that allows page specific formatting of a phone number - might be useful for example for an international business with office around the world to be able to apply different formats on different pages. Thanks
  23. Bill, Are you aware of the difference between single and multiple image fields? Check the "Maximum files allowed" field on the details tab of your image field. If it is set to anything but "1" then you will need to do something like: <?php echo $image1_cover->first()->url; ?> If it is "1", then you must omit the "first()" I have used "url" as I would imagine that you don't really want "filename" as it would look something like: /var/www/root_folder/site/assets/files/xxxx/filename.jpg Does that help?
  24. I just wanted to add my vote for this functionality. Seems like it might be a fairly easy modification, or perhaps addition to the code that runs the modules directory. Of course it would also be awesome to also be able to browse these snippets through the PW admin like the modules manager.
  25. I was initially thinking about storing a formatted number as an extra field so you could simply do: $page->fieldname->formatted_number, but for the sake of flexibility and reducing database redundancy, I went with leaving the formatting to the output. Any thoughts on this? Now I am thinking that maybe I could go with something like the datetime field type's Output Format options and set up a few common formats to choose from as the default output, or the ability to define a custom output format in the field's details tab. This has been done and is now described in the initial post above. Maybe getting carried away now , but also thinking about detecting the end user's country and determining whether the country code needs to be added to the front-end output or not. Any thoughts / ideas?
×
×
  • Create New...