Jump to content

Robin S

Members
  • Content Count

    3,813
  • Joined

  • Last visited

  • Days Won

    225

Everything posted by Robin S

  1. After clicking the "Export as CSV" button the browser "loads" for about four seconds then stops loading. No errors displayed in browser, no errors in ProcessWire error log, and no error logs in the module folder. Basic shared hosting, PHP 5.4, memory_limit: 64M, max_execution_time: 30. Exporting the same data via Ryan's CSV export addon for Lister Pro works fine (which solves my CSV export needs).
  2. I'm confused about how to add styles and scripts to my custom admin page. The docs say: ...and then... So I take this to mean I have to add the "ACP_scripts_and_styles" field to the "admin" template, but admin is a system template and so is hidden unless Advanced Mode is activated. So do I need to activate Advanced Mode in order to add this field? --- Edit: After going ahead and trying it I think I can answer my question above with a "yes". This isn't obvious though, and I think the module would be easier to get started with if the "ACP_scripts_and_styles" field was added to the admin template when the module is installed, like the "ACP_template" field is.
  3. Great module! Exporting to CSV works well for small to medium numbers of child pages, but is failing silently for large numbers of child pages. In my case, around 3000 children, with 20 fields per page. I'm probably asking a bit much to try and export such a large volume of data. Maybe large exports like this could be done in batches somehow?
  4. A couple of minor issues I noticed when the CSV being imported contains File fields: 1. Filenames get converted to lowercase, so "MyFile.pdf" becomes "myfile.pdf". 2. There's no notification if the file doesn't exist at the path given, and a dummy file can end up being created containing the 404 HTML markup. So if the file path I'm importing is "http://mywebsite.com/tempfolder/myfile.pdf" and there is no such file at that path, a file "myfile.pdf" gets created in "/site/assets/files/..." but this file is not a valid PDF and actually contains the HTML for the 404 page. Edit: another anomaly is that page titles are truncated if they include an en dash. Turns out that's an issue with the CSV not being encoded as UTF-8. Good ol' Excel.
  5. @sarah_hue Also, if you're not wanting to match partial words you don't need to do the explode/foreach. The ~= operator will match multiple whole words in any order.
  6. Great, thanks. I used explode to get the individual words from the search query and then a foreach to build the selector. $selector = ''; if($input->get->general_search) { $value = $sanitizer->selectorValue($input->get->general_search); $terms = explode(" ", $value); foreach($terms as $term) { $selector .= "title|author|source|keywords|bibliography_type%=$term, "; } $input->whitelist('general_search', $value); }
  7. The selector operator ~= matches words in any position, but it doesn't match partial words (e.g. search for "crab" does not match "crabapple"). The selector operator %= matches partial words, but if there are two or more words in the search query then the words need to be next to each other and in that order (i.e. search for "crab red" does not match "red crabapple"). Is there a selector operator or technique that allows matches for partial words in any position/order? Also, the search should match all words rather than any word. My aim is for a search such that searching for "crab red" in the title field... matches a page with title "red shiny crabapple" does not match a page with title "crab" (all words must be present)
  8. Thanks for the replies. Maybe this is much easier than I thought it would be... not in a position to test right now but will check soon... I create a "Page" type field (Multiple Page option) called "Species", and then pages for each species option, with fields "Master Name" (Title) and "Alias" (a text field that will contain aliases separated by commas). I then import all the species options with Master Name and Alias values separated. Now in the backend the client can select species using the Master Name only via asmSelect. Then when it comes to searching (and this was the bit that I thought would be tricky) I can match pages by: $pages->find("template=my_template, species.title|species.alias~=$q"); Is that right? I'm still getting my head around the Page field type and how pages can be matched to it in a search. For some reason I thought I could only search a Page field by ID or Title but if I can match it like above then problem solved.
  9. I'm building a site where pages will include a field listing one or more plant species. The problem with plant species is that several different names can refer to the same plant. For example, all the following refer to one plant: Spinifex sericieus, spinifex, kowhangatara, silvery sand grass My client wants to avoid having to enter all the aliases for every species on every page and just use a single "master name", but wants a search for "kowhangatara" to return pages that include "Spinifex sericieus". I'd be grateful for any suggestions on how I could achieve this kind of alias searching in ProcessWire.
  10. Thanks for the replies, and the tip about the CoreUpgrade module. I'll give the Dev branch a go. Not sure if the forum supports polls but it would be interesting to conduct one to see what proportion of the PW user base is using Dev vs Stable.
  11. I'm building my first site in ProcessWire, and I'm using the Stable branch. But I see some attractive features in the Dev branch. So my questions are about how safe it is to use the Dev branch, and who the Dev branch is "for". Is the Dev branch actually pretty stable? Do those of you using the Dev branch run into bugs very often? And is it recommended for ProcessWire experts only? I get the impression from what I've been reading in the forum that quite a lot of people use the Dev branch. Would it be unwise for me, as a ProcessWire beginner, to build my first site using the Dev branch?
  12. Nice! The dev branch commit that adrian linked to above will make importing Page fields easier because it will allow the title string to be used instead of the page ID, but your code for creating new select options is a real bonus. Thanks!
  13. You know, I probably would have because my site only needs a single select dropdown containing half a dozen options. But good point - I should get in the habit of using the power of the API whenever I can.
  14. Thanks, good to know. When I'm ready to do my import I'll check the module page to see if an update is published.
  15. Thanks for the replies. Using phpMyAdmin I checked what is saved to the database for my Page field and it is indeed a page ID number. So that answers my question about how to prepare my CSV for import: text values for fields that will be managed with a select dropdown in PW (using the Page fieldtype) will need be translated into their page ID equivalents. Naturally this means that all select options need to be set up in advance so their page IDs can be found. Modifying the ImportPagesCSV module sounds pretty straightforward and that's probably the way I'll go. The bulk import of pages will only happen during the initial site development so the issue of the module changes not surving a module update won't be a big problem. That sounds like you use the PW API for CSV importing rather than a module like ImportPagesCSV. I'll start with the module approach but if I have problems with that I can look at using the API for the CSV import. Thanks again for your help.
  16. I think you may have misunderstood what I mean. That module would be useful for creating the pages for the select field options, but what I'm asking about is importing pages of content where some of the content fields I want to be editable in the admin using select dropdowns. Take my bibliography_type field, which will have select options like "Book", "Journal Article", "Conference Paper", etc. When that field is set up in ProcessWire using the Page fieldtype those options will be mapped to page IDs (I think) and it is those page IDs that get saved to the database (I think). In my CSV of pages the "Bibliography Type" column will contain the values as text, but I suspect PW is not going to want them in that format. Do I need to find the page IDs for each select option and replace the text in my CSV with the page ID equivalents? Or can I just import my Bibliography Type values as text?
  17. Thanks for the replies. Issue 1 is now solved - I tried playing around with some of the options for the field I'm using as my select and setting "Deference in API as" to "Single page (Page) or empty page (NullPage) when none selected" allowed me to use $page->bibliography_type->title This setting isn't mentioned in the Wiki article (whoops, it is ), and I think it would be useful to have some documentation for the Page fieldtype in the API seeing as the ProcessWire method for creating common controls like select and select multiple is a bit unorthodox (although powerful). Any advice for issue 2? I'm going to need to import a large number of pages from CSV (using the ImportPagesCSV module I expect) and if that's going to be problematic to do in conjuction with using the Page fieldtype I had better rethink how I set up the fields.
  18. I'm new to ProcessWire and trying to get my head around the recommended method for creating <select> controls in the page editor. A couple of questions... 1. I'm following the advice here and I think I have everything set up properly for my "bibiography_type" select control. However, when I attempt to output the "bibiography_type" field in my template I get the page ID of the select option rather than the page title or the "select_value" text. Im using: echo "<p>{$page->bibliography_type}</p>"; ...which outputs "1024". I tried... echo "<p>{$page->bibliography_type->title}</p>"; and... echo "<p>{$page->bibliography_type->select_value}</p>"; ...but these don't output anything. How do I get the "title" or "select_value" of the selected option "page"? 2. I understand how the ProcessWire method of creating select controls allows for a lot of flexibility (the ability to edit select options in the future, etc). But I expect this means the data that is stored in the database for the select control is something like the page ID of the selected option rather than the text for the selected option. If I am importing new pages from a CSV, do I need to translate the text for my "Bibliography Type" field into a corresponding page ID? So for instance if the "Bibliography Type" for page I am importing is "Book", do I need to replace this with "1024"? Are there any other requirements for importing pages containing data that will go into a select control in ProcessWire?
  19. Hi Adrian, Thanks for your advice. Your first suggestion sounds like it's an easy option. I tried using your Migrator module and I think it worked for the most part - it changed the admin URL from what I had originally which threw me for a bit because I was getting 404s, but I soon worked that out. The only other issue I noticed was that the restored profile included your admin user account but that wouldn't be hard to fix. I think it's probably best for me to just do a new install from scratch and choose the blank profile. I've found that using Softaculous to install ProcessWire also gives me the wrong timezone setting so fixing that and the profile issue would probably take longer than doing a "normal" PW installation, so I think in future I won't bother with Softaculous. Thanks again for the suggestions.
  20. I'm new to ProcessWire, but based on what I've read so far I can see PW becoming the CMS I use for all future sites. It would be handy to be able to use Softaculous to install PW, but this results in the "Minimal Site Profile" being installed and there is no option to choose the blank profile. I also have a second installation in another hosting account that I selected the "Beginner" profile for during install (to learn the ropes) and now I would like to change to the "blank" profile to start proper development. So my question is: is it possible to clean out an existing PW installation to go back to the equivalent of what you get when you install PW with the "blank" profile? Or do you have remove everything and do a new install from scratch?
×
×
  • Create New...