-
Posts
11,182 -
Joined
-
Last visited
-
Days Won
372
Everything posted by adrian
-
I am not sure about that error in the context of field creation - perhaps you can share what went wrong. Generally not good practice as it can get you in trouble if you don't know what you are doing, but you may need to fire up PHPMyAdmin and delete the "field_fieldname" table and also the relevant row from the "fields" table.
-
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
adrian replied to ryan's topic in Modules/Plugins
Glad you got it working. The $videoItem->video makes me think you are storing the URL for the video in a dedicated field? If that's the case, you shouldn't need to do that preg_replace. You already have the id from $my_array_of_vars['v'] so you should be able to just build the embed version directly from that. -
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
adrian replied to ryan's topic in Modules/Plugins
Ok, so it sounds like you are manually adding the thumbnail image to an RTE? Maybe you don't really need the video embed module, because you don't actually want the video to play inside the RTE field? There are lots of ways to go about this. You could use a regex in your template. You could make your own module. You could maybe use the Hanna Code module (http://modules.processwire.com/modules/process-hanna-code/) and just enter the video ID and use that to output the thumbnail and link to open in fancybox. You could even use JS to modify the link. An example of your exact usage would really help to narrow down the best approach. -
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
adrian replied to ryan's topic in Modules/Plugins
It depends on what you want to do exactly. Because the module converts a Youtube link that is in an RTE texatarea field, you already know the id of the video because it is in the link. You could easily insert the image link using the url schema from that first link I posted. Maybe if you can explain your usage scenario we can help more. Where you do want to display the image? How is it connected to the embedded link. It is easy to grab the id of the video from the link in either PHP or JS using a regex, but the video module also stores the id in the PW database (in the textformatter_video_embed table), so this might also be an option depending on your needs. EDIT: Here is the function in the module that parses the video url: https://github.com/ryancramerdesign/TextformatterVideoEmbed/blob/master/TextformatterVideoEmbed.module#L127 Or you can use: $url = "http://www.youtube.com/watch?v=C4kxS1ksqtw&feature=relate"; parse_str( parse_url( $url, PHP_URL_QUERY ), $my_array_of_vars ); echo $my_array_of_vars['v']; // Output: C4kxS1ksqtw -
Module: Video embed for YouTube/Vimeo (TextformatterVideoEmbed)
adrian replied to ryan's topic in Modules/Plugins
Hi vxda, Assume you are using youtube: http://stackoverflow.com/questions/2068344/how-to-get-thumbnail-of-youtube-video-link-using-youtube-api And here is some code for both youtube and vimeo: http://darcyclarke.me/development/get-image-for-youtube-or-vimeo-videos-from-url/ -
Thanks Ryan, I hope I can make some time in the next couple of days to get a few more things sorted out with this. I am excited to get this release worthy!
-
Hey Ryan, Thanks for the great feedback. I have incorporated the first two of your suggestions: $page->phone now generates the same as $page->phone->formattedNumber The country code and extension input fields are disabled by default, but can be enabled from the field's Input tab I am not really sure how to make your last suggestion work consistently. Given the large variety in the number of digits in phone numbers around the world, I don't know how I could reliably parse a number entered in one field. How would I know what digits to separate out into which of the subfields? It would be do-able if they always entered in the same format - eg a space between each component of the number, but I think it might cause more problems than it solves. Do you have an idea I am missing? I have also added a few new features: Ability to define an override format when filling out a phone number - I thought this might be useful for organizations with international offices where they want to format different phone numbers on their web site using different local formats. This option is off by default, but can be enabled on the Field's Input tab. Ability to edit all the formats available from the format selector, along with comments at the end of each entry. This was needed to make feature 1 work so the developer can define multiple custom formats without modifying the module's core code. This is found on the Field's Details Tab. Ability to change the numbers used in the formatted examples in the format select dropdown. I thought this would also be useful for international users so that they could make the numbers look more familiar - eg Australia has two digit area codes that always start with a '0'. This is found on the Field's Details Tab. One issue I am having with new feature 3 is that I can't seem to store values with leading zeros in the input field config field (ie the values in the data field of the "fields" table). I haven't yet dug into the source code to see where the leading zero is being removed - any ideas how I can solve this? Ok, I see the problem is in the core wireEncodeJSON function. Only trouble is I am not sure how I can override this since I am not actually calling it directly. EDIT: Also wondering if I should maybe move the Phone Output Format Options and Example Number Options to the modules config settings, rather than for the field. Obviously reduces flexibility, but simplifies setup. Any thoughts? As a side advantage, it would seem that it would allow me to solve the (int) problem mentioned above because I could hook into saveModuleConfigData (http://processwire.com/talk/topic/1849-clearing-cache-on-module-save/). I don't seem to be able to find a way to hook into the saving of ConfigInputfields - is that possible? I am going to attach the revised version here for the moment. I would really appreciate your feedback before I update the code on Github and update the docs. I am worried that I might have overcomplicated things with all these new options. Thanks! InputfieldPhone.module FieldtypePhone.module
-
I didn't know that Soma - thanks for the correction!
-
Martijn's points are very valid, but I would also argue that the advantage to getting by ID rather than name, is that the client can change the name of the page if they want and the selector will still work, so it is a bit of a trade-off. I agree that the second makes no sense. Any selector together with ID will always be meaningless as only one page can have that ID anyway. See Soma's post below.
-
I wonder if this is of any help for you. It is about wordpress on Plesk/iis, but should work fine for PW http://smackwagondesign.com/permalink-for-wordpress-on-a-windowsplesk-server-%E2%80%93-iis-6-mod_rewrite-fixed/
-
"Reset" $config->appendTemplateFile for certain templates
adrian replied to Harmster's topic in API & Templates
Does the "template" that you are calling via ajax really need to be a template file with a PW page that it is attached to? If you place it in the website root folder and call it from there, PW will leave it alone. I have done that with files that process ajax form submissions and it should work for your purposes as well. -
That's great news Marty Unfortunately I haven't managed to make any time to work on this today and I am away for the next couple of days, but I hope next week to solve the multilanguage issue that Antti discovered - I have a plan and should be quite simple so long as the receiving PW installation has the needed languages installed - I should be able to issue a warning if it doesn't. I also have some ideas on how to make migration of images and files work too and maybe even RTE embedded images. Not sure how important migration of this sort of content is though - maybe it is adding too much complexity. Do you have any thoughts on number 3 of the road map above: http://processwire.com/talk/topic/4420-page-list-migrator/?p=43582 BTW, I have spent many days in your part of the world when I was a keen climber - beautiful place!
-
Wow Ryan - those new multi-value fields sound brilliant - can't wait to see your implementation. I'll have to use them, just to have a reason to send some money your way. You also really got me thinking about the potential of custom fieldtype/input field combinations for an upcoming project which is extremely data heavy. I will still definitely need several custom database tables and SQL queries for the data manipulation side of things. These queries actually take quite some time to run, but only need to be run periodically to generate results. So I am thinking that I will store the manipulated results of these queries in some custom fieldtypes which will dramatically reduce the number of PW fields, yet still allow for API querying of the final results on the front-end. So many cool possibilities
-
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?-
- 1
-
-
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.