Jump to content

bwakad

Members
  • Posts

    450
  • Joined

  • Last visited

Everything posted by bwakad

  1. I have read the part you mentioned. So PW 'wire' is doing what PHP 'global' is doing? What I meant was: if I want to get or find a page(s), I need to use wire page or wire pages... then I can use the variables/fields from those pages?
  2. mentioned it some days ago to ryan. He would look into it. although I was thinking about make it with PW. But it's true, the forum uses IPB
  3. "wire" if used in a function. I know about: wire("page"), wire("pages"), wire("user"), wire("users"), wire("config"), wire("input") But, is there a rule for this? Does this has to do with get() or find() ?
  4. Did not found a good way for the slash and am uncertain if rewriting url is in fact a good way. Then I tried to give the link a page name which does not exist. When I click on that I will in fact stay on the existing current page, and the browser url will display the non-existing page name after it. That's url segment ! Which was in the beginning hard to understand for me . So that will solve the issue of the slash by default, and with pagination the page(nr) stays at the end. Now I start rewriting some code to use this. But I want to thank you, for your help on the $input wire. Learned a lot.
  5. Maybe next time. Unfortunately yesterday I cut a muscle on top of my knee. Walking is not good now. But if you go, I mentioned an idea I had for PW: to make a location map displaying members on this forum. Should be convenient to plan these meetings in future. Just look on the map and see where more people are located. Or take some place in the middle.
  6. lol. Beginning to think I talk hebrew / turkish or something... but it's really simple. Look in my first post, the second code!!! I am talking about a link: <a href="<?php echo $page->url;?>?sort=title">Title ASC</a> (this is a link!!!) Which translates in the browser url as: http:host/pagename/?sort=title But with pagination is: http:host/pagename/page2?sort=title I am after this: http:host/pagename/page2/?sort=title And I responded to mindfull "if I use it like /?sort=title" the link will translate as: http:host/pagename//?sort=title (double slash) And with pagination is: http:host/pagename/page2/?sort=title (correct)
  7. This is probably why I go over my (same) code every day. Just to make the same with less code as possible. In some parts of my code I prefer switch(). More easy to read then IF and no need to use {} to much. But depends on what I want of course.
  8. Just want the slash behind the page(1). Thought is was obvious, since I mentioned it twice. I see something in the $config section: $config->pageNumUrlPrefix but that is for BEFORE the 1 as in PAGE1 and what I would like is page1/
  9. That's not applicable since $select in your example represents one of the pages found in my page array. The link I use is displayed on a current page, to send a ?sort=value through the browser url. The foreach comes after that link. ps. If I use /?sort= it will mean: /pagename//?sort= <<<<<<<<<<<<<<<< here it will not work... /pagename/page2/?sort= <<<<<<<<<<< this is what I need: / after the page1 or page2 etc
  10. Ryan suggested it's alway's better to use $input->get... I am not sure how to do this for my link, maybe it need to be changed I think? But I hope someone can give me a solution to my pagination problem. EDIT - based on Horst suggestion --------------- but still some issues $input = wire("input"); My link on the template is this: <a href="<?php echo $page->url;?>?sort=title">Title ASC</a> In my function the code to retrieve the url is this: // get variable sort from url $sort = $input->get->sort; switch ($sort) { case 'title' : $sort="title"; break; case '-title' : $sort="-title"; break; case 'id' : $sort="id"; break; case '-id' : $sort="-id"; break; default : $sort="{$page->name}"; break; } Then I looked for hours in the forum and finally used this from the skyscrapers, thinking sanitizing is good: // Do we have a get variable? if ($input->get->sort) { // Sanitize it $sort = wire('sanitizer')->name(wire('input')->get->sort); // Add it to the whitelist... with the same name as the get var! $input->whitelist('sort', $sort); } I know there was something like: selectorValue, but I was unable to use it in the function My $selector now is this (without a comma at the end), other wise I get errors: // create selector and expand with $sort value $selector = "template=child-template, limit=4 " . trim($selector, ", "); $selector .= ", sort=$sort"; Printing out the $selector while working displays: template=child-template, limit=4, branche Finally, at the end of my function, after my $pages->find($selector); I have this code for my pagination, now it uses the values: $pagination = $selects->renderPager(array( 'listMarkup' => "<ul class='MarkupPagerNav pagination'>{out}</ul>", 'currentItemClass' => 'current' )); This is now the only thing need to be adjusted: My url's at the end now look like: /pagename/page2?sort=title Not sure if /pagename/page=2/sort=title /pagename/page2/sort=title would be better, but it would be easier for the eye. Just don't know how to get the / after the page number...
  11. Welkom Jurgen! Like you - I and many others have used anything out there to build. Some succeeded, I personally failed with Joomla and WP. I was playing with PW for a month before I really got the hang of it's basics (and API / cheat sheet), but now this last month, I build a little piece of what I want to accomplish every day. And every day, I also learn PHP, which is something I recommend everyone. I hope you like the forum and PW. And good luck with building your dream!
  12. Ah, okay. Now I understand it better. Thanks Raymond.
  13. :) even www.treasury.gov uses processwire !!! :) https://www.google.nl/#q=sort+results:processwire/talk&start=30 ps. just a joke: they use in-process wire transfer, but talk about promoting...
  14. Still did not found a solution. I now use this code before I construct my $selects = find(). My $selects is the variable for the find(something). Then after I get results, I thought, when $selects IS declared, this IF statement would run. I do not receive errors, but the sort() is not picked up. I made spaces here between the () for readability: if ( isset ( $selects ) ) { $a->getArray ( $selects ); if ( $_GET['sort'] ) { $a->sort ( $_GET['sort'] ); } $selects = $a; include ( $layout ); } else { // continue with normal code
  15. was trying to do it before the find() gets in place - But do you mean find() with sort is faster, find(), then store, then sort is slower? I always thought, the last was less resourceful / better for server? case '1006': // id of current page if ($_GET['title'] == "asc") { $by = "title"; } elseif ($_GET['title'] == "desc") { $by = "-title"; } elseif ($_GET['id'] == "asc") { $by = "id"; } elseif ($_GET['id'] == "desc") { $by = "-id"; } else { $by = "{$page->name}"; } $selector = "template=child-template, limit=4, sort={$by}"; break; I am not sure what is best now: A. use the $_GET before I find(), B. use the $_GET after find(), first store, then use sort. in case of B, I would not know how to do this after the find() is created. but in any way, after of before, I guess the pagination will not account for the $_GET in the url.
  16. So, installing that, and then import my pages and fields? Although, I am not sure how to accomplish that without importing old core...
  17. Thanks for explenation! But to be clear, the $input->get is not explicitly set for input fields? I thought is was because of the word 'input' and in the API it is explained under inputfields. Then, I need to do the same for links sending through url?
  18. Been looking on internet and in this forum, and could not find any examples. So I am not really sure on how to do this, but suppose I have a selector which returns me some items, depending on returned quantity : with/without pagination. I want to make a top bar with some links for certain fields like "date ASC / DESC", or "company". Once clicked on it, it will sort those results. Now, to use a link value and to GET that value on a page is not a problem. But, is it wise to (again) use $pages->find, or is there another way of doing this? I need to do this from within a function. In the API I found getSelectors(), sort("property"), and similar. But to be honest, I am not sure how to capture my returned results. - - - - - - - EDIT - - - - - - - actually, the pagination part is not required. Let's face it, if I am on page 3, and do another sort, I would like to be on page 1 after the sort.
  19. Unfortunately, my development is still on-going, and do not have much pages to work with this. Assuming, dev branch is an update to the core... But I would like to help analyze test results if it can help.
  20. I worked many years in data-centers. I'd prefer a data-center anytime. Why? because the risk of entrance, fire, water, electric failure, and much more are taken care of by people on location. Battery rooms are always there as backup, just as generator rooms. And for electricity companies, those data-centers are well taken care of. You can't simply have all of these things in your house...Imagine a block where you live have electricity failure : not so important to electricity company. But a data-center does, it holds hundreds of companies on servers and they can all claim loss at the data-center, which in terms claims at the electricity company. I know, because I worked at those and I have seen the contracts.
  21. The only thing I notice here is: 1: single number - bottom winner 2: single word - bottom winner 3: multiple words - top winner 4: single word AND single number - bottom winner 5: single word AND single number - bottom winner 6: multiple numbers - top winner 7: multiple numbers - top winner Based on Ryan's test - looking at the selector - I could say: Using multiple reference of the SAME kind = CALC Using single reference of ANY kind = COUNT Using single reference of DIFFERENT kind = COUNT Hope this fresh view helps...
  22. Not sure if this is going to help you, but in the netherlands we have a hosting provider which have received 'best hosting' for several years. Look up antagonist.nl if you interested. I am sure it will be no problem since you not far away. I always use it, no errors, quick response, low costs, and fast servers, etc
  23. As far as I can tell, the 'name' and 'label' in the admin part can not be changed. Values can. It is best if you place your code here so the forum users can help you.
  24. Keep solving my own topics! great to study PHP.
  25. Solved it by (again!) study php on lynda.com... I simply had to send the value through url (I think because the value is not a page)... My pages can all be browsed by the browse.php template. This template has only one function echoed out. That function determines what the page id is, then create the selector, then include the browse.inc for layout. In short, all my displayed field values are links to search the way which I control by the function. Displayed link on browse.inc is this code (sorry if its not clearly readable): // store value in variable $min = $child->uren->min; //in the link I send the value through url with ?min=xxxxx <a href="<?php echo $config->urls->root; ?>/uren/range/?min=<?php echo $min;?>"><?php echo $child->uren->min;?></a> In my function I use this case '1192': // id of current page $min = $_GET['min']; $selector = "template=child-template, uren.min>={$min}, sort=uren"; break; // later on I use $selects = $pages->find($selector); // then include file for display again include("browse.inc"); Great to study php!
×
×
  • Create New...