-
Posts
6,798 -
Joined
-
Last visited
-
Days Won
158
Everything posted by Soma
-
@pete I see but your last example isnt doing the same as previous. I see the structure in his screens but wasn't sure first what the desired result really is. Though I think his last code stated what I was thinking.
-
command line script file API not performing same as on website
Soma replied to wes's topic in General Support
Looks like outputFormatting symptom. Try using it as array and use $item->my_mage->first->url. -
Ok back to the code pete also thrown around, I wanted to take part in the competition and provide a much cleaner solution to do this if you really want to go with this: // create new empty page array for storing pages $dest = new PageArray(); foreach($pages->find("template=report") as $location) { $max = $location->mountains->sort('-stats_maxElev')->first()->stats_maxElev; $location->max = $max; // save value to page temporarly for sorting later $dest->add($location); // add location to page array } echo '<ul class="blocklist">'; // sort by temporary field and output destinations foreach($dest->sort('-max') as $item) { // sort and get mountain with biggest stats_maxElev $mo = $item->mountains->sort("-stats_maxElev")->first(); echo "<li><p class='tabular'>"; $ft = number_format( round($mo->stats_maxElev * 3.28084) ); $mt = number_format( $mo->maxElevM ); echo "<a href='$item->url'>$mo->name - $mt m / $ft ft</a>"; echo "</p></li>"; } echo '</ul>'; It's still a little akward and not for large large scale as it needs to loop all to get max heights. Only some custom sql query could be taken here to to get page id and use limit. It would be so nice to do it with the code I wrote previous post with using page field, but it doesn't work as of the nature of repeaters.
-
Yeah that's why I started making it some mutation are in use in some project. But haven't found time and it didnt seem to get much attention (yet).
-
Trying since a long time to understand the issue and what structure you're using. It seems a little strange you're using repeater to add mountains to reports, so if there's mountains multiple times in yours routes you enter the same information again and again. I tend to see this data as page references where you have mountains and route pages and add them. This might also would lead to a simpler solution to your problem at the end, not sure. Also you'll be able to add more fields and images, description and meta data on those mountains to maybe create a nice detail info for each mountain. Use page fields to simply select mountains you manage separate on their own page. (1 hour later... some coffee and some smoke...) I just made a little test and with page field you can do this to get you're top x list. $routes = $pages->find("template=route")->sort("-select_mountain.max_height"); foreach($routes as $route){ echo "<p>$route->title<br/>"; $peak = $route->select_mountain->sort("-max_height")->first(); // get heighest mountain echo $peak->title . " / " . $peak->max_height; } Route2 Mount Everest / 8900 Route3 K18 / 7890 Route1 MOunt Doom / 6132 And the structure is like this. Just examples Also something just noticed in your code: Anyway. In some of your earlier on page level code you use $pages->get("id=$location"); inside foreach to get the page, but you already got the page.... $location is the mountain page. foreach($peaklist as $location) { $mountain = $pages->get("id=$location"); // not needed! foreach($location->mountains->sort('stats_maxElev') as $peak){
-
Cool now I can finally use outlook to build websites.
-
Search for my admin data table module poc. ;-)
-
[Solved] First PW cron job--tips on getting started?
Soma replied to MarcC's topic in General Support
I just meant some option to mark it like you have. Why move page to an archive at all as it will change url which is not good maybe. Just saying 'archives' are always a little weird. -
Why does $page->rootParent identify current section?
Soma replied to isellsoap's topic in Getting Started
Thats kinda wrong it doesnt highlight current page but the root parent of the current page here used for subpages under a root parent. Like a trail highlighting. It does also work for the root parents itself but could be missunderstand. $child === $page would be for subpages too in case the code also goes further. === is to compare objects that are the same in memory. So its not the id but the object.- 16 replies
-
- 1
-
- current section
- semantics
-
(and 2 more)
Tagged with:
-
[Solved] First PW cron job--tips on getting started?
Soma replied to MarcC's topic in General Support
I would add a checkbox 'archived'. No cronjob no url change, much simpler. -
Its not possible to break inheritance of permissions unless you give a template of a child that has its own. The behaviour you found with move and edit is right and has come up and was discussed already not long ago. When it comes to permissions it getting complicated and I not sure again why it is like this but remember its not something easy to change and depend how they work and are implemented. But I think Ryan as the creator of this could tell a little more and what his planes are regarding this particular problem.
-
Yes it should in the default.php of the theme. You may already got it in the translation just need to enter it.
-
Omg that happens to me too exactly.. Thought this would be only me. But I gues we are all humans more or less
-
I lizen to mi sound ofe keybpard wun koding.
-
It is possible to create a little module that hides it per permission or role.
-
Glad it works now for you also! How can you miss it while it was never there?
-
Small change to InputfieldFile.js to facilitate front-end HTML5 uploads
Soma replied to adrian's topic in Wishlist & Roadmap
Yes you're right. The file upload doesn't work for the reason you found out in InputfieldFile.js. My code example works also with the change you proposed to get the page edit admin url. What I do is add this code to the form too to render a hidden id field. $form = $modules->get("InputfieldForm"); $form->method = 'post'; $form->action = "./"; $field = $modules->get("InputfieldHidden"); $field->attr("name","id"); $field->value = $editpage->id; $form->add($field); Together with your change it now works. I think that change would be ok to make that it can be used in such cases. I'm not sure if I back then haven't really tried fiel uploads but I thought it was working. Maybe some changes in core or my memory is dusty. Either way and apart from all that, just because you can doesn't mean you should - regarding all the details and security should be first priority when moving backend functionality to front end. It's not planned/meant to be used like this originally but surely possible if you include all files and configs. But I'm thinking depending on how and where and for what reason you implement it you should be careful and only let really trusted users have access anway. Even myself am not aware of what could go wrong, but I'm sure Ryan could speak a word on that subject. I'm not sure what you're building and it seems to me you're rebuilding the backend on front-end. Without knowing any details and I'm sure you got your reasons, why not just use the backend admin? Or what doesn't the backend provide that you want to create editing on front-end? I'm also curious to hear what Ryan thinks about all this. -
alan, that link goes to the master and not dev. See my link above. The controller.php is in there, make sure you have put folder templates-admin into site folder and all files are copied.
-
create pagearray field with api? (multipage select field?)
Soma replied to neildaemond's topic in General Support
It's already there in the first example... -
create pagearray field with api? (multipage select field?)
Soma replied to neildaemond's topic in General Support
Theres a documentation directly in core. Just look at what options a fieldtype has by looking at the code in wire modules. -
Sorry OT, do you already use my Teflon 2.0 admin theme?
-
create pagearray field with api? (multipage select field?)
Soma replied to neildaemond's topic in General Support
$f = new Field(); $f->type = $this->modules->get("FieldtypePage"); $f->name = 'mypageselect'; $f->label = 'Select Page'; $f->derefAsPage = FieldtypePage::derefAsPageOrNullPage; $f->inputfield = 'InputfieldPageListSelect'; $f->save(); or $f->derefAsPage = FieldtypePage::derefAsPageArray; $f->inputfield = 'InputfieldAsmSelect'; etc -
I'm working on update of this theme to 2.0. There's so many tweaks and changes, little detail fixed that I can't list them all anymore. Mainly it is to remove some noise and make it more clean. Maybe I'm going insane, but after working on it so long and back and forth I'm not even sure anymore this all is really an improvement to the previous (which is still nice). But I just don't know what to do now. - Biggest change is I added new font from google font. - Removed all rounded corners - Changed some colors of buttons - Removed headers and some shadows and some lines - Tweaked file upload button with ui button and input - Added css for fieldset columns that will hide it's header label and give nice content, sidebar columns: You can create them using FieldSetOpen field and use some of those names: fieldset_content fieldset_sidebar or column(n) 1-6 - Tweaked page tree to show actions by hovering the page - Removed page tree icons added by the theme. You now can use the excellent TemplateDecorator module by mindplay.dk to add icons per template. https://github.com/mindplay-dk/TemplateDecorator. It required latest PW dev version and php 5.3. If you need a legacy version, you can ask me as I created one for myself. This version requires latest PW dev. I created a dev branch so you can try and test. So far I only tested Chrome, FF and Safari. So if there's any IE8+ users, maybe there's something not working. Maybe I forgot something, but thats it. Here some screens. Download dev: https://github.com/somatonic/teflon-admin-theme-pw2/tree/dev Thanks.
-
Small change to InputfieldFile.js to facilitate front-end HTML5 uploads
Soma replied to adrian's topic in Wishlist & Roadmap
Maybe this example will help you? http://processwire.com/talk/topic/2089-create-simple-forms-using-api/?p=21226 -
Small change to InputfieldFile.js to facilitate front-end HTML5 uploads
Soma replied to adrian's topic in Wishlist & Roadmap
I think PW has the config js outputed in head where also the admin path is. I created frontend form example which work with all fields also image upload. Will look for it later maybe its something different.