Jump to content

Search the Community

Showing results for tags 'api'.

  • 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

  1. Hi everyone, i want to create a user on the fly with sso, i recieve the password already hashed and want to save the user without having the password hashed by processwire afterwards. so far i could leave it rehashed in the database as long as the customer does not want to allow the users to use the direct loginmask. but if that changes, i would be in trouble. so is there a processwire way to do this or do i have to put the user in manually. i know we will have someone intelligent helping me out here
  2. TL;DR : I'm looking to create dynamic forms which will take fields list from given template & create/save pages dynamically. Hello, I've been using PW for a while for creating web applications like ERP systems and similar applications which have tons of forms. So far I've been creating, processing & validating them manually. While researching I found this link which I found to be very helpful. Code given in that example allows user to create a form based on the fields of any page and save it, which is very cool. Based on that code I tried doing something like this: $p = new Page(); $p->template = "mytemplate"; //I've added few fields to this template $p->parent = "/someparent/"; $p->of(false); // make a form $form = $modules->get('InputfieldForm'); $form->method = 'post'; $form->action = './'; // add the page's fields to the form $form->add($p->getInputfields()); // add a submit button to the form $submit = $modules->get('InputfieldSubmit'); $sumit->name = 'submit'; $form->add($submit); // process the form if it was submitted if($input->post->submit){ $form->processInput($input->post); $p->name = date(dmYhisn); $p->save(); } It did create a page but without any data. I know this could be a very stupid thing to try, but I guess it was worth it. More research taught me that probably using ProcessPageAdd module I can create new pages. But I don't know how exactly that works. I'm looking for some guidance about modules & their use on fron-end. Thanks.
  3. Hey guys, I'm creating a form via the API where a user can create a page and click to "create and duplicate". The idea is that this reloads the form with a GET variable to the page just created, takes the image from that page and also adds it to the new duplicate page. Essentially there may be 4 pages created but they should all share the same file. Would it be necessary to create a new WireUpload on every page creation or is there some way to do the following (or some variation): $duplicate_page->file->add($just_created_page->file); OR $duplicate_page->file->add($just_created_page->file->url); I don't seem to be able to pull this off but perhaps it's because the WireUpload needs to take place on every page creation.. Anyone had any experience with this? Thanks
  4. Hi all, I am building a page that contains a quite complex request form. To do this, I created a page based on a "contact-form" template, and inside this template I put all the code needed to display the form and manage the results. The form is built using PW API, the code is inspired from some examples I found here on the forum. My problem is that I don't know how to insert a text paragraph between the fields, anyone has idea on how to do this? Here's a very simplified version of my code (only two fields displayed), in this case I would like to append a custom paragraph (simple html) between Company and Name fields. The only solution I found is to use an additional field of Fieldset type, without content, and on the label I set the text I need to output. However in the label field I am not able to insert html tags... Any help is very appreciated... Thank you! // create a text input $field = $modules->get("InputfieldText"); $field->label = "Company"; $field->attr('id+name','company'); $field->required = 1; $form_fields[] = $field; // create a text input $field = $modules->get("InputfieldText"); $field->label = "Name"; $field->attr('id+name','name'); $field->required = 1; $form_fields[] = $field; // submit button $submit = $modules->get("InputfieldSubmit"); $submit->attr("value","Send"); $submit->attr("id+name","submit2"); $submit->skipLabel = '4'; // create the form field (also field wrapper) $form = $modules->get("InputfieldForm"); $form->action = "./"; $form->method = "post"; $form->attr("id+name",'contact-form'); foreach ($form_fields as $field) { $form->append($field); } $form->append($submit); // append the form in $out variable $out .= $form->render();
  5. Hello, I´m trying to make a REST API with PW. is there something like $wire('input')->get and $wire('input')->post but for the verbs delete and put? also how can I separate the code for each verb. example: I have the following endpoint /users/emails Processwire can detect what verb is beign used to call that endpoint? (automatically call the corresponding code paired with the verb) or I have to manually check it and execute the corresponding code, using an if or something similar. basically I am looking for a router like Lime https://github.com/aheinze/Lime If PW does not have a router, using wire('pages') inside Lime it´s possible without conflicts? Thanks.
  6. Hi everyone, sorry if this is a duplicate question but I cannot seem to find the proper way to achieve what I want. I need a way to store and retrieve the datetime of users' last login so that I can display a list of pages that have been updated since the user was last logged in. I've been trying to accomplish this with hooks but I can't figure out where to store the login date. I feel like I should be able to do this with just $user->get and $user->set, but it seems like these only hang around during the current session? Do I need to extend the User class in a module or is there another way to add a field to the User class? Thanks in advance!
  7. Our web application is restructuring that will seperate content (PW CMF) and logic (PHP Framework), PW will use to manage content easily. Is it possible to get the page data and put it on other PHP Framework?
  8. Hello, I've searched the forums and API page etc, but I've not really found a great deal of information regarding $session->hello = "Hello World!"; etc. I know what it does, but I don't know the technicalities of it. By this I mean, is it safe to temporarily store a couple of paragraphs of text in a session variable while a page is redirected for example? e.g $session->quotedText = "A couple of paragraphs of text would go here....."; $session->redirect($someUrl); // Get the stored text from the new page $value = $session->$quotedText; Echo "Quoted text from the previous page... " . $value; I can't see anything wrong with this idea, but I'm probably missing something as I can't seem to find many uses of it? Is this an improper use for session variables? Thanks.
  9. Currently we have those to access for example 'pages': // in templates $pages->find('something'); // in functions or classes not extending WireData wire('pages')->find('something'); // in classes extending WireData $this->pages->find('something'); // or even a deprecated old way $this->fuel('pages')->find('something'); I propose to implement yet another way: Wire::pages()->find('something'); // or Wire::config()->debug; // or Wire::input()->urlSegements; It would just be a matter of adding those in the Wire class: public static function input() { return self::getFuel('input'); } public static function pages() { return self::getFuel('pages'); } public static function page() { return self::getFuel('page'); } // and so on ... Perhaps it's just aesthetics, ... for my eyes it's definitely way more pleasing. What do you think?
  10. Hi all I have built my own module for processing forms on my site. The module does check to see of the request was forged or not, but I am unable to inset the token name and value into my template. I use Twig for my templates, and this is what I'm calling: <form data-form-ident="contact-form" data-form-token-name="{{ this.session.CSRF.getTokenName() }}" data-form-token-value="{{ this.session.CSRF.getTokenValue() }}"> The output for that is an empty string. Could it perhaps be because I am using Twig? Side note: disabling Twig is not an option as the templates I'm using are very complex - it would be a darn mission to revert to native PHP. (PW 2.4.0)
  11. Greetings I'm new to PW, and think it's fantastic! Never, ever, have I seen such an amazing CMF! Anyways, to my question: I had set some Hanna Code to render a list of page suggestions on the http404 page, which works perfectly. The problem, however, comes in when I use repeaters, which are page instances. The page suggestion renderer has the following: $suggestions = $pages->find('name|title|summary|body%='.$request); I have a page that is named services-industries, and repeaters with the word services in the name. As such, repeaters appear in the suggestion results-list if applicable to the search. How can I exclude/remove those?
  12. Hi Guys, Im at a point in my project where I have front end user registration, login capabilities and posting of page capabilities by registered users. The users can also edit their own page. Its pretty much a clean site that is made to function like Craigs list but look like a personal ad site. I have used ryans method for registration, profile control and login. All is good so far! Now in profile template which I call their account management page, a user sees all their pages they have posted. The user can click the link to their page to front end edit their pages content. I would like to also give them ability to unpublish, republish or delete their page. Any thoughts or ideas? The way I invision it, a script checks to see if the user has access to edit the page, which I have done. Then the user can edit via fedI front end editor module. Now I need to display a button unpublish, a button to republish and a button to delete. Any guidance is appreciated.
  13. Basically, I created a site for a client that is a marketing and advertising site for personal ads. The site is intended to allow a user to view the site and if the user wants to post a personal ad to promote their services such as music performing, dancing etc. they can for a small fee. (It's pretty much like back page.com and craigslist.com without the ugly design. More focused to look like a website, with 1 page personal ads.) Currently the site is using the latest Processwire release on Foundation framework. I have users coming to the site and if they decide to post, they click on a link located on the bottom that says post new profile. Once clicked, they arrive to a page that has a form builder embedded form. I am using form builder forms to process the user information and create a new page under the category of their choice. This is working and creates pages quickly for anyone that wants to post an ad. (I was advised not to use this method but due to lack of time, I had to run with Form Builder.) Here is what the system does now: Once a user completes the form, they submit the data and the page is automatically created. The user receives an auto response email with a message asking them to make a payment via a link contained in the auto response email. The link goes to a paypal subscription. Once the paypal subscription is paid, we are manually sending the user a user name and password to manage their page through a front end editor that we setup in Processwire. If they do not pay in 24 hours, we manually delete the page. As far as spam goes, we only have the spam filter enabled on the forms with the turing test question and answer. Here is what I need the system to do: I need help setting up a way to ask for a credit card first, then process the card for the payment, then post the page. I also need help redirecting the user to the newly created page after they have submitted the data through the form builder form. I also need a way to automatically create a user and password and assign it to the newly created page. I am up for any suggestions and welcome all of your input. I would like to essentially make this an automatic type thing. Where all we are doing is checking to make sure things work. Versus manually adding users, manually deleting pages etc. I AM OPEN TO ANY SUGGESTIONS ADVICE, ASSISTANCE ETC. Feel free to PM me as well. If a heavily experienced user feels that they can accomplish this build another method via API etc. please provide some guidance. Again, thanks so much to everyone in this community that has enabled me to learn more, create great things and accomplish tasks, Processwire is truly amazing!
  14. Hi Guys, I have a membership site that I am building. The site is simply composed of user profiles, basically like craigslist personal ads. I need to give the member access to a their profile ad/page for editing of fields located on their ad/page. This access will be given to paid members, once the page has been added by me. The user should have access via a user name and password. They will only be able to edit their ad/pages fields I have with their information. Question 1: Is this possible on ProcessWire? Question 2: Any guidance to where I can start? (Modules, API etc.) Question 3: I have a check box field on the profile ads/pages which I control that allows me to deactivate the page if it is un checked, I also want this to block their access. Can this be done? Any help on this would be great! As always, everyone has been great with helping me find solutions to my questions. Thanks!
  15. What is the best way of interacting with an external API within ProcessWire: (in this case it's FoxyCart but it could apply to any external API) 1. Store API data (eg customers, transactions) as pages in ProcessWire. Pros: - Can take advantage of PW's admin interface and upcoming Lister module - Better performance/user experience Cons: - Setup time. - Duplication of data (will need to have processes to keep local/remote data in sync) 2. Just pull in the data to the site through the external API as and when it's needed. Pros: - Quick setup - Data stored in one central location Cons: - Cannot use much of the in-built ProcessWire functionality for viewing/managing data. - Potential performance degradation Any thoughts are welcome
  16. Hello community, I am trying to create a field using API. Basically field should have a type of FieldtypeTextarea and InputfieldTinyMCE as inputfield. Here is my code : /* Create new field using API */ $field = new Field(); // Set type as FieldtypeTextarea $field->type = $this->modules->get("FieldtypeTextarea"); // Set inputfield as InputfieldTinyMCE. But no luck $field->set('inputfield', 'InputfieldTinyMCE'); // Name of the field $field->name = 'footer_region'; // Set label $field->label = 'Footer region area'; // Save $field->save(); Above code will create a new field with the type of FieldtypeTextarea. But it want assign InputfieldTinyMCE as the inputfield. Any advise please Thank you
  17. Plase correct me if something is wrong, I'm still learning the processwire way xd. According to the API Docs http://processwire.com/api/variables/page/ $page->path The page's URL path from the homepage (i.e. /about/staff/ryan/) $page->url The page's URL path from the server's document root (may be the same as the $page->path) So I have to migrate a site from development to production server and all the links were messed up. Why? Because I was using $page->path for redirects. Changed redirects to $page->url and Presto! everything works fine. And, When to use $page->path? Use $page->path when importing other page. example $people = $pages->get('/system/people'); $friend = $pages->get($people->path . $input->urlSegment1); Use $page->url when you need a redirect $session->redirect($friend->url);
  18. Hello, I recently discovered this tool http://www.kimonolabs.com/ that let you turn a website into an API. So far so good. I'm trying to imagine how to deal with json in PW. I'd like to output the data on a single page. What's the best way of doing this?
  19. I have an image 500x300 I need to apply the resizing to 150x150 without cutting edge. Thus in any case, I need to have the image canvas size 150x150 When you use $ image->size (150, 150), we obtain the desired result (cropping). When using $ image->size (150, 150, array ('cropping' => false)) our image circumcised according to the greatest height, canvas change proportionally. / / 150x90. Need an image 150x90 position in the center of the canvas 150x150. You can do this using the API?
  20. Hi, I've recently moved from Modx Revolution to Processwire and so far my experience with the platform has been great! The jqueryUI admin is much faster as compared to Modx's extJS manager. kongondo's article for those transitioning from Modx has been very helpful. Link - http://processwire.com/talk/topic/3691-tutorial-a-quick-guide-to-processwire-for-those-transitioning-from-modx/ One of the things that really bugged me about Modx was the slowness of getResources. Even after optimising and caching the getResources call, it would still produce slow response times if the number of resources were high. Now, I understand that the equivalent of getResources in Processwire is $pages->find("selector"). My question is: Has anyone had any experience with running $pages->find("selector") api call on over 10,000 pages? What are the response times like? Thanks
  21. Hi! I have been struggling with this for the last few hours and could not find a solution for it anywhere on the forums. I want to create a repeater field using the API and then add fields to it programatically. I can create the field and assign it to a template alright, but I can't assign any fields to the repeater itself. I've tried using $field->repeaterFields when creating the field but cannot figure out what it's supposed to accept. I tried passing it an array of IDs as well as a fieldgroup, but I couldn't get either to work. Any ideas?
  22. Just gettiing started with ProcessWire with limited php expertise. So far I'm really likely it, and I'll probably switch to using it instead of WordPress. The learning curve is pretty friendly, but it would be a lot nicer if their were some examples on the api as well as the brief description. Just a thought.
  23. For example: It is necessary for you that all photos in galleries of "participants" would be in jpeg. But different types are allowed for loading, and all of them will be cut off in compliance with the type. I suggest to choose expansion in which the reduced copies of the image will be converted, it can be both control for a field, and expansion for API Image $image->ext() //jpg $newImage = $image->ext('png') $newImage->ext() //canonical png convert
  24. My organization is looking at moving our various websites to a CMS. As we have probably 20 - 30 sites, I want to do a multisite setup, using the multisite module, so that we don't need to maintain so many duplicate user accounts for our content editors. I'm wondering how I'm supposed to hook into $page->rootParent to get it to return its appropriate child. I'm thinking I'll setup the page tree so that Home is just a dummy page, and all my real sites' homepages will be its direct children. That way I think I should be able to make the change to the rootParent method universal without having issues. How could I accomplish this? Am I making some horrible mistake which I have been unable to percieve thus far? Thanks.
  25. I'm building a custom web service to service a mobile app from a PW site. I'm very exited to extend the site's functionality with PW's flexibility. I would like to check if what I'm doing is 'safe' and I'm not overexposing the site to vulnerabilities. 1. The site should serve a json file when accessing a specific URL. I like to keep my site's URLs with a /json to keep everything mirrored in my template files. products.php ?php /** * Productos template * */ if ($page->name == 'productos' AND $input->urlSegment(1) == 'json' ) { include("./productos.json.php"); die(); } if ($page->name == 'categorias' AND $input->urlSegment(1) == 'json' ) { include("./categorias.json.php"); die(); } include("./head.inc"); ?> // ... GOES ON 2. The template in charge of generating the JSON output. Loosely based in Ryan's web service plugin. Is there something dangerous in here? products.json.php <?php /** * Productos JSON * */ // $_GET Variables from URL $types = array( 'limit' => $input->get->limit, 'sort' => $input->get->sort ); $params = array(); foreach($types as $name => $type) { $value = $input->get->$name; if($value === null) continue; // not specified, skip over if(is_string($type)) $params[$name] = $sanitizer->text($value); // sanitize as string else $params[$name] = (int) $value; // sanitizer as int } // Set defaults if(empty($params['sort'])) $params['sort'] = '-modified'; // set a default if(empty($params['limit'])) $params['limit'] = 10; // set a default $params['template'] = 'producto'; // Build query string to search $new_query_string = http_build_query($params, '', ','); // Find $q = $pages->find($new_query_string); // Results $result = array( 'selector' => $new_query_string, 'total' => $q->count(), 'limit' => (int)$params['limit'], 'start' => 0, 'matches' => array() ); $categorias = $pages->get("/categorias/"); $soluciones = $pages->get("/soluciones/"); foreach ($q as $i) { // ... // PREPARING some variables // ... $result[matches][] = array( 'id' => $i->id, 'template' => $i->template->name, 'name' => $i->name, 'created' => $i->created, 'modified' => $i->modified, 'url' => $i->url, 'producto_thumb' => $product_thumb, 'producto_imagen' => $product_images, 'producto_packaging'=> $product_pack, 'producto_ficha' => $product_sheet, 'title' => $i->title, 'producto_bajada' => $i->producto_bajada, 'body' => $i->body, 'categorias' => $product_categories, 'soluciones' => $product_solutions, 'calc' => $i->calc, 'rendimiento_min' => $i->rendimiento_min, 'rendimiento_max' => $i->rendimiento_max ); } // JSON header('Content-Type: application/json'); echo(json_encode($result)); 3. Finally, this seems to be working ok, but I was wondering: a. How can I check for products modified since date X? b. How can I notify the web service that a product has been deleted since date X? PW moves files to the trash and I would like to keep it that way but I can't imagine how to notify the webservice!
×
×
  • Create New...