-
Posts
6,798 -
Joined
-
Last visited
-
Days Won
158
Everything posted by Soma
-
Alan, if your tools page is hidden, you don't need to set all children of it to hidden. Usually we set a page hidden, to not show up in navigations. So it's basicly enough to have the parent set to hidden.
-
Get specific page attributes/fields from pagearray set
Soma replied to Bill's topic in API & Templates
Thanks Bill you're welcome! -
TinyMCE content image disappears when editing existing image link
Soma replied to apeisa's topic in General Support
Sorry guys, as this was my fault for not testing the bug fix with link editing through-out. -
I just commited an update, with improvements to simplify module code. Originally fixing an issue with "has_children" behaviour. Which now works also with custom selector (that would ommit pages by template) and max_levels as expected. It will now only append if there really is children to be shown. Also fixed and updated some documentation. Thanks
-
Get specific page attributes/fields from pagearray set
Soma replied to Bill's topic in API & Templates
I don't think there any over the other, at the end it is and does the same. Just a matter of preference. -
Get specific page attributes/fields from pagearray set
Soma replied to Bill's topic in API & Templates
In a module it's not the same as in template level, in a module you use wire("input")->urlSegment1; $wire->input->urlSegment1; or $this $this->input->urlSegment1; -
Get specific page attributes/fields from pagearray set
Soma replied to Bill's topic in API & Templates
Bill, if I look at your code I just keep thinking that I would do this. And look! Without foreach! $rand_children = $pages->find("template=basic-page")->getRandom(3); echo $rand_children; // returns 102|230|323 $ids = explode("|",$rand_children); print_r($ids); // array with id's ..so a one liner would be this: $ids = explode("|", $pages->find("template=basic-page")->getRandom(3)); -
Try this without the $ in the field name? <?php foreach($page->Meta as $m) { echo "<meta name='$m->MetaName' content='$m->MetaContent' /><br/>"; } ?> or this with the {} <?php foreach($page->Meta as $m) { echo "<meta name='{$m->MetaName}' content='{$m->MetaContent}' /><br/>"; } ?>
-
Hi gottberg! To include the root page you would pass the option "show_root" like: echo $treeMenu->render(array( "show_root" => true ));
-
Pete, i think you want to use the markup cache in PW to do simple caching to your needs.
-
Hey MadeMyDay! Thanks for your post and inputs. As a modx user myself (not anymore) I certainly know Wayfinder, but found it a little too overhelming with way too many complicated options, so I've never used it to it's full power, also because the basic output was always enough. Pete is right, if you want the ultimate flexiblity you would want to create your own nested function to output. But I guess it also can get complicated depending on what you want to do. Generating a basic nested navigation is really easy using PW API, but I like to have some sort of tool that suites for most cases without getting into too much coding everytime. So having a module like I see as a nice way you can always rely on for fast implementation. You're right that maybe best option would be to have classes appended to <li> element and not inner item. It will more easily allow for if you are styling <li> elements, but let's you as well style the inner element. The other way around it isn't possible. I'm always styling the anchor and not the list element as it is the most easy and reliable cross-browsers. That's why I implemented it this way. But it's now changed by default. I understand that having a possibility to define custom markup will make it even more flexible and I was already planing to do anyway. Though with such implementation it's always the case that at some point you're still limited at best in some way or the other. I already looked into it and found a easy implementation that will work and not having too much options. I just commited a major new update to github and updated first post to reflect changes. It let's you now define custom markup even with placeholders/tags for fields you want to output. Just as an example you could do something like this: 'outer_tpl' => '<ul id="mainnav" class="nav">||</ul>', 'inner_tpl' => '<ul>||</ul>', 'list_tpl' => '<li%s>||</li>', // template string for the items. || will contain entries, %s will replaced with class="..." string 'item_tpl' => '<img src="{icon}"/><a href="{url}">{headline|title}</a><p>{summary}</p>', // {icon} any image field will be auto-recognized and return image url instead. {url} will output url to document. Any other field will output normally (assuming it's a textfield) 'item_current_tpl' => '<img src="{icon}"/><span>{title}</span><p>{summary}</p>' I also renamed and removed some options with this update, so if you already using it, make sure you update your template code. Sorry for the inconvenience it may cause. But I think it is now better and will not change in future. Changed: 'class_current' to 'current_class' 'class_parent' to 'parent_class' 'css_levels_on' to 'levels' 'css_firstlast_on' to 'firstlast' Added: 'has_children_class' => 'has_children' 'levels_prefix' => 'level-' 'outer_tpl' => '<ul>||</ul>' 'inner_tpl' => '<ul>||</ul>' 'list_tpl' => '<li%s>||</li>' 'item_tpl' => '<a href="{url}">{title}</a>' 'item_current_tpl' => '<a href="{url}">{title}</a>' Removed: 'ul_class' and 'ul_id'. Which now can be added via 'outer_tpl'. While at it I also fixed a max level issue when using other root page than "/". Thanks.
-
It doesn't yet any cleaning up, even if you delete the images on page or even the field the images stay there. Only if you delete the page itself, they will get deleted.
-
Have you tried doing a table/db repair?
-
Thanks for the fixes! They all work now. Hope the clone issue will not be too much work
-
No it's gone, guess it was a cache problem. Only happened first time. Thanks!
-
Cool! I think you only need this line: $field->derefAsPage = FieldtypePage::derefAsPageOrFalse; Edit: just reading again... you want to select fields not pages? Why not just use a simple select? I think ASM select and the others depend on the fieldtype page, which hold the setting to select multiple or only one. Not sure if there's a way to use ASM select for this, as it's always possible to select multiple.. just 1 will be saved. I need to think again what you're really trying Edit: oh and in modules you can always just use. $this->modules->get("nameofmodule"). Edit: I recently used something like this in my DataTable module, maybe this is of help too. $field = $this->modules->get("InputfieldSelect"); $field->attr('id+name', 'filter_template'); $field->label = "Filter by Template"; $field->description = "...."; $field->addOption('', 'Show All'); foreach($this->templates as $t) { $name = $t->name; if(($t->flags & Template::flagSystem)) $name .= "*"; if($this->optionTemplate == $t->name) { // optionTemplate is just example, depending on how you save the settings in your case $field->addOption($t->name, $name, array("selected"=>"selected")); } else { $field->addOption($t->name, $name); } } }
-
Thanks wes for submitting! I got another issue which was reported already by me and someone else. When I add an new repeater element on a page with text, image field, and upload an image only, after saving the page, the element disappears. Though after adding an new one again, the image is still there. Though after saving it then again it stays there as it should. And to add it once again: When cloning pages that has repeater fields. The repeater elements added on the orginial page suddenly get lost, and the new cloned page doesn't have them copied over.
-
Looks ok, though I would use "name". Not sure what's not working. Can you make sure the $featuredTag is really the page returned? You could try a different version. $featuredTag = $pages->get('/tags/featured/'); // use the path $featuredPages = $page->children->find("tags=$featuredTag"); What does it?
-
As per https://github.com/r...essWire/pull/84 Nice! Although it isn't very useful when adding a bunch of modules at once. Also if a module has multiple, with dependencies, it's likely that the links jump to the non-installable version(s). Although there's a note in the description if module dependencies is set. So what if they're also an anchor to the intallable module mentioned? If there is any way to make this a little more clever it would be awesome. We already discussed this a while ago but can't find thread.
-
Most likely you got a page title that is empty, thus the error. Every page in PW needs at least the "title" field which is mandatory. You can't save a page without giving it a title. Is there any entries with no title in your csv?
-
Formmailer you should be able to do something like this (needs allow_url_fopen php server setting to be on), but I guess the rss module also uses it so it will work. Simply use this in the template where you markup cache or xml code is to check if url is available, if not it returns false, the @ is just to surpress any error it would throw. if($file = @file_get_contents("http://domain.com/the/path/to/xml")) { // or @simplexml_load_file echo $file; } else { // do something else echo "not available"; }
-
I spoted an issue when using this on repeater fields list. The percent text doesn't stay after saving the field.
-
http://pw2-dev.ch/pr...ter1122&modal=1 The pages_id 1002 is the page, but the image is saved elsewhere of the page the repeater creates.
-
It's what I did aswell. You're right that before opening an bug report it should be posted in the forums... my brain fart was mainly due to the issue that I aswell started posting in main threads like here, instead of simply a new one, and it get's lost and I don't like to repeat asking and I feel for Ryan. So it's mainly my issue posting my bug in here. --- I just tested and got same behavior as Sevarf2. I added simply a date field autopopulate todays date and after adding new element on page, and hit save... I actually got additional one! Once I try to delete them and hit save. I gets more and more and more new items. I can reproduce, got same issue here. Plain install, no other modules except language. Simple repeater with text field and image field. Users not admin/superuser user can't upload images.