-
Posts
6,798 -
Joined
-
Last visited
-
Days Won
158
Everything posted by Soma
-
You're all wrong even with alternatives! Ohhh dear
-
if ($gallery === $galleries->first()) { This is correct code with ===! Your problem is you have the "active" already in variable after first time. SO correct is: foreach ($galleries as $gallery) { $class = ''; if ($gallery === $galleries->first()) $class .= " active"; ... Problem solved. Easy if you think enough about it
-
I upload big images, and scale them down using quality of 80 or 90% and they look very sharp. Don't see what the problem is to be honest. http://www.velokurier.com/ look at the news images scaled, I don't see anything blurred. I could see and option to add gd2 or imagemagic, as imagemagic is known to produce slightly sharper images than gd2.
-
Right hook right after the PageListActions
Soma replied to arjen's topic in Module/Plugin Development
YOu could do it like this and add a jscript file and use the action to copy to clipboard or make a prompt: PageListPath.js $(function(){ $('.PageListActionURL a').live('click', function(e){ e.preventDefault(); console.log($(this).attr('href')); copyToClipboard($(this).attr('href')); }); }); function copyToClipboard(text) { window.prompt("Copy to clipboard: Ctrl+C, Enter", text); } And the module code <?php /** * PageListPath 0.0.1 ProcessWire module * * @author Arjen Blokzijl * @created 22/11/2012 * * ProcessWire 2.x * Copyright (C) 2010 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://www.processwire.com * http://www.ryancramer.com * */ class PageListPath extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( 'title' => 'Page List Path', 'version' => 001, 'summary' => 'Adds the path to the page', 'autoload' => true ); } public function init() { $this->addHookAfter("ProcessPageListRender::getPageActions", $this, 'hookPageListActions'); $this->addHookAfter("ProcessPageList::execute", $this, 'addScripts'); } public function addScripts($event){ $this->config->scripts->add($this->config->urls->PageListPath . "PageListPath.js"); } /** * Hook into ProcessPageListRender * */ public function hookPageListActions(HookEvent $event) { $page = $event->arguments[0]; $actions = $event->return; $actions[] = array( 'cn' => 'URL', 'name' => 'url', 'url' => "$page->url" ); $event->return = $actions; } } -
Test if repeater has value and tick checkbox if found
Soma replied to celfred's topic in General Support
I think you're looking for something like this? $page->guests->find('guest_name='.$guest->title)->first() or $page->guests->get('guest_name='.$guest->title) -
Right hook right after the PageListActions
Soma replied to arjen's topic in Module/Plugin Development
Simply add "url" like "title url" to the advanced template options for fields shown on page list. Damn I'm getting slow! -
Have you seen this? http://modules.processwire.com/modules/data-table/
-
Yu knocked me out!
-
Tested with current dev branch and first had some problems after uninstall the module. Couldn't login as it was "forged" and the sessions folder I deleted was missing, so also some warnings. But after creating the folder again and retrying to login it worked again. Installed the module again and it seems to work so far. No error this time when loggin in and out.
-
You're my hero! Yes it seems this was it. I fixed it and while at it added check for if the image already exists to not create it everytime. Commited to the source. It's now on 1.0.2. Thanks
-
Pixlr... Am on mobile
-
If it's a single page field $post->category->title If multiple, it's an array of pages $post->category->first()->title If think your example would have to be $pages->get($post->category->id)->title But no need to get the page as you already got it (or the bunch of them as pagearray)
-
No there's nothing special about jQuery in PW. You do the output and include your script. PW does nothing. You have to debug it on yourself. Usually you include first the css then the scripts. First jquery core then fancybox js. I've tested it in the console and fancybox script was present and I could call it in console. So either it's a conflict with fancybox and your jquery version or you did something wrong with your code. I remember when clicking an thumbnail it showed an error related to fancybox and jquery for a split second. But now the website has changed.
-
You code is now <script type="text/javascript"> $(document).ready(function() { $('fancybox').fancybox({ openEffect : 'none', closeEffect : 'none' }); }); </script> But it should be $('.fancybox').fancybox(...
-
Ryan, the image generation stops working for crop_images (apeisa modules thumbnails) with dev branch and file protection enabled. I can see that somehow the new sizing of the thumbnail returns a protected url like /path/to/page/-/ But can't see how it would be possible to fix. It works with normal image fields. Code that is responsible is. // if image field is of type cropimage (thumbnails module) if($this->fields->get($field)->type == "FieldtypeCropImage"){ if(count($v)){ $thumb_url = $v->first()->getThumb($subfield); $thumb_url = $v->url . $this->resizeThumb($v, $thumb_url, $size); } } else { // all normal image fields if(count($v)){ $thumb_url = $page->$field->first()->size($size[0],$size[1])->url; } } And the resize private function resizeThumb($field, $thumb_url, $size){ $thumb_path = $this->config->paths->root . $thumb_url; $filename = $size[0] . "x" . $size[1] . "_" . basename($thumb_url); $thumb_path_new = $field->path . $filename; if(@copy($thumb_path, $thumb_path_new )){ $sizer = new ImageSizer($thumb_path_new); $sizer->resize($size[0],$size[1]); return $filename; } else return false; }
-
I have no idea what's going on, but if I comment out session_start(); in the logout method is works. Means I don't get the error anymore.
-
Hello homma This example code should get you there. $fieldID = $fields->get("body")->id; $bodyfield = $page->template->fieldgroup->getFieldContextArray($fieldID); $currUserLangID = $user->language->name != 'default' ? $user->language : ''; echo "current body label:" . $bodyfield["label$currUserLangID"] . "<br/>"; echo "default body label:" . $bodyfield["label"]. "<br/>"; $langDE = $languages->get("de"); echo "de body label:" . $bodyfield["label$langDE"]. "<br/>";
-
I have just made a little update to 101. The limit was hardcoded to 100. Since there's more than 100 now and some get filtered out, it wasn't showing all modules anymore. Added config option for apikey and limit and set limit to 200 by default. You should be able to update Modules Manager by Modules Manager.
-
A page is more like a abstract node so it can be virtually anything it may or may not have children. This allows for some great flexibility if you use it to your advantage and maybe use a checkbox or a distinct template to use that in you code to generate the menu. In PW you would simply create a folder and use that as a container for your pages and output it differently. Create a template "folder" and only have the default title field. Use that to create those pages. In your code you can do a check like this pseudo code when outputing a link if($child$child->template = 'folder') { echo "<a class='dropdown-toggle'>$child->title</a>"; // .... loop children code } else { echo "<a href='$child->url' data-target='$child->url'>$child->title</a>"; }
-
Strange link you got there buddy http://www.mademyday...-over-modx.html/
-
I should have created a dedicated thread for it, so I'm not complaining, just found it funny nobody seemed to care back then, and now all are Ohh I need this since a long time...
-
If it's not in the sheet it's most likely also not in the documentation. I'll add it. I think there's still some useful things missing in documentation and so cheatsheet, but can't think of any ATM.
-
I'll further investigate this issue, yes it is generating a new thumbnail.
-
Funny that people didn't seem see that this proof of concept type of module has been posted and share a couple times. Nothing new. I actually posted too early as I thought it would be a more advanced module by Ryan The thread here is full of it: http://processwire.c...__40#entry17534