Jump to content

Soma

Moderators
  • Posts

    6,798
  • Joined

  • Last visited

  • Days Won

    158

Everything posted by Soma

  1. Look for id of the language page and look in the assets/files/id ... there you'll find the jsons.
  2. Sound strange as I don't see what you can do with yii what you can't with PW. It a bit like using yii with laravel.
  3. Good luck, we also have had projects in the past with lots of languages and en us version (not with PW) and it's a pain no matter what CMS. Often they don't really serve texts for each dialect specific, it's often just for a phone number or little text here and there. Annoying. Hard to decide what makes most sense without knowing the project in detail. Without thinking a lot maybe.. /en/page1/ /en/page2/ /es/page1/ /es/page2/ ..and have root home page urlSegments turned on. ..then construct your links /en-us/page1/ /en-us/page2/ /en-uk/page1/ /en-uk/page2/ /es/page1/ /es/page2/ if a url solves to a page that already exists PW will render the page itself, otherwise the path end up as urlsSegments in your home ( or urlSegmentsStr I think in 2.3.1 dev only) and in the home template have code to read urlsegments and load and render a specific page. /en-us/page1/ and /en-uk/page1/ mapping to /en/page1/ : if(count($input->urlSegments)){ // we have url segment(s) if($input->urlSegment1 == "en-us") { $input->setUrlSegment(1, "en"); $dialect = 'us'; } elseif($input->urlSegment1 == "en-uk"){ $input->setUrlSegment(1, "en"); $dialect = 'uk'; } $p = $pages->get("/".$input->urlSegmentStr."/"); // if url didn't resolve to a page show the 404 page if(!$p->id) throw new Wire404Exception(); // render the page and give it a $options['dialect'] echo $p->render(array('dialect' => $dialect)); } else { // output your home page ... } In page that are rendered this way will have the dialect set in $options['dialect'], which you could use to output different address or phone number. Maybe I'm missing something and written in the browser so take it with a grain of salt.
  4. Works fine here echo $page->title; // meine seite echo ucwords($page->title); // Meine Seite Also ucwords isn't multibyte save. So special chars don't get uppercase.
  5. To problem 2. After testing we found that in where the language suddenly changes from "fr" to "default" is where we in API modify a user (not current) and save it. Afterwards the $user->language is set to "default" of the current user. THe culprit seems to be that after $page->save() there's a uncacheAll called which cleans out the $user->language set on runtime. We have now a workaround to save language before to a var, and give it back to the $user after the save. But it looks like when saving a user in front-end the $user->language set by the language system is reset.
  6. A co-worker is desperate building a front-end project tool with 3 languages. 1. Now there a problem with new users and roles etc, that are saved as pages. They only have a name field with non language page names as normal pages. Now creating a new user, the status for each langauge isn't set to 1. Means it's not active! Now if I query a user with its name it doesn't get found from a alternative language. When in default language (front-end) $users->get("xyz"); // returns user correct When in a alternative language $users->get("xyz"); // returns nothing 2. Sometimes the translation in the front-end using the PW translator sometimes doesn't output the correct language even though the $user->language is "fr" the output is in some part is the german (default) text. This happens a lot on after a form submission. It makes no sense and we are lost how to find the issue. After outputting the $user->language in various parts of the code where it happens, it suddenly is "default" instead of "fr". Any ideas what could cause it?
  7. That function is now in core for use with WireArrays. This isn't only for pages. Just as an example with a stack of images: $fs = new WireArray(); $pa = $pages->find("template=image, image.count>0"); foreach($pa as $p){ $fs->add($p->image); } $f = $fs->findRandomTimed(1); echo $f->first
  8. Why not wait for Ryan to comment your same question in that other thread? http://processwire.com/talk/topic/2067-repeaterpage-delete-bug-report/ http://processwire.com/talk/topic/3172-orphaned-repeater-data/ http://processwire.com/talk/topic/2304-deleting-pages-with-repeater-fields/ but it's hard to help when the questioner don't respond to question anymore and Ryan couldn't reproduce, and some threads seems hanging because maybe they also created yet another thread. The repeater page you see when creating a new page are the precreated repeaters that are yet not used but ready to add.
  9. I'm not sure why you're asking because obviously you already got the solution answered yourself. RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] just before the # RewriteCond %{HTTP_HOST} !^www\. [NC] # RewriteRule ^ http://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301] Or doesn't it work? Just remember to keep the htaccess updated in case PW changes it.
  10. OK, .live() got remove in jquery 1.9, and PW is still using 1.8.3. http://api.jquery.com/live/
  11. Thinking about that you seem to have your app mainly working under "/members/". Why not just add that? $pages->get("/members/")->get("id=1733"); $members = $pages->get("/members/"); $members->get("id=1322"); And you don't have to care about trash.
  12. Yes it does work, as the I use the input names and in dimensions inputfield I set them to "fieldname_width, fieldname_height", so this seems to work fine.
  13. Any selector added to the id=id will work except include=all. It doesn't really matter what as it will ignore anything in trash anyway. (1001 is in trash) "id=1001" // will return the page if exists, bypassing a find "search" "id=1001,status=" // will search and return the page if exists, except if in trash "id=1001,status>".Page::statusTrash // ditto, even though the status says only pages in trash "id=1001,parent=" // ditto "id=1001,template=" // ditto "id=1001,parent=7" // ditto "id=1001,has_parent!=7" // ditto As Ryan stated get and find searches will never return pages from the trash. As soon as there's another selector found, it will do a pagefinder search and exclude trash and others that are not accessible by the user. So apart from it doesn't matter you could add a: ",status<" . Page::statusTrash Instead of the variable to add to all those get(id), you could create a function to search for a id exluding trash. // at the beginning of you template output, or something like _init.php $pages->addHook("getPage", null, "getPageNotTrash"); function getPageNotTrash($event){ $id = (int) $event->arguments(0); $event->return = wire("pages")->get("id=$id,status<" . Page::statusTrash); } // in your templates use echo $pages->getPage(1733)->title . "<br>"; But I'm still with my code previous, to check for if the page is in trash and trow an error.
  14. Ok I'm stupid, as I placed an exit in core to debug something... not my day I guess.
  15. Something strange going on as suddenly the latest wire version stopped working at all, after switching back. I then put in again older version and it needed two refreshs to get it work again. After changing again to latest it again stopped working at all. I now dropped in a new copy of the latest wire folder from the repo and it works again, even in bootstrap. Hmm.
  16. I'm just trying to do something in my bootstraped php file and it doesn't work anymore in latest dev. When I switch to an older version it works. Anyone got experience the same?
  17. Then why have a trash at all? You might swell just delete pages and not trash them in the first place. I'd vote for no because I want to get the page when using get(id). It's not searching.
  18. Thanks for mention, but this is not in latest stable (2.3).
  19. When I use a showIf on with counter>0, counter<10 it doesn't work, it shows the field when the integer field is 1 and hides it again with a value of 2. I also tested my dimension fieldtype and it got the same behaviour when I only write "dimension_width>0" it gets hidden when the value is 2.
  20. I was about to ask if its possible to add more info to the fields. Great addition thx !
  21. THen there's this $a->setTotal() $a->setLimit() $a->setStart() on page arrays we can use to configure built in MarkupPagerNav to work with merged page array in memory. Kind same as my above example but much simpler. /** * here is a example with using the built in pager * we can use $a->setTotal($n) to configure page array to work with pager */ // create new page array for storing pages $pa = new PageArray(); $res1 = $pages->find("template=mytemplate"); $res2 = $pages->find("template=house"); // import the found pages $pa->import($res1); $pa->import($res2); // configuration for pagination needed $limit = 10; $total = $pa->count(); $start = ($input->pageNum-1)*$limit; // example output with limited list we filter from the complete page array foreach($pa->filter("sort=-created, limit=$limit, start=$start") as $p){ echo "<p>$p->title</p>"; } // page array let's you set the parameters for pagination manually $pa->setLimit($limit); $pa->setTotal($total); $pa->setStart($start); // now the renderPager() on the page array works as usual echo $pa->renderPager(); Added this to the previous gist snippet here https://gist.github.com/somatonic/5420536#file-paginator_manual-php
  22. There's maybe. Because I'm lazy and do number_format($page->dimension->width/100, 2). I'm not really sure, but I never want(ed) to support a setting for float, as my experience with it is mixed and it would mean to make it a lot more complex than I really wanted for a first basic first version. Make it configurable may be possible but I currently have no plans. Also there's endless possibilities and I could also ask why not also support only w&h and volume and area etc Keeping it integer makes it more straight forward. I could also imagine instead consider making a module that does formatting for the field for you, I think it would be more ideal to do the calculation 130/100 on runtime, instead of making a modified version of the field.
  23. Yeah it is, and it's with what I feed my family ( I actually don't get the involved part, as I find ST to be the opposite of most other tools and IDE where I constantly failed to get involved)
  24. SFTP for Sublime is just awesome! There's nothing missing (touches wood) and you can even monitor local files like less or scss that gets preprocessed when saving and let sftp watch the css if they have changed through other tools and upload it (apart from the upload on save option this is really handy). super+ctrl+u+m to monitor and done.
×
×
  • Create New...