Jump to content

Vineet Sawant

  • Posts

  • Joined

  • Last visited

Everything posted by Vineet Sawant

  1. Hi, Is it possible to see the full code?
  2. Hi, I'm setting up a website that's going to have some heavy traffic and I want to ensure we've staging environment where we can create new fields/modify fields, add data & code to test before it goes live. My problem is, how do I ensure I don't have to create/modify fields on live environment and prevent site from breaking publicly. If anyone has done this before, your guidance would be highly appreciated. Thanks
  3. Thank you both. @AndZyk It'd be very kind of you if you can post an example. Thanks a ton ?
  4. Hi, I'm trying to import some heavy data into Processwire, but I'm not sure what would be the best way to do it. Usually I use CSV to Pages plugin, but this time the data is too heavy(~40k rows with 10+ columns of excel sheet), thus this plugin can't help. I also tried Tasker plugin but I can't seem to go through the setup itself, it requires some template setup but I'm totally clueless about how to do it, so that plugin is not of any use either. I wanted to know from you guys how you do it and in future what would be the best way to migrate thousands of rows of data in to PW. Thanks.
  5. Wooh... 4 years later, I'm still using PW, lovely! After recently using PW 3.0, I've leart that reducing the number of fields in the entire project is a good way of making sure the fields are being used effectively and efficiently. It also helps in remembering the fields names easily while writing code. Based on this, my latest coding strategy is to create a field of each type of field and reusing them on various templates. It helps in standardizing the field names as well as makes coding faster & easier.
  6. foreach($users as $u) Worked. I figured that since I was setting content type header as json, that's why HTML was not working. Though I've been using PW for long, there's still a lot to learn. Something new learnt today, thanks a lot mate.
  7. Alrighty, so here's the latest update. I tried changing the template of the api page to something else. It's working when I change the template. Also I tried to add some simple HTML to the page, it's not rendering, rather it's just showing it as plain text. I suppose there's something wrong with the encoding of the page. Wil change the file & try again. EDIT: So I checked, I changed the template file, created new from scratch. Whenever I'm trying to print anything other than HTML, it's not working for guest user. I suppose, the results that I'm getting from the selector, are only available to logged in users. EDIT #2: So it's only happening if I'm using user template as selector. I changed that to basic page and it's working fine even for guest user. I suppose this is PW's way of keeping things secure but is there anyway to bypass this?
  8. <?php header('Access-Control-Allow-Origin: *'); $callback = isset($_GET['callback']) ? preg_replace('/[^a-z0-9$_]/si', '', $_GET['callback']) : false; header('Content-Type: ' . ($callback ? 'application/javascript' : 'application/json') . ';charset=UTF-8'); $users = $pages->find("template=user,include=hidden"); foreach ($users as $u) { $usersList[] = array("id" =>"{$u}","name" =>"{$u->name}","email" =>"{$u->email}"); } $json_encoded = json_encode($usersList); $jsonp_callback = isset($_GET['callback']) ? $_GET['callback'] : null; print $jsonp_callback ? "$jsonp_callback($json_encoded)" : $json_encoded; Here's my code. Even if I try to just print simple loop with username, it's only visible to logged in user and not to anyone else.
  9. Hi, I've been using PW for a pretty long time now, and this kind of thing is happening for the very first time. I'm setting up an API for the App I'm creating for my client. So I've created a hidden page called API which is located right under the Home. When I'm trying to write code for API and test it, the output is only visible for logged in user, i.e., the output is only available if I'm logged in, which is not going to be the case when I'm using app to request JSON. So, question is, how to keep the page hidden but accessible to guest user? I checked the permissions under settings tab. Who can access this page? Tab says it's accessible to guest & superuser but for some reason, it's only working for superuser. What am I doing wrong? Thanks.
  10. Wow, still no response. I must have asked either a really tough or really stupid question.
  11. Hi, I'm working on a simple Ionic app which is going to use ProcessWire as the backend. This app allows people to upload images and then like/comment on them. It's a lot like a stripped down imgur app. I've set up some basic services such as register, login & reset password. There are a couple of things I am doubtful about. 1. How do I get user's unique session Id once he's successfully authenticated through AngularJS's http post request? I'm currently using following code: $sessions = $session->getAll(); $session_id = $session->_user["fingerprint"]; But I'm not sure if that's the right way to do it. I'm not even sure if that's the session id. I know there's something called SessionCSRF["name"], I tried that. I'm sending session_id as response to http post request. Then I'm using that session id to check if user is authenticated for his/her further actions such as commenting/liking/posting etc. 2. Now that I've got the session id, how do I identify the user based on the given session id? or should I send user ID back to PW everytime user is performing any action? Is it possible to identify user just based on the session fingerprint that I'm giving back to the app? Among other things I'm considering are keeping a device id on the server for each user, so as to gain better control over user's sessions. I can log out all the devices linked at once etc. I'd really love to hear from you guys how you'd plan to do this app. I'm experienced with PW but not very much with AngularJS. Thank you.
  12. I ended up using limit with foreach & pagination. I also found out that start=n in the selectors breaks pagination module. It stops working. Pagination renders page numbers but after clicking the page, e.g., 3 still shows data from page 1. I guess it happens cause I'm using start=n. When I removed, it started working just fine.
  13. Hello, I've a website with over 40k registered users who sign up using their email IDs. We've a ticket booking service and we wish to alert users about certain functionality changes in the site. Whenever I'm trying to print all the email using foreach, page is going blank due to memory issue I suppose (it takes ages to respond). Is there any way or any module which will export all the emails to a single CSV file? Thanks.
  14. Hi diogo, I was thinking about the notifications that PW's admin theme uses. I guess you are talking about the same thing, ain't you? I will try your suggestion on a staging pw installation. Yesterday I gave up and wrote sql queries (which I absolutely hate to do) to store all the activity in a table called activity. Then once they are shown to user, I change the activity status to read from unread. Since it's a different table, I don't have to worry about wasting page ids. Thank you all for your inputs.
  15. What exactly is WireCache and where can I read more about it? Yes, I guess I should make a table to store notifications.
  16. Thanks for your reply renobird. No, topics are permanent unless owner of the topic deletes it. The temp pages are for notifications which I want to give to the owner of the topic if someone comments or does any of other activities like adding post to favourites etc. So basically, it's like facebook's notifications. Consider you post a photo & people are comments & liking the picture, how am I to give you notifications? I've to store all this comments/liking activity somewhere right? I've figured out a way to store comments & likes, it's just the notifications of it, which is a temporary thing, that I've to figure out. It can be done by creating temp notification pages and add them to a notifications page array field of the post and then just check the notification status and show user the unread pages as notifications. But this way I'm wasting hell lot of page IDs. Which would be an inefficient thing to do, right? So that's where my question comes from, how do I manage temporary storage? May be PW should provide temp pages other than usual pages with all the same features. Sorry for the long story.
  17. Hello everyone, I'm creating a large scale application which will be used by thousands of people. Part of of the application requires storing temporary information about user's activities. For example, if user comments on certain topic, notification of same should be given to OP and people following the topic. I thought I'd create a subpage with a repeater field having few fields like user id, timestamp & notification status, read/unread (I just don't see why using page table is better in this case, if someone can enlighten me, that'd be great.). But I've read that every repeater item is same as new page, so I'm really confused whether I should just start keeping temporary pages or use a page with repeater field. But for every topic, there can be hundreds of notifications, which I think will be a problematic situation in future. So I am looking for any kind of temporary storage that will not included creating pages. Writing logs to file could be done but i'm not sure how good solution is that and how reliable it'll be. I'd really like a good conversation with someone who understands PW, so I'm here. Thank you all.
  18. Hello, I've a requirement where I need to have a list of pages using same template available on a page (site settings page) through page field. Basically what I need is, whenever a new page of specified template has been created, it should be automatically added to that pages list, just like home page has children. For example, I've a template called article. Articles are posted under /blog/ page. I've a site settings page which has a page field called articles_list which I use to manage articles list on some other page. This way I can manually chose what articles I want to show and in which sorting order. There's no specific sorting logic to this. So what I need is, whenever a new article is posted, it should automatically be appended on that articles_list page field so the site moderator can manually change the sorting without having to add page himself and then select the sorting. I've this weird requirement cause the site moderator can't see which new article has been added to the blog, he's just allowed to set the sorting. I hope I've clarified the requirement. I think I can use admin custom pages but it for some reason never worked for me. Thank. P.S. Forgot to mention that to add post or any other related task, I'm not using front-end, it's all through PW's admin panel.
  19. @renobird, @BitPoet $json = file_get_contents($config->urls->admin.'page/search/for?template=basic-page'); This was the code I was looking for so I guess its is ProcessPageSearch that I was looking for.
  20. I think I'll have to dig up my old machine and find that code. :/
  21. Hello, I remember recently using processwire's built-in json API in one of the dev builds. I can't seem to find any kind of documentation of that now. Since I switched my machine, I can't even find that code again.(I've been searching for hours) Can anyone please point me or provide me any clue about the above said json api? It worked something like this: If you need to find any pages using template basic-page, you can get it as follows: http://example.com/processwire/?template=basic-page hit above and it'll return the json output. Thanks.
  22. Actually I've tried that already, no luck
  23. Hello all, Hope you all are enjoying your weekend. Recently I shifted all my projects to Amazon's web service running a default ubuntu installation. We got almost everything working, some Drupal installations & Laravel etc. Even Processwire got installed correctly but it's just showing home page and nothing else. For example, I've a task management system that I use for personal projects management. It was working fine on my old hosting but on AWS, it's not showing me any pages except for static home page. If I try to access any virtual page or even the admin panel, it just shows me blank page with default HTML. I tried re-installing & fresh installations as well but it's still not working. Is there any specific change I need to make in HTACCESS? Thanks for your help.
  • Create New...