-
Posts
6,808 -
Joined
-
Last visited
-
Days Won
159
Everything posted by Soma
-
Forgot you were asking where to put it, sorry. But glad you found it out. Now to make the current active try this: //what is the current language $lang = $user->language; //this line sets the language to sites default. //"default" is the name of the sites primary language, in this case it's English $user->language = $languages->get("default"); $activeClass = $lang->name == 'default' ? ' class="on"' : ''; echo "<li><a$activeClass href='/en{$page->url}'>EN</a></li>"; //this sets the language to German, so you can get the pages URL in German $user->language = $languages->get("de"); $activeClass = $lang->name == 'de' ? ' class="on"' : ''; echo "<li><a$activeClass href='/de{$page->url}'>DE</a></li>"; //this sets the language back to current one again $user->language = $lang;
-
You're all right there mrs! The module is to create speaking language urls, which is best practice regarding SEO. BTW Are you female? Not that it matters.
-
This I like more: http://www.photoswipe.com/ Ok not really lightbox, but nice gallery for different devices.
-
It's just that the add form method isn't yet hook-able. It's not about not being permitted and it comes down to each process that creates form for various tasks in the admin. I think Ryan will be glad to make it hookable. I also was starting a module to add icons to templates but stopped working on it. Just made css tests to see what can be done. Since my teflon theme already has icons in the page tree I tried to find a convenient solution. I was thinking about either extending the template edit form or just keep it on the module setting screen to be able to set a icon for each template on one screen. Either way it would work but still some things to figure out. I made the buildEditForm hookable and was able to add tab easily. Edit: this is example module to add tab and a checkbox to template edit screen. Once the buildEditForm() is hookable. Just add ___ to the method. <?php /** * ProcessWire Page List Icons * * 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 PageListIcons 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 Icons', 'version' => 100, 'summary' => 'Add an icon per template in the admin page list', 'href' => '', 'singular' => true, 'autoload' => true ); } public function init() { //$this->config->scripts->add($this->config->urls->PageListIcons . "PageListIcons.js"); //$this->config->styles->add($this->config->urls->PageListIcons . "fontello/css/fontello.css"); $this->addHookAfter("ProcessTemplate::buildEditForm",$this,'addForm'); $this->addHookBefore("ProcessTemplate::executeSave",$this,'saveForm'); } public function addForm($event) { $form = $event->return; $template = $this->templates->get($event->arguments('template')); $t = new InputfieldWrapper(); $t->attr('title', $this->_x('Icons', 'tab')); $t->head = $this->_('Add icons to pages'); $t->attr('class', 'WireTab'); $t->add($this->buildEditFormIcons($template)); $form->add($t); } public function buildEditFormIcons($template) { $field = $this->modules->get('InputfieldCheckbox'); $field->label = $this->_('Test'); $field->attr('id+name', "mycheckbox"); $field->attr('value', "test"); if($template->mycheckbox) $field->attr("checked","checked"); return $field; } public function saveForm($event) { $value = isset($this->input->post->mycheckbox) ? $this->input->post->mycheckbox : null; $templ = $this->templates->get($this->input->post->id); if($templ->mycheckbox != $value) $this->message($this->_("Template saved: Test")); $templ->mycheckbox = $this->input->post->mycheckbox; } }
-
You can add tabs via the field "FieldsetTabOpen" to templates. If you are talking about the template edit screen you're right.
-
Share your experiments. I thought I'd share something I've done a little while ago experimenting and trying out things you can do with js and SVG. So vector graphics for the web even older browsers can (IE had VML). 1. One is the famous Chromachron watch, I've created an accurate browser version (with a little twist in the center, which is not on the real clock). Done using the amazing javascript SVG library RaphaëlJS. http://soma.urlich.ch/chromachron/ 2. A fun experiment with RaphaëlJS for drawing and toxiclibjs (from java), a great physics library for the physics. You can click to fix the tail of the spring. (better have a fast browser) http://soma.urlich.ch/toxictale/ Have fun.
-
Let me search that for you: There's some dozen more around about this subject, but I'm too lazy search. Multiple categories will also result in multiple urls, so setting canonical meta url might be a good idea. Depends what you want, but I don't see any issues with it if you handle it in some way.
-
Well i thought i explained it already. In a bootstrap theres no page context thus no output formatting. Sent from mobile.
-
The only thing I see now to reproduce your fatal error ist writin ->first instead of ->first() This has come up so often it was clear from the beginning it has to do with it being and "Pageimages" WireArray instead of a single object of type "Pageimage". That's most likely when you directly request it and include the PW index.php. BTW do you also bootstrap that when doing normal function call when included? Because it's not necessary on a PW template file. SO you most likely have to also include a check for using first() or not depending if it's an ajax request or not.
-
I see, still even if I rebuild yours and also include the bootstrap, I can call it directly via a ajax jquery script. And I can reproduce that what we first answered. Even if it's a single image field you have to call it with $p->image->first()->sie Now looking again at the error code "Pageimages::size" That's exactly why me and Ryan suggested to try the ->first() method. And my tests show exactly this behaviour. Works fine here so can't really help and don't see anything wrong that sticks out. I have a /site/ajax/ajax.inc.php include_once( $_SERVER['DOCUMENT_ROOT'] . "/index.php"); function generateCart( $pages, $config ) { $p = $pages->get("/about/"); $img = $p->image->first()->size(100,120); return $img->url; } if(wire('config')->ajax){ echo generateCart( wire("pages"), wire("config") ); } And when I call it directly from a pw page <script> $.ajax({ url: "/site/ajax/ajax.inc.php", success: function(data){ $('#bodycopy').html(data); } }); </script> I get this back /site/assets/files/1001/pastedgraphic-1.100x120.png And the image field "image" is limited to 1 max. So in a normal call in a PW page you only would do $page->image->size(100,0)->url
-
Call it directly? You can't put a script in the /site/yourdir/.. folder an call it directly via ajax, that will give access denied by htaccess. The function you write, that is not an ajax call, an ajax call is made via javascript. So can't say for sure I understand. But I'm maybe also missing the obvious or still don't get your code flow, for example where and how do you do the ajax request? And where are you seeing the error?
-
I'm still not sure when reading your setup and where is what. It can be confusing lol Just think of it as a special type of array that has certain methods depending on type etc. Usually in templates, $page->image as the name would suggest it is a single image field (field setting to max=1), so it would be directly the one image object. If you have a "images" field, and set it to max=0, so no limit, the field will be an array in the templates files and you have to iterate through them or directly access it by some of these methods WireArray's have. So ->first() or ->eq(2) would give you the image object. Now in certain cases this array, single object behaviour is only on template and admin level. Technically it's always an WireArray, but the system has a output formatting that will take care for that. So if you turn of outputformatting you would always have to use ->first() to access the one item in the array. So it's possible that this is the case, but it's obviously not, or I'm still not sure what causes the problem in your case.
-
I just ran a little test with latest PW and I have no problems requesting a special "/ajax/" page with a template with more or less your example code. Returning a scaled image string, doesn't matter from where. So I can't reproduce it.
-
It's not attributes for fields, but more html attributes on the inputfield render output. As you say correctly it's not something saved with the inputfield.
-
For this particular reason I pushed TinyMCE field so we can implement custom plugins. Using bramus_cssextras I wrote a tutorial here:
-
It would not be a normal php array but a WireArray with image objects. Where is your function located? What is the setup exactly there? Edit: And from where are you doing the function call?
-
WireException: Method Pageimages::size does not exist or is not callable in this context Looks like you need to threat the image(s) as array adding a ->first()->size() $productImage = $product->wcart_image->first()->size( 80, 60 );
-
... and all to help Google "encrypt" scanned books.
-
Add rel="nofollow" when adding a TinyMCE link
Soma replied to formmailer's topic in Wishlist & Roadmap
The only problem is that ProcessWire TinyMCE implementation has it's own link dialog and not the standard TinyMCE one. But thanks anyway. -
Specify page query target with "unspecified others"
Soma replied to Gazley's topic in General Support
You're much into albums. Did you know "Alb" is ancient german myth creature that sit on your chest at night and make you have bad dreams "Albträume"? After reading you post I have more questions than you, so I think. I might get some sleep, have to pass on this for now. -
people.processwire.com
-
Welcome thistimj. Jeeez... and I even made it sticky!
-
There's two configs for urls and paths. $config->urls->... returns web urls $config->paths->... returns web server path Mainly for frontend code like including css and script or image you would need ->urls For including libraries or using file_exists, you can take ->paths Also check out the cheatsheet I've done, that will give good reference over the api. http://www.processwire.com/api/cheatsheet/
-
I'm not sure I understand why you want to create it on the fly, though I think you could. Why don't you just create the structure of the "Placeholder" with it's subpages? It will be not so easy to do what you explain. You could create a special placeholder page where you want with whatever template, then move the Pages C,D,E,F inside it. Then you could show the second level there only if the parent is the placeholder page. Using my MarkupSimpleNavigation you would do this using the custom selector setting: $nav = $modules->get("MarkupSimpleNavigation")->render( array( 'show_root' => true, // include home (root page) 'max_levels' => 2, // limit to 2 levels 'selector' => 'parent=/|has_parent=1004' // *. )); echo $nav; * This selector makes it show all pages that have "/" (root home page) as direct parent, OR pages that have the "placeholder" page (id or path of page page) as their parent. You could also write has_parent=/pathofpage/. ("parent=/|parent=1004" doesn't work for some reason.)
-
Thanks Hani for finding the issue. It works here too when changing.