Jump to content

Search the Community

Showing results for tags 'get'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Product Groups

  • Form Builder
  • ProFields
  • ProCache
  • ProMailer
  • Login Register Pro
  • ProDrafts
  • ListerPro
  • ProDevTools
  • Likes
  • Custom Development

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests

Found 20 results

  1. Hi, I am currently using Processwire for a client project and am quite pleased with the ease of use and versatility. Unfortunately I came across a problem I am not able to solve: I have a multi-lang site where the home page path are as follows: www.example.com/ -> german (default) www.example.com/en/ -> english ... I build a language switcher that first gets the current page and then displays links for the page in all the different languages. <?php namespace ProcessWire; ?> <ul class="lang-switcher"> <?php $real_page = $pages->get($_SERVER['REQUEST_URI']); foreach ($languages as $language) { if (!$real_page->viewable($language)) { continue; } // echo <li>...</li> } ?> </ul> (I need to search for the real page because the language switcher is loaded inside of the menu which is an additional page/template which get loaded via echo $pages->get("title='Main menu'")->render(); . When using $page->localURL() I get the /main-menu page.) this works without problems for urls: www.example.com/ www.example.com/test www.example.com/en/test ... But not for: www.example.com/en/ I diagnosed that $pages->get("/en/") returns a NullPage instead of the english home page. Do you have any idea why this is and how to fix it. Thanks alot.
  2. With JS fetch() it is a bit tricky to get for example $_POST populated (params need to be FormData / forms), but would it possible to get PW $input (get, post, urlSegments, queryString) working for fetch requests? Is there a fix / hook / workaround to solve it PW side?
  3. Hi all, I've set up a filter on my product-page, which I then use to...filter my products! – I've got pagination set up, and 30 items per page. – When I active the filter it works perfectly (in my opinion). Here's what I'm struggling with though: When I'm on another page (filtered as well/or the total overview) and I put my GET request in for the filter, it gives back the result, but still with the page-number there. In some cases, this is no problem – like a A-Z or Z-A filter, but others (say, per location) I might have less pages. Visual/code ref: (I DO have 3 pages of authors, but I don't have 3 pages from London) url: books/page3?author=ascending url: books/page3?studio=london The current setup for my pages that get rendered are as follows: $allbooks = $pages->find("template=book, sort=$sort, $q, $tagged, $select_studio, start=0, limit=$limit"); As you can see I have the start=0 in there, but I read that's for the start of the pagination, not so much where it'll drop me in the search results. $q, $tagged and $select_studio are all empty values, unless they're returned from the GET request To repeat it, in it's most simplest form: When I click a filter, and a GET request is done, I want to 'reset' the page-number to 0, and get my results... Perhaps I'm missing something obvious, but I'd be really grateful to have your input.
  4. Hi! In busy learning to know PW better I'm looking at existing code. I have Bitpoets Editorial Responsive Blog as example. While looking through the code I've just found this line in the blog-head.php <link rel="stylesheet" href="<?= $config->urls->templates ?>assets/css/main.css?ts=<?= time() ?>" /> I hope it's not a stupid question but I've never seen this before... main.css?ts=<?= time() ?> I notice the main template is empty but of course renders on the front end. Using a timestamp really has me totally confused. Can someone explain it to me please. Thank you! Greg
  5. Hello, I have a search page loosely based on Skyscrapers where I'm parsing a selector with options 'beds', 'bathrooms', 'size' fields. It is working well until I select 'Any' after I've run a search. This is where no results are returned (/?beds=&bathrooms=&size=&submit=). I want it to reset and show all results. I hope this isn't too vague.
  6. Greetings, I've created a product database which all use the template product.php and are published on the website. I'm trying to create an overview table with pagination of all the products, but using $pages->get does not return an object, only the object title. $products = $pages->get("template=product, limit=10"); This returns 10 strings in the frontend but not the object. When looping over the result set to get product fields, i get the following error: Notice: Trying to get property 'title' of non-object Because the product database is fairly large, i've added a pagination using the same query and this does return all the pages, but i can't click on the links that the paginator renders. $results = $pages->find("template=product, limit=10"); if($results->getTotal() > 10) { echo $results->renderPager(array( "nextItemLabel" => "Volgende", "previousItemLabel" => "Vorige", "currentItemClass" => 'active' )); } I've added the option in the template to allow page numbers. When i navigate to the link manually, i still end up seeing the 10 first products. I've tried changing several settings around, but i'm a bit stuck on how to resolve these issues. Do you have any advice what I need to adjust? Thanks in advance for your feedback.
  7. Hi, well, here's something I just don't understand and didn't find an explanation in the reference for. I've got a number of pages: HomeAuthorTomas Tranströmer José Saramago Kenzaburō Ōe ... Nobel prize2012 2011 ... I created a field "author", type Page, which contains all these 3rd level pages (Tomas Tranströmer, José Saramago, Kenzaburō Ōe, ...). In the template used i.e. for /nobel-prize/2011, the "author" field is populated and contains the page ("Tomas Tranströmer"). Now I would like to create an output: $content .= $pages->get($page->author)->title; Confusingly, the output is Home although the output for $content .= $page->author; is 1026 and the output for $content .= $pages->get(1026)->title; is the desired Tomas Tranströmer So I seem to create a problem with using $pages and $page in the same line, but what is it exactly and how will I fix it? Thanks a lot!
  8. I'm in the process of rebuilding a WordPress site over into ProcessWire (Yay!) I'm using Ajax to call a page (ajaxAgenda) from the homepage which includes a PHP file (partialAgenda) which makes the call. This is what I got in the included partial. Notice that the URL has a / at the end to prevent redirection. var page_number = 1; var get_agenda = function(){ $.ajax({ type : "GET", data : {pnum: page_number}, dataType : "html", url : "/components/ajaxAgenda/", beforeSend : function(){ $('#ajax-loader2').show(); }, success : function(data){ $('#ajax-loader2').hide(); $('#agenda').html(data); } }); } And in the Ajax called file I have the following echo $page->url.'<br>'; echo $input->get->pnum.'<br>'; echo $_GET['pnum'].'<br>'; which only outputs "/components/ajaxagenda/". pnum is empty and get is also also empty It seems like the variables are simply being stripped from my Ajax call. Or am I missing something really obvious?
  9. Hi there, I'm trying to implement a hidden stats page to store various counters and I'm using this article as a basis for my PHP Code I've created a stats page based on a stats template, and the page is set to unpublished with no other attributes. What have I overlooked if the following code returns a Nullpage ? $stats = wire(pages)->get("/stats"); I can "get" a homepage without any issue for reference.
  10. Hello there I'll start right away: Let's imagine we have a index page: example.com/recipes This index page is also a faceted search accepting GET params for search query, categories, tags, ingredients, ... It would be amazing to be able caching this index page to a certain degree. For example: The GET param categories is somewhat limited. There are only 5 categories in total so it would not add too much overhead. If I could add this GET param to a whitelist and set the total allowed GET params to 1 for example, this would make a great difference in performance. (If we consider there are main navigation links pointing to the faceted search with one category preselected) This would result in cache entries for: example.com/recipes/ example.com/recipes/?categories=cooking example.com/recipes/?categories=bbq While requests like: example.com/recipes/?query=foo example.com/recipes/?categories=cooking&ingredients=cheese ... would not overwork our cache Is this already possible with core modules? (MarkupCache is not really the answer I'm looking for) Is it possible with Pro Cache? Of course since it's an index page: We have pagination to consider as well...
  11. Is there any way to return <?php $sectors = $input->get->project_sectors; ?> as the titles, and not the names? So instead of, for example, it returning landscape-design (the name) it would return Landscape Design (the title). Thanks, R
  12. Hi, I'm probably missing something trivial, but for some reason I can't retrieve GET input values. Consider the following simple piece of code, named whatever.php : <?php echo $input->get->id; echo " -- "; echo $_GET['id']; ?> I make it a template, then a visible page, then I try to access http://example.com/whatever/?id=foobar but it only prints " -- " (i.e. the second echo line). I tried to make "id" a field of the template but it didn't help. What am I doing wrong ? Is it related to rewrite rules ?
  13. Hello, I'm wondering if this aproach is correct, had not been tested yet. What I'm trying to do is Log In an user from one browser and keep the user logged in a different browser. example: I have an app and send a login command to a processwire backend, the backend respons with the user id if the login was successful. http://example.com/login POST (encripted): username password response: 123 The code begin could be $username = $input->post('username'); $password = $input->post('password'); $user = $session->login($username, $password); if($user){ echo $user->id; } Then I read the User Id and open a new browser like this http://example.com/user/123 And the website checks if the user is logged in and opens a section only for logged in members. because PW saves the sessions in the server I think this could work. The code for this would be $userId = $input->urlSegment1; $user = $users->get($userId); if($user->isLoggedin()){ $session->redirect('/private/'); } else { $session->redirect('/'); } Thanks in advance
  14. Pretty new to processwire and really enjoying it so far. I'm trying to build a pretty simple Ajax driven website (pretty new to me so excuse my general ignorance regarding ajax) which inserts content from child pages into a parent page. I've read through Ryan's thread here which was super helpful, but still can't quite figure out the best practices for what I'm trying to achieve. For now, all I'm trying to do is have the parent page load content from a child page with an ajax request, BUT these child pages also need to be inaccessible via the URL processwire creates for them. So the child pages are hidden via their template's access options. The /parent/ page successfully loads some initial content from these child pages using the "include=all" selector ( $pages->get("/parent/")->children('include=all'); ) as recommended in this thread. However as the child pages are hidden any ajax request to pull data from them results in a 404. If anyone can suggest the best practices for using processwire to create a site like this it would be a huge help. I assume that later I may have issues with linking/indexing by using this approach, but am happy to figure those out later.
  15. Hi Guys, I am absolutely loving Processwire but need some assistance in a custom build. I have created a repeater for an internal page. I need to pull the data using GET or some other way to display the first five repeated sets onto my home page for my featured items section. Is this possible? If so, any examples? Guidance? Your help is much appreciated!
  16. Hi there, I've got two templates that need some of the same fields. So, is it possible to get a field value from another template? So when I update on one template, I update on all other fetching this field? Thanks
  17. Hello, I am following the Basic Website Tutorial http://wiki.processwire.com/index.php/Basic_Website_Tutorial After creating the site settings page and uploading an image to the header_banner img field, the tutorial says to include the path of the image file like so: I changed it to this: However, they should be the same. But unfortunately my image is not showing up. When I pull the code inspector in Chrome, this is the HTML that I see. When I go into my remote folder and navigate to site>assets>files>1008, I see two files: the original jpg I uploaded (pwtut-header.jpg), and one other one (pwtut-header-1.0x100.jpg). What is going on here? Has there been an api change since that tutorial?
  18. Hi everybody, I have got a (hopefully) pretty simple question but I can't find a "clean" solution for it and hope you can help me. I'm using a form to let the user specify different variables (Get Request) and show them the according pages. It's more or less similar to the Skyscraper Demo page. Now I'd like to add three links to set the limit of my query. So if the user clicks on e.g. 10 -> only 10 pages should be listed (leaving the other variables the same). I'd like to generate links with the current URL but change the limit variable. Is there a function to get the current URL with all the get parameters and let me change/add one of them? Or do you have any other suggestions how I could add this functionality? Thanks for your help!
  19. Hi, I am sanitizing some variables coming in via GET through Ajax as follows before passing them on to a selector. Is this the correct way of doing it? Secondly, can I instead type cast where I am expecting integers? Thanks. $sort = explode(" ", $sanitizer->selectorValue($input->get->SortX)); $sortOrder = $sort[1] == "DESC" ? "-" : "" ; $sortValue = $sort[0]; $start = $sanitizer->selectorValue($input->get->StartX); $limit = $sanitizer->selectorValue($input->get->SizeX); //Would this suffice as well since I am expecting integers here? //$start = (int) $input->get->StartX; //$limit = (int) $input->get->SizeX; //What about this (access as array index)? //$start = (int) $input->get["StartX"]; //$limit = (int) $input->get["SizeX"]; $results = $pages->find("has_parent!=2, id!=2|7, include=all, start=$start, limit=$limit, sort=$sortOrder$sortValue");
  20. I'm trying to get Paypal express checkout working... After going through the process, paypal redirects me back to my site where I'm supposed to grab the get variable 'token' anyways, I could never see it, and finally tried getting paypal to redirect to a page outside the PW site with the same code. The variables were now there. Come to think of it, I haven't been able to post forms to other pages either. The forms work when they post to themselves, but not when they post to other pages. Is this a security measure so that people cannot post false values to the page? Perhaps there's a setting somewhere I can change? EDIT (Solved): I went to setup => templates => template name => urls and I set "should page urls end with a slash?" to NO. EDIT (Even Better Solution): Make sure my return urls have slashes on them, also my urls in forms. Thanks Soma!
×
×
  • Create New...