-
Posts
6,798 -
Joined
-
Last visited
-
Days Won
158
Everything posted by Soma
-
how-to get a list of all pages (recursiv) without admin-pages?
Soma replied to Stefan G. Eberl's topic in API & Templates
This turns out more complex than it seems, but it is usually something not used that often or ever at all. Even with my experience took some time to get all pages, unpublished , published, hidden, not in trash and not under admin. This is with superuser logged in as I think as editor or guest user you won't get pages from trash anyway. But something like this is needed currently Unless I'm missing something. $pa = $pages->find("has_parent!=2,id!=2|7,status<".Page::statusTrash.",include=all"); foreach ($pa as $p) { echo "<li>$p->path</li>"; } Note that as soon as you got a few hundred or thousand pages you will get a problem Edit: id = 2 // is the /processwire/ admin parent id = 7 // is the trash include=all // to get all pages unpublished and hidden -
Just added support for per level and page field/property custom selector in MarkupSimpleNavigation: http://t.co/mYV17OFq0R #processwire
-
You're welcome. Now after you know how to do it manually you're allowed to forget about it. I'm not exactly sure I would have thought of doing it like this before as I think I was often overcomplicating. Often it just takes some time to get to convenient solutions, I hope it's something useful. A lot of flexibility is gained regarding defining/excluding different branches or levels in a simple manner.
-
Oky doky. v 1.2.1 # added support for nav_selector property/field and selector_leveln (new in 1.2.1) You can now add a special property "nav_selector' to page(s) to define custom selector for rendering their children. This can be done on runtime or via a custom field added to pages to remotely control the selector. You can configure the name of the field by using the newly added option "selector_field". MarkupSimpleNavigation will look out for it and use it, otherwise it will use the "selector" option. You can now define selector on a per level basis. Simply use the _leveln suffix on the "selector" option, where n is the level number from the root parent. This is best illustrated by the following example: $pages->get(1001)->my_selector = "template=projects"; $options = array( "selector_level1" => "template=ressort", "selector_level2" => "start=0, limit=10", "selector_level3" => "template=news|events, sort=-created", "selector_field" => "my_selector" ); echo $nav->render($options); Note that "my_selector" has priority and will overwrite any other selctor or selector_leveln https://github.com/somatonic/MarkupSimpleNavigation
-
I'm currently playing around a little and I might have a very elegant solution that you could: 1. Give a page or pages a "$page->selector" on runtime that the module will look for. So you could specify on every page what children selector it will have. This could then even work if you create a special field to attach to templates to make it configurable in the admin. $pages->get(1001)->selector = "start=0,limit=10"; 2. and have selector options "selector_leveln" that you could (dynamicly unlimited) use and the module will look for it, if found use that instead of the $options['selector'] "selector_level1" => "start=0,limit=10"; "selector_level2" => "start=0,limit=20"; All quite simple to implement and seems very powerful. How does that sound?
-
No this is not supported. I'm not sure this is something we need very often.
-
So I'm not sure how much of a problem of language support names is or a general problem with languages.
-
Ryan, I'm back again withe the user language again when saving a page. I'm currently working on importing a large site in 3 languages. Now I scripting a bootstrap to import the data and create pages. Now when doing the second language I recognized that the user language is set back to default after saving a page. I figured the LanguageSupportPageNames wouldn't even get loaded (eventhough it's autoload) and the code to set the user language after save doesn't get called. I put code in there (exit()) to see and nothing. Maybe just the after save hook doesn't get called but it's strange. So I have to again manually set the language back to the alternative after every save.
-
Add start=0 to your selector.
-
Looks like you got problems with uploading files as they're clearly not missing.
-
Welcome to the age of google search http://processwire.com/talk/topic/4309-no-css-rendering-in-admin/ http://processwire.com/talk/topic/1374-upload-file-fails-if-over-128kb-yet-phpini-looks-right/
- 4 replies
-
- mod_rewrite
- Apache
-
(and 3 more)
Tagged with:
-
Also what I wanted to ask is, if the other icons show correct or only the trash icon is missing?
-
I think more that the problem maybe on your side but can't say as it works for me and looks like for others too. The image you're referring to is fine and loading correct from the jquery ui css.
-
It shows for me in all Browsers here, works fine.
-
Thanks. I never experienced this and not sure whats about it. I used it a long time and also many clients. What browser and which version theme?. I would also recommend using the dev version of teflon.
-
$page->createdUser is a method to get the user object and has nothing to do with the field $page->created_users_id you can use in selectors.
-
From the module interface /** * Method to initialize the module. * * While the method is required, if you don't need it, then just leave the implementation blank. * * This is called after ProcessWire's API is fully ready for use and hooks. It is called at the end of the * bootstrap process. This is before PW has started retrieving or rendering a page. If you need to have the * API ready with the $page ready as well, then see the ready() method below this one. * */ public function init();
-
You're welcome. Ryan, you just have to look at what you take from my PR, because I think you modified some of the files at the same time. Also you may have to check if the code really makes sense and maybe something missing an isset() or alike. I just done it real quick and only tested with multilanguage on.
-
I'm using this feature quite a lot. Here's an example of creating a indented list for using with checkboxes, selects. IT creates a new PageArray and modifies the "title" to indent, and here with a (count) used in the context of the categories to see how many products are under that category. $children = $pages->get("/shop/")->children(); $list = new PageArray(); function mylist($children, $ind='', $arr){ $ind .= "– "; foreach($children as $cat) { $countproducts = wire("pages")->find("template=product,categories=$cat")->count(); $cat->title = $ind . $cat->title . " ($countproducts)"; $arr->add($cat); if($cat->numChildren) { mylist($cat->children,$ind, $arr); } } return $arr; } return mylist($children, $ind='',$list); This will produce something like –– Gewürze (0) –– –– Kräuter (27) –– –– Kräutermischungen (7) –– –– Einzelgewürze (0) –– –– –– Anis (2) –– –– –– Blaumohnsaat (1) –– –– –– Bockshornsamen (2) –– –– –– Chili (16) –– –– –– Glutamat (1) –– –– –– Galgantwurzel (3) –– –– –– Ingwer (4) –– –– –– Kardamom (4) –– –– –– Knoblauch (5) –– –– –– Koriander (2) –– –– –– Kurkuma (2)
-
Welcome @peterofeng I'm not sure I understand <div> {$page->title}</h3> <ul> <li>Sub item 1</li> <li>Sub item 2</li> <li>Sub item 3</li> </ul> <div> <div> {$page->title}</h3> <ul> <li>Sub item 1</li> <li>Sub item 2</li> <li>Sub item 3</li> </ul> <div> This isn't a 2 level navigation. And the UL you could generate with the module but just for a simple navigation like this you could make it with your own simple foreach code. <ul> <li>item 1</li> <li class="even">item 2</li> <li>item 3</li> <li class="even">item 4</li> </ul> Same with this. It isn't supported by the module, but you could simply use css nth-child(odd) or jQuery to produce this. Not exactly sure, but you could try: 'selector' => 'parent!=1022|1002'
-
Ryan in my tests, this doesn't work as in your examples. $template = $templates->get('basic-page'); $p = $pages->getById(1386, $template)->first(); The page 1386 has the template "basic-page" but the query doesn't return it. But it does find it when using this: $template = $templates->get('basic-page'); $p = $pages->getById(array(1386), $template)->first(); BUT it also returns the page when I specify a wrong template $template = $templates->get('custom'); $p = $pages->getById(array(1386), $template)->first(); I'm not sure what all about it when using id's to retrieve a page how would a template be of any benefit?
-
It is a CMS page after all and not a front-end from where you make submission and it won't get sent before all errors are corrected. I understand what you're saying and in future this for sure will be possible. Currently publish/unpublished, creating, editing page is limited to that there's only one version of a page and one status. So editing a page and not being able to save it because a field is not valid may cause issues and keeps the page in a state the user can't go on (maybe he doesn't know etc) and all data will get lost. Anyway many scenarios and things that can happen with such validation. Saving in session wouldn't scale. It's not as simple and we're even in a privileged situation where PW at least has validation and field dependencies etc, I don't know of a similar CMS that has this anyway. PW is designed to do it all and more you can't even dream of , but Ryan has only two hands and one brain, 16 hours a day. But I'm sure he could provide more and better worded answers than me. Yes exactly: versioning/draft versions of pages will for sure give you more what you need here.
-
I don't know how to prevent page from getting saved. Whatever you mean by definition "save page". What about other fields that are correct and edited, they will get lost? So PW will save page regardless, except for fields that are validated, the inputfield processInput defines what get's saved (not sure in details and have no time to test out). But required fields will just throw an error. So in this case PW saves the page but you won't be able to publish it until all "validation/required" errors are gone, only then the page can be published. So whatever you do with old and new value is up to you. As soon as you throw an error PW says this: Session: Change: body Session: Saved Page: /de/about/ (1 change) - Cannot be published until errors are corrected Session: Go away! (body)
-
http://modules.processwire.com/modules/service-pages/ In the screenshot I see "Fields that may be queired by..." I see a "parent" ... So I think you should be able to "&parent=1001" and get the children of 1001.
-
Hmm old value -> new value. before editing -> after editing Current value -> edited value but not yet saved