-
Posts
6,808 -
Joined
-
Last visited
-
Days Won
159
Everything posted by Soma
-
Repeaterfield created through API doesn't show properly in CMS
Soma replied to arjen's topic in API & Templates
What is this? $f->repeaterFields = $repeaterFields; Where does $repeaterFields come from? Also shouldn't it be something like: $f->repeaterFields->add($field); -
Register users and add page same as username
Soma replied to Vineet Sawant's topic in Getting Started
You don't need to sanitize a password at all, never. Not even with $sanitizer->text(). And a password 1234 isn't valid.- 30 replies
-
- login
- create page
-
(and 1 more)
Tagged with:
-
Hello Ovi Thanks for the info. I could connect and checked it out. I haven't done anything and it works. I only clicked "Check for new modules" once. The hook is getting executed and the output is shown in the review box after I submit the comment. Not sure what's about it, maybe you didn't look close enough but it's working as it should. I tested on this product /adaptasun-sea-and-tropics-spf-30/. Now I first looked also at what modules are installed, and the only strange thing is that you have 2 FieldtypeComments module, the one in core and one by Apeisa in site/modules ... ? Can they coexist like this? Well if it works, but I'm not sure if it would cause troubles or isn't needed. At least the core one can be deinstalled? Well so far, happy hacking.
-
RT @processwire: ProcessWire 2.3.2+ now comes with the capability to install and update modules right from the admin: http://t.co/yXMQfvWrFl
-
As Ryan said, Page fields either can be multiple or single. multiple = PageArray (array) single = Page (value) It doesn't matter how many values are stored. PageArray will always be PageArray even if it has only 1 entry. multiple = [page1,page2,page3] multiple = [page3] single = page4 So checking for count(PageArray) > 1 will not produce expected results. Possible solutions I gave you in your other thread here http://processwire.com/talk/topic/3915-api-syntax-to-edit-field-value-in-form-with-pw-settings-and-attributes/?p=38943
-
You hook after render. So the inputfield is already rendered. You would need to add also a hook before render to modify it.
-
How to put the original TinyMCE image features back?
Soma replied to MarcC's topic in General Support
Simplest is to move a copy of TinyMCE to your site modules folder and rename to something else MyTinyMCE on all code. Then you can leave out the pwimage plugin. -
No problem. I fixed the callback issue now with: $('.section:not("#index") h3').bind('click', function(){ parent = $(this).parent('.cat'); if( parent.find('.descr:visible').length > 0 ) { parent.find('.descr').slideUp(animated ? speed : 0).promise().done(function(){ $container.isotope('reLayout'); }); } else { parent.find('.descr').slideDown(animated ? speed : 0).promise().done(function(){ $container.isotope('reLayout'); }); } });
-
Ok I see now the problem is that for every description slideUp there's a callback call to relayout. When it's enough to call it once after all have completed. I'll fix this. Thanks for finding it.
-
Sorry I missed that somehow. But it doesn't work, it messes up the layout even more! As I said it's there for a reason to relayout ispotope after the animation is done. It doesn't happend when animation is disabled but when it's on. So there would have to be a separate if to only do it that way when animated is enabled.
-
Meta descriptions and selecting the first 'n' characters
Soma replied to Gazley's topic in General Support
I'm sure there's more and other ways but look here http://processwire.com/talk/topic/3429-how-to-set-text-linecharacter-limits-in-templates/ -
Thanks for the suggestion k07n. But the code you removed is there for a reason. I see how this might affect performance (haven't spent too much time with it) but it's needed to rearrange the boxes when you click on the red titles to toggle the descriptions or you will end up with overlaying stacked boxes. Maybe there's another way to archive it but haven't looked into it.
-
Ryan I noticed some with the module version it takes from github module. For example LanguageLocalizedUrl module has "0140.1.1"
-
Make sure the authsalt key is the same in config.php. And maybe delete cache and sessions in session folder.
-
Yeah of course:). But you think there will be ever a author with more than some hundred articles? And what count of tags do you expect? Nonetheless, I think if you likely to have less tags than articles this (following) will pretty fast (like what you do) and if you use markup cache to generate it only every hour or once a day: Just to give another example, in the authors template. I'm sure you know already but just for the record. $cache = $modules->get("MarkupCache"); // is already cached or expired? if(!$data = $cache->get("author_tags", 3600)) { $tags = $pages->find("template=tags"); foreach($tags as $tag) { if($pages->count("template=author, tags=$tags")) { $data .= "<a href='{$tag->url}'>$tag->title</a>"; } } $cache->save($data); } echo $data;
-
They also drink beer? I guess they also talk about you? Be cautious with the NSA¡ (hey guys!)
-
Thanks for posting your solution! Ok got it about the cache. Hah, yes the $array->removeAll() can be way easier than a complex add remove, possible but maybe not really needed. It's just like clear and put back the new values. Yeah I agree with what you say. At some point you maybe better switch to an advanced SQL statement to make sure it's as fast as possible. Yea an universal module would be possible also but just a lot more work. But actually fun. Something random and minor: You can also use the shorter $event->arguments("Page"); About the method. I was thinking if there's an simpler way to collect the tags and add them. The only one I can think of is this: $articles = $pages->find("template=article, author=$author"); $author_tags = new PageArray(); foreach($articles as $art) $author_tags->import($art->tags); What you think? Should be faster I think.
-
It's the same as here, just that it's a inputfield and not a page http://processwire.com/api/hooks/#what_object
-
Yeah you check for its name or type and only add the button if its a field yo want to.
-
Well the correct option is, you're right: $nav->render(array("max_levels" => 1)); "levels" area already false and only for classes. If you output only 1 level you don't need "collapsed" true. Not sure what you mean with you get all items.
-
Not sure what's about the cache thing? Do you have cache on templates? Well it's a naive way, but if you don't go to thousands or ten thousands of tags and articles, you should be fine. I have pretty large sites with lots of things happening like this and I don't even need caching because it's so fast. You can always create a custom SQL query, and join the tables you need. Creating a module isn't complicated or lot of work at all! It same as you code in the front-end and you already know how to do it. Here's a module done in 2 minutes and half the code is yours from above: <?php class TagsHelperAuthor extends WireData implements Module{ public static function getModuleInfo(){ return array( 'title' => 'TagsHelperAuthor', 'version' => 1, 'singular' => true, 'autoload' => true ); } public function init(){ $this->pages->addHookAfter("save",$this,"hookPageSave"); } public function hookPageSave(HookEvent $event){ // get current page saved $page = $event->argumentsByName("page"); if($page->template == "article"){ // save tags to page field on author page or any page $authorPage = wire("pages")->get("template=author, name=Authorname"); $authorPage->tags->removeAll(); // remove all tags first $authorTags = new PageArray(); $allTags = wire("pages")->find('template=tag'); foreach ($allTags as $tag) { if(wire("pages")->count("template=article, tags=$tag")) { $authorPage->tags->add($tag); } } $authorPage->save("tags"); // save only the field of the author page } } } Not tested but should give you a hint. Edit: The idea is on every Article save, you update the authors "tags" field and add/save them there. You would just have to adapt it as I don't know your structure exactly. (Changed the $pages to wire("pages") because it's in a function.)
-
Oh the PW module is here http://modules.processwire.com/modules/chrome-php-logger/
-
I just installed, went to site, enabled ChromePhp, hit refresh and it's showing in console. This is on latest Chrome 27.0.1453.116 Mac OSX with ChromeLogger 4.0.2 https://chrome.google.com/webstore/detail/chrome-logger/noaneddfkdjfnfdakjjmocngnfkfehhd Looks like you got the Chrome beta version 28. I think it either could be a bug in Chrome beta or ChromeLogger with this version of Chrome. I updated the module to 0.0.4 with a newer ChromePhp class 4.1.0, maybe it's working out for you now.
-
This must be on your side or slow connection. It takes 5 seconds here with wifi.
-
You can also use the last get() selector inside the parents() and remove get() on the end. It new in 2.3 to use selector with parents in think and you can now also use closest(selector). But using find() in your example and then parents() will not work because find always returns a page array and parents needs one page object. Instead of find you could use a get() like diogo showed.