-
Posts
10,902 -
Joined
-
Last visited
-
Days Won
349
Everything posted by adrian
-
Ahh, that makes total sense - I am sure it is because all your fields become objects because of the two language versions eg: "body": { "data": "", "data1029": "" }, rather than just simple strings. Not sure how difficult this will be to fix - hopefully simple
-
Thanks for finding that Antti, although I am having trouble reproducing it. Unfortunately I am pretty ignorant of the multilang features - typical English speaker I'm afraid I just installed the Language Support (Core) module and ran a successful import without any errors. I am running a fairly recent dev version so I wonder if that is the difference? Or maybe I actually need to install a language pack and set up an alternate language field to trigger the error. I'll keep investigating, but do you have any ideas? BTW, I just fixed a problem with the country and state list files - my subconscious must have realized and woke me up (it's early here) - I should learn never to release code late at night This change won't be causing your error though.
-
Just made a couple of quick updates on Github to v0.0.3 now to fix some path issues for the main parent in some situations. Hopefully fixed now, but we'll see Off to sleep now - probably some more bug finding tomorrow EDIT: Marty - let me know if this version works for you.
-
OK, I have a new version ready, with a new name: Page Tree Migrator This new version has a new Github page: https://github.com/adrianbj/ProcessPageTreeMigrator It can still handle simple "page list" imports and I have update the format of the countries.json and us-states.json files at: https://github.com/adrianbj/ProcessWirePageLists WARNING: It should still be considered alpha at the moment, so please be careful !! You will now need this new module to be able to import those files. Whats' New Ability to import any page tree with infinite levels of children Templates are now created with all (I think?) settings from the original setup (including Family child and parent templates allowed). Three export options: - Everything, including all data pages - Field, templates, and structural pages - Fields and templates only I am not really happy with the middle one yet (see Road Map for more details), but I think the other two are very useful. Road Map Testing - It has been working great for me so far, but I am sure you guys will find some problems - I know it is far from perfect Code cleanup - at minimum I want to rename some variables etc to be more logical and add some detailed commenting. I am sure someone with more PW experience will see a mess in how I have achieved certain things. I know of a few things already that I want to redo, but for now I just want to get it out for testing Add more options for the "Field, templates, and structural pages" export option. At the moment this exports the templates, fields, and all pages, except for the final child level. My logic was geared towards something like a gallery with this structure: Gallery --Nature ----Image 1 ----Image 2 --People --Animals So, with this export option, you would only export the Gallery parent page, and the category pages (nature, people, animals). The image grandchildren won't be exported so you can use this to start with a clean gallery page tree. However, I think I should add more options that allow the user to select which levels of children to export and even which fields within these pages. That way you could choose to only export the title field for an entire set of pages, leaving the rest of the fields empty. Not sure of the most useful approach here. Any thoughts? Deal with any potential issues that occur when importing over an existing template if existing settings are different. What else do you guys want to see?
-
Curly brackets are a PHP thing, not specifically PW. This is an example I am using right now. I am in a foreach loop which is "$data as $np". $np contains a "page_template" item. I want to get the template from the $templates variable that matches the name returned by $np->page_template. If I didn't have the curlies, it would treat $np and page_template separately and wouldn't work. I think basically you can say that the curly brackets evaluate what is inside first. $templates->{$np->page_template} That is a terribly worded explanation, but hopefully it makes some sense
-
Hi sitnarf and welcome to PW. I have created two sites already and am currently working on a third with PW that has long lists of articles and I believe the page tree is a perfect way to store articles. A couple of things that might help you achieve what you are after: Drop in data table: http://modules.processwire.com/modules/data-table/ Custom Admin pages: http://modules.processwire.com/modules/process-admin-custom-pages/ This module makes it very easy to build a new PW admin menu item and uses your own templates to generate the view you want. Also, custom modules are pretty easy with PW too: http://processwire.com/api/modules/ Hope that helps.
-
Hi flod - welcome to PW! If you mean what I think you mean, stayed tuned over here: http://processwire.com/talk/topic/4420-page-list-migrator/
-
Thanks Marty - strange the export is not working for you. Would definitely love to hear how it goes locally for you. Also could you give me a rundown of your server setup? Do you have debug on? Any php errors? I should be finished with the next round of functionality tomorrow - changing quite a few things, so we'll see if that helps as well. If not, hopefully someone else can confirm whether it is working for them or not and we can go from there.
-
script.php in action="script.php" returns "broken link"?
adrian replied to Godfrey's topic in General Support
To load a php file from the templates directory, you must have a page in your page tree that uses that template. So you can either create that page, or you can move the mail.php file outside of the templates directory, assuming that file just processes the form and redirects to another page. Does that make sense and solve the problem? -
Weird! Would you mind trying to import that countries.json file for me and see if that works. If it does, could you then try to export that countries page tree and see if that works. I am running a fairly recent dev version, but I don't think I am using anything particularly new. Sorry you are the guinea pig on this
-
Hey Marty - sorry for the confusion. You need to choose one of those options - obviously I need to come up with a better name. Save will spawn a download of the JSON file. Copy will output it on the screen so you can copy it. I assume you have chosen a Parent page and structure option as well? I thought I had made them all required fields, but maybe not - will check. I am getting close to having multiple levels of children etc working too - getting exciting
-
Thanks Marty, I just added the structure only option and pushed to Github. At the moment it still creates the parent page, but not the child pages. I am hoping to spend some time now looking into importing all levels of children which will be needed in some use cases, so I think I will need to change the structure behaviour to have three options - 1) all pages, 2) no pages at all, and 3) all levels of pages, except the very lowest level child pages so that categories and other levels are be created if wanted, without population of the actual content pages. Hope that makes sense. I guess it will be an experiment to see what I think will be most useful / versatile for people.
-
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';
-
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".
-
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.
-
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.
-
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.
-
That is REALLY cool - will be amazing for selecting from long lists!
-
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?
-
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
-
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.
-
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.
-
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"?
- 315 replies
-
- 19
-
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.
-
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/