Jump to content

Soma

Moderators
  • Posts

    6,808
  • Joined

  • Last visited

  • Days Won

    159

Everything posted by Soma

  1. What versions are you running? I think "fieldgroups_fields.data" was added at some point in 2.2.
  2. I would just make an image.
  3. It's one of the statuses you see in the top of the Pages class. So you can set the status using it like: $page->status = Page::statusUnpublished; Edit: Have you looked on the Cheatsheet? For reference under "Page Status" http://processwire.com/api/cheatsheet/ BTW aren't you the guy with the processwiresexy, whatever? I'm kinda surprised you didn't know this.
  4. try to form them like this. (should be outputed like this) <p>https://www.youtube.com/watch?v=pbDn_Np3Pfw</p> <p>https://www.youtube.com/watch?v=pbDn_Np3Pfw&feature=player_embedded</p> then use this script I use on a site: if(strpos($page->body, '<p>https://www.youtube.com') !== false) { $replacement = '<iframe width="444" height="280" src="https://www.youtube.com/embed/$1?$2" frameborder="0" allowfullscreen></iframe>'; $page->body = preg_replace('#<p>\s*https://www.youtube.com/watch\?v=([^\s&<]+)([\&amp\;+?].+).*?</p>#iu', $replacement, $page->body); } $ with this you can add more than one url params to configure YT player. For example &autoplay=true or something like that etc...
  5. actually both of those are malformed. the second one looks like it also has double encoded & turned to & then turned to & ...
  6. Actually I think it would be a welcome feature. I believe it should be in the core by default, at least to make the html title unique to different installations using a domain name in the html title of the admin. Because if you bookmark login to PW sites or in the history it currently just titles them "Login - ProcessWire". No chance to know what installation it is. It could be a config value in the config file, as mentioned. Nice idea diogo. I will implement that into my teflon theme right now.
  7. Ahh... Thanks for hints guys!
  8. Hey cool, and what did you do? jk
  9. Ok now.... I almost was going to jump! Grrrr I thought that something is weird all the time. The problem was that I used a image field that was skrewed, because at some point I changed the inputfield use "crop image", but the fieldtype was still "image" and not "cropimage". That made all the testing,coding a little difficult, unexpected behavior etc. Oh dear. Edit: I just tested again and removed unessesary code. Will just commit the update to github.
  10. Hmm, so this wouldn't be a good idea to use it for transfering a site? I mean if the site has perimissions and roles, users setup (also on templates) this information wil get lost?
  11. Thanks diogo. I just recognized that I forgot to remove a testing code in the resize function for crop images. I got it fixed and commited. Only drawback is that for the resize of the crop images it does it every time you load the tree, so there could be, depending on the size of the thumbnails, quite some overhead in generating those. Since I can't use size() function of PW it doesn't check if the resized file already exists. I could do a check too, but it would not work when updating the croped image, as it would be named the same and thus not update in the tree view.
  12. Good news for your Marty. I got the resizing working for crop images! I did some magic resizing using PW ImageSizer class. It now generates a extra thumbnail of the thumbnail using the size you specify in the module settings. They get named "widthxheight_thumbnail_imagename.jpg". I just commited an update. Let me now if any issue arises.
  13. I knew you would ask this question. No it's not possible cause the crop images aren't regular PW images. At least not without changing the Thumbnail module or write my own functions to resize the croped image. Have to further investigate and ask apeisa or ryan if there would be an easy way. For now it would only be possible over the css.
  14. Outputformatting is turned on! I had to turn it off to get it to work with testing only for "Pageimages". With the OF turned on, it is not possible with single image field. If the image field isn't populated, it will never be true wether with Pageimages nor with Pageimage. So it's all a bit wierd. So I have OF turned off. But strange thing is, then I have to test again inside the if($v instanceof Pageimages){..} routine for if(count($v) && $v instanceof Pageimages){..} to test for if it's a multi or a single, to then call it with first() or without if it's single. Like this: if(count($v) && $v instanceof Pageimages){ $thumb_url = $page->$field->first()->size($size[0],$size[1])->url; } else if(count($v)) $thumb_url = $page->$field->size($size[0],$size[1])->url; Don't really understand why.
  15. Ryan, does the profile exporter also export users and premissions?
  16. You could also use the php $GLOBALS to define global variables throughout the script if you want to. $GLOBALS['label'] = (object) array('text'=>'Das ist ein text'); function renderLabel(){ return $GLOBALS['label']->text; } echo renderLabel();
  17. Ahhh sorry for being so dumb ... about the pagination. I assumed you're using the PW pagination modul... I have to take back what I said about the limit greater than 1 to work. I'm not sure about the global, I rarely use it. Could it be that you define it an object? It's not a real array this way. Try just $label = array(...)
  18. Here I have one issue when set limit = 1, the pager don't work... Solution? It says in the docs that limit needs n= greater 1. This came up recently and in the past, so Ryan mentioned he will make it work with 1 any time rather sooner than later down the road. Yes and it's not in the scope of the function. You either need to pass it to the function or make it global inside the function.
  19. I don't know if I understand. $label? That isn't a PW template variable.
  20. Long story short. You're most likely looking for wire(). You can use also in function scope. wire("pages")->find(...) wire("sanitizer")-> etc...
  21. Some time ago there was a question if it's possible to change the "name" field on the users to "Username". Here's how I answered with a module example. May it be helpful to someone. <?php class UserNameLabel extends WireData implements Module{ public static function getModuleInfo() { return array( 'title' => __('UserNameLabel', __FILE__), // Module Title 'version' => 100, 'summary' => __('Overwrite User Name Label', __FILE__), // Module Summary 'autoload' => true ); } public function init() { // only add hook if on user pages if(strpos($_SERVER['REQUEST_URI'],'/users/') !== FALSE ) $this->addHookAfter("Inputfield::render", $this, "changeLabel"); } public function changeLabel($event){ $inputfield = $event->object; // only if the right inputfield if(!$inputfield instanceof InputfieldName ) return; // overwrite the label return $event->object = $inputfield->label = __("Username"); } } UserNameLabel.module.zip
  22. Sorry for the triple post. Again. I'm testing with if there's not image populated. It doesn't work same with single image fields. I'm doing a check if(($v instanceof Pageimage) || ($v instanceof Pageimages)){ ... If it's a multi mage field (Pageimages) it returns true and the magic happens even if the field is empty. If it's a single image field (Pageimage) it doesn't return true if the field is empty. So it doesn't return the "no-image" text as I wanted. Have you any idea why?
  23. I sense a simple module coming...
  24. Hmm, I can't see any broken image when there's none on the field. It doesn't output anything if there's no image when I test. Although looking at my own code I can't see why, cause it should. So it seems the only reason is because ($v instanceof Pageimage) does fail if there's no image. Edit: Even bigger HMM, ok now I see it. It only happens with "multiple" images fields. Edit2: Ok I fixed all, and have added new option to specify an No-Image Text and text color. Also the module options are populated with the defaults at first run. May need deinstall and reinstall to have a default install. Just commited an update: https://github.com/somatonic/PageListImageLabel
  25. Ahh cool. That works only if the var $defaults is static. Well I don't understand enough why, but It works! Thanks Ryan. Is it correct that I can't merge the defaults to a local ($this->key) in the init() and have it available in the hook "addImageLabel" function? Is that because it is a hook. I had to put the merging (foreach loop) in the function to get it work.
×
×
  • Create New...