Jump to content

Manol

Members
  • Posts

    290
  • Joined

  • Last visited

Everything posted by Manol

  1. Trying to resize an image that way but gives me a 500 error //OPTION A (500 error) echo "<img src='{$page->images->eq(0)->resize(340,480)->url}' alt=''>" //OPTION B (500 erro either) $myImage = $page->images->eq(0); $myResized = $myImage->resize(340,480); echo "<img src='{$myResized->url}' alt=''>"
  2. I Installed a fresh processwire classic-site in an Ubuntu 16.04 machine to check if it would work, but still can't access other pages than the root one.
  3. With virtualmin installed, you get virtual servers and the path for each one is: /home/myweb_1/public_html /home/myweb_2/public_html /home/myweb_3/public_html
  4. Hello. I host my pages in AWS, I had all installed in a ubuntu 14 with virtualmin and all worked perfectly until I installed a new machine with ubuntu 16.04 (php 7...) now all subpages and /processwire point to the root url. I've followed those links without exit. Has anybody faced the same problem?, Any ideas?
  5. Yes I'm running PW 3, thank you BitPoet, now is working perfectly.
  6. Any ideas how to solve: Error: Class 'Pagefiles' not found (line 38 of /home/aristol/public_html/site/modules/FieldtypePDF/FieldtypePDF/PagePDFs.php) Thank you.
  7. To install a fresh pw site I use a bitnami server that way: wget https://bitnami.com/redirect/to/100724/bitnami-processwire-2.7.2-1-module-linux-x64-installer.run chmod a+x bitnami-wordpress-4.5-1-module-linux-x64-installer.run sudo ./bitnami-wordpress-4.5-1-module-linux-x64-installer.run It installs pw under /opt/bitnami/apps/processwire. Is there an easy way to install multiple instances of pw in different folders?
  8. Is there a possibility to preselect a radio button list option in the field?
  9. Hi nmendes, awesome module, don't know if you're still maintaining it. I think a couple improvements could be done: Would be the possibility to mimic the pw structure under a folder within a bucket that way many different webpages could use the same bucket ( because the number of buckets per user is limited) That one would be the best if you could. Not mimic pw structure but use S3 as the place to save the files, because Gb price on a server is far more expensive than using S3 (used by dropbox, spotify and other big companies), if you've a page with many videos, audios... Thanks and congratulations.
  10. I'm using PW 2.6.1 $markas_cached = $cache->get("marcas", "+1 second", function($pages) { $markas = ["DAF", "IVECO", "LIEBHERR", "MAN", "MERCEDES", "RENAULT", "SCANIA", "SCHMITZ", "VOLVO"]; return $markas; }); echo json_encode($cache->get("marcas")); echo json_encode($markas_cached); I've changed array values manually $markas = ["DAF", "IVECO"] with different times with the template way but the array values never change. Any ideas.
  11. This is far more than I expected, awesome pw, thank you.
  12. Is there a way to persist variables across different users without being logged and without writing the variable result to a file. In my case the admin publishes several vehicles of different branches, these my differ every day so I've used LazyCron to check active branches every two hours, to avoid querying DB each time a user look for vehicles, I tried putting the result in a session variable but it doesn't work between different users. I could write the branches every two hours to a file and read it every time but, is there a better way to do it? Thank you.
  13. How can I check that the cookies in the header (ajax call) are the right ones in the actual session ( challenge, fingerprint ), what should I compare??
  14. Hi Sephiroth. I can get data back if the template that the page uses has a guest role. I don't have any problem with cordova when I use it with dreamfactory I can login retrieve data upload images... but because I like pw I would like to do the same with it but as mentioned before I'm not able to retrieve data from a page that uses a template with a role different to guest. The problem is my knowledge I suppose making calls through ajax to log to pw and get the data back.
  15. Is there any example on how to use sessions and session cookies with ajax and processwire? That would be really helpful!
  16. I would like to create a page that uses a template that returns some data, as "pages web service" but this template can be accessed only by certain role. Then a user must send credentials through ajax to get the data back , the http call comes from a phone, so the page trying to access the data is not on the server, is there a way to do it? I've search all around the forum but no way to get it working. Anybody has done something similar? How did you solve it? Thank you.
  17. Hi BitPoet I've but get the following error XMLHttpRequest cannot load http://miweb/login/. Response to preflight request doesn't pass access control check: A wildcard '*' cannot be used in the 'Access-Control-Allow-Origin' header when the credentials flag is true. Origin 'http://localhost:9000' is therefore not allowed access. In my php file header('Access-Control-Allow-Origin: *'); header("Access-Control-Allow-Methods: PUT, GET, POST, DELETE, OPTIONS"); header("Access-Control-Allow-Headers: Authorization, X-Requested-With, Content-Type, Origin, Accept"); header('Access-Control-Allow-Credentials: true'); an in my angularjs file .config( function($routeProvider, $httpProvider){ $httpProvider.defaults.useXDomain = true; $httpProvider.defaults.withCredentials = true; delete $httpProvider.defaults.headers.common['X-Requested-With']; })
  18. Hi. Is there a way to login to processwire from ajax keep the session and then call a page which uses a template allowed to certain role to get some data back? The problem is that is a mobile app and is not in the same server so its like cookies where lost. I'm developing a mobile application with cordova to get information about some monuments (images, description, visit timetable...), the data of those pages is only available by certain role, so users must login, so far so good but when I try to call to get monuments data I get no permission. Is there a way to login to pw through ajax and than call again to get more data from the server?
  19. I've in my php file <?php header('Access-Control-Allow-Origin: *'); /* Allowed request method */ header("Access-Control-Allow-Methods: PUT"); /* Allowed custom header */ header("Access-Control-Allow-Headers: Content-Type"); when I make calls with ajax(angular), it works this.login = function (creds) { var deferred = $q.defer(); $http({ method: 'POST', url: 'http://miwebpage.com/api/login/', data: {'user': creds.username, 'pass': creds.password} }) .success(function (result) { deferred.resolve(result); }) .error(function(data){ deferred.reject; }); return deferred.promise; } I would like to use a token in every call (csrf?), how can I achieve that in ajax ( angular ), any tutorials? I've searched but not sure yet how to do it with pw and csrf.
  20. How would I use CSRF with ajax in a page that's located in a different server. I would like to use it with phonegap/cordova, make and ajax(angular) call from the phone to get some data back.
  21. Thank you tpr. That is a good idea but I think a bit dangerous if you are getting sensible data back, it would be too easy to hack, anyway I'm going to try it right now.
  22. Hi I'm trying to get some json formatted data through ajax from a template that has permission for certain role only. If I'm logged as an admin in a tab and just call http://mydomain.com/getitems/ in a different tab a get the json data back. Here is my code. PHP <?php header('Access-Control-Allow-Origin: *'); foreach ( $items as $item) { array_push($array, array( "label" => $item ) ); } echo json_encode($array); JS $http({ method: 'POST', url: 'http://mydomain.com/getitems/' }) .success(function (result) { console.log("result",result) }) .error(function(data){ console.log("error",data) }); It does work as long as the template containing the PHP code is guest available, but if I allow it to be visible by a role a get a null response, even if I'm logged in another tab in the same browser as administrator. My question is: Is there a way to send my credentials through the js call to get the data back? Any help would be appreciated. Thank you.
  23. Finally I got it. Here is the code and a couple of self explanatory images to show what you have and what you get. protected function getFieldsets( $pageID ){ $pagina = wire('pages')->get($pageID); $campos = array(); $array = array(); $temp = null; foreach($pagina->fields as $field) { if($field->type->name == "FieldtypeFieldsetOpen") { $temp = $field->name; } elseif($field->type->name == "FieldtypeFieldsetClose") { $campos = array(); $temp = null; } else { if($temp!=null){ array_push($campos, $field->name); $array[$temp]= $campos; } } } return json_encode($array); }
  24. Hi guys. Is there a way to get fields included within a FieldsetOpen? I would like to render in the frontend in several columns FieldsetOpen labels and the fields within it. Thank you.
  25. I know I can redirect from a template but is it possible to redirect from a module? $this->session->redirect('http://google.com'); Thank you.
×
×
  • Create New...