-
Posts
10,902 -
Joined
-
Last visited
-
Days Won
349
Everything posted by adrian
-
$form->addStatus(Page::statusUnpublished);
-
I think you can probably replace: $form->parent = $page; with: $form->parent = $page->parent;
-
Looks like you got it sorted! At least they are both working for me. Thought I'd mention this, just in case it's an issue at your end - you never know sometimes
-
This is a recurring issue for those new to PW. Your images field is by default set to handle more than one image, so you can either change it to only support one image, or you need to define which image from the field you want to display: if($page->themeimage) echo "<img src='{$page->themeimage->first()->url}'>"; Or replace first() with last() or eq(n) where n is the number of the image in the order, starting with 0. To change the image field to only support one image, go to the field's details tab and change Maximum files allowed to: 1
-
All these avatar changes are freaking me out I am starting to see vxda's point. I was caught up on embedding into RTEs and then display through templates, but I can see the scenario where it would be great to have a client be able to insert an existing image from another page into a dedicated image field.
-
This is in the works: http://processwire.com/talk/topic/3219-images-manager-alpha/
-
But why do you need to upload them multiple times? You can access them from any page, either through the RTE example above, or using the API to display them in your templates like: $pages->get("name-of-other-page-with-image")->image-field-name->url That assumes the images field is set to only handle one image. If it contains more than one, you would need: $pages->get("name-of-other-page-with-image")->image-field-name->first()->url or instead of first(), you could choose last() or eq(n) where n is the number of the image in the field based on their order.
-
From: https://github.com/evanmcd/SublimeProcessWireSnippetsAdvanced If you're using Git, the best method is to clone this repository to your ST Packages folder. (on Mac, it's here: /Users/your_username/Library/Application Support/Sublime Text 2/Packages/). You can also download the zip file and unzip into the Packages folder. Either way, I would recommend creating a ProcessWire subfolder as there are more than 200 files.
-
Just a wild guess - do you think it is possible that they have messed with the .htaccess file or have some other redirect rules (maybe even in the apache conf file) that would be causing the redirect?
-
If you are referring to using them in an RTE, then to expand on Kongondo's comment, when you are in the Insert Image dialog, click the "Images on Page" header and click the "change" link to browse for images on another page.
-
Hey Antti, I have just committed an update that I think fixes the multi-language issues. I know there are two different ways to do different language versions of a field, but from my understanding, this should work with both. Would you mind checking on your end and see if the import is now working for you. Thanks!
-
I am no Github expert, but the only way I have ever been able to submit a pull request is to fork the full repo. This seems to confirm this: http://stackoverflow.com/questions/14821583/pull-request-without-forking However maybe I am not exactly understanding what you mean by "Or can I do this only with the files which need the changes?"
-
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