Jump to content

dps123

Members
  • Posts

    36
  • Joined

  • Last visited

Everything posted by dps123

  1. It's just a hidden form field: <input name="note_page_id" type="hidden" id="note_page_id" value="<?= $page->id; ?>" /> The problem with doing: echo "<pre>"; my_var_dump($input->post->note_page_id); is that it's being handled by an ajax script, so nothing appears.
  2. This is probably really simple but can't figure it out. note_page_id is a hidden field with the page id as it's value. $note_page_id = wire('sanitizer')->text($input->post->note_page_id); $note_page_id is an [object HTMLInputElement] rather than the value. Why is it not returning the value like it normally would? How can I get the value?
  3. And would I be able to use pagination with this option? I've read elsewhere people not being able to use pagination when using results directly from $pages>find.
  4. Hi I just need some advice on the best way to achieve this. The setup I have is: Items Item 1 Note 1 Note 2 Note 3 Item 2 Note 1 So I have note pages, which are children of item pages, which are within /items/. Each note has a 'created' datetime field on it. I also have a 'viewed_by' field which determines if a particular user has viewed that note. What I'm going to do is add the user's id to that field once they've viewed it. On the webpage that the user sees, I need to display items that have one or more notes that have not been viewed by the current user, most recent first (based on 'created' field). After that, I need to show all other items in date order, most recent first. Is there a way to sort the items like this using only ProcessWire $pages->get or $pages->find, or would I need to add the items to an array first and then loop through that? I thought I might have to loop through all the items to find ones that have an unread note, add those to an array, then loop through the remaining items and add those to the array. Thanks!
  5. No, I'm just using custom JQuery code. I'll have to have a read of $config->ajax sometime. Thanks.
  6. Thanks for the help LostKobrakai. I still couldn't get it to work with the file inside templates, even though I had a page in PW using that template. If I changed the path in the JS to that page's path, it didn't work. It does work with the PHP page in the root folder though.
  7. Hi I'm having a torrid time with some Ajax code and a custom PHP script. I'll try to explain what I'm trying to do. I have a form with a single email field. I validate the email field and if it's okay, I then make an Ajax call to my custom PHP script which needs to do some ProcessWire stuff to the user with that email address. What I'm finding is, if I put my PHP code inside the templates folder, it is not executing at all. From what I've read, ProcessWire denies access to PHP files in this directory. So I've then tried putting the PHP file in the root of my site, outside of PW. It then can see and execute the PHP file. The issue then is that i can't access the PW commands to make the changes to the user. At least, I don't think I can from outside of PW. Any help gratefully received!
  8. Thanks both - this now works sweetly.
  9. Thanks kongondo, I'll have a read. It's not the JavaScript live formatting, I just need to do it in PHP when I'm saving the page. Thanks again! Edit: Actually, I remember trying this before. I'm getting this error: Error: Call to a member function pageName() on a non-object when doing this: $pw_url = $sanitizer->pageName($name, true); It's inside a custom function that I'm calling from my template.
  10. I need to format a string in the same way that ProcessWire formats the page URL as you type in the page title. Is it possible to use this function or possibly copy what it's doing?
  11. Hi, I have a JSON feed that I need to grab and update some pages and fields within ProcessWire. I've created a template with my code that I am going to use. I have fallen at the first hurdle though. I need to first select the pages that are using my specific template as those are the ones that I need to update with the JSON data. When I do this: $my_pages = $pages->find("template=my_template"); Error: Call to a member function find() on a non-object Could someone point me in the right direction? Thanks!
×
×
  • Create New...