Jump to content

kongondo

PW-Moderators
  • Posts

    7,480
  • Joined

  • Last visited

  • Days Won

    146

Everything posted by kongondo

  1. Yes...use what is best for the job. $sanitizer->name is best for ProcessWire 'name' - Name is used to build the URL hence its formatting (of course you can use it if you require such formatting...) but in your case, text should be fine...
  2. Sorry, my bad. I misunderstood...Try this instead,, $p = $this->modules->get('ProcessPageList'); $p->set('id',2480); // the parent page return $p->execute();
  3. $p = $this->modules->get('InputfieldPageListSelect'); $p->attr('name', 'products');//example name value for selected page //$p->set('parent_id', $parentId);//here we set the parent whose children will be selectable OR $p->set('parent_id', 12345);//here we set the parent whose children will be selectable $p->set('startLabel', $this->_('Product Blah Blah')); You can even change the 'more' and 'cancel' labels...
  4. Nice to see this is coming along nicely Valery. Be warned though, Process Modules are addictive!
  5. Or you can use the search box on the cheatsheet page...
  6. Thanks to Soma, we have this: http://cheatsheet.processwire.com/
  7. echo $page->createdUser->name; Adrian beat me to it...OK, so am slow...nothing new there
  8. I use Sublime mainly, but also use Np++ sometimes. PHP strings of HTML are highlighted just fine. Better if you concatenate variables within the strings (if any) rather than use curly braces..i.e. Rather than.... "My string is about {$page->title} and other stuff"; use this.. "My string is about" . $page->title . "and other stuff";
  9. Hey Franko...welcome to ProcessWire and the forums! I don't know why, but I had a feeling you were coming in from MODx...been happening a lot lately...Anyway, enjoy!
  10. Patiently waiting for Windows version .. ;-)
  11. ? U forgot to ask your question?
  12. .....sometimes the API works just as well
  13. A minor (but crucial) typo on second version; should be $wire->page
  14. I'm jealous! Glad you guys had a nice time
  15. joe_ma. I like your tenacity! Sorry to see you are still struggling with this. Not a direct answer to your query, but I would like to suggest debugging your code 1 step at a time can help you find where the error is coming from; it is also fun and will make you a better coder in the long run. That's what I learnt from the gurus here ... You could do something like this: $events = $pages->find("template=repeater_time_loc, check_access=0"); //get all the repeaters with event information echo gettype($events) . '<br>';//this will tell you the type of variable you are dealing with [just an example] //if it is an object/array... echo '<pre>'; echo print_r($events);//verify $events is returning what you were expecting echo '</pre>'; exit;//stop other code executing Keep on doing this or similar line by line, Check even inside the foreach (e.g. print_r($days)) to verify things are being returned as expected, exiting after short lines of code, until the next variable, etc, etc.. Were you expecting an integer? Was a string returned instead? etc...This way, you will be able to (hopefully) identify where things are going wrong. Make sure debug is turned on as well.. Anyway, just thought to share my experience....
  16. By crop image field, do you mean you are using the cropImage module? You can use a normal image field for your Avatars. You interact with that image field like any other image field..only this time you are dealing with the 'user' template. Also remember that in the DB 'users' are stored as 'pages' so, similar API syntax... See this post by Ryan: https://processwire.com/talk/topic/10-how-do-i-interact-with-the-image-field-in-processwire/ and the docs https://processwire.com/api/fieldtypes/images/ Btw, do you need a profile image to be that big?
  17. Manaus, Not sure what your App does or its design, but I'm not getting why you need to store IDs (basically integers) using JSON? Can't these be stored as comma separated values? If you want to go the JSON route, there's various threads on the forums you can have a look at (Google )
  18. In that case, one way is to only allow them to delete the pages that they have created. I'll let others more knowledgeable chime in here The property $page->createdUser will get you the user In a selector you can search using created_users_id
  19. If many users can be assigned the role frontend_editor, then it means you need to go further in your checks. Is there a maximum number of pages each user can create? Is there a limit to the number of users? Answers to these questions will help determine the approach needed to control access - e.g. for a site with 100K users, controlling access by giving them individual templates may not be very workable.... Just loud musings here..
  20. kongondo

    2048 anyone?

    I am not touching this with a 10-foot pole!!! Seems so addictive...
  21. Good for? Why add another language on top of an already existing capable language (PHP?)...Yes, I know I used MODx and its templating language and loved it..but that was before I decided to take the plunge and learn PHP.......Anyway, this is like mermite...some people love smarty and similar while others don't. I like Ryan's summary here: http://processwire.com/api/why-php-syntax/. If you know PHP I suggest to forget template engines like smarty. They are just another layer of complexity you don't need...
  22. @Jeff, Here the critical point is to check if the user has the right permissions. There are various ways of controlling access in PW, e.g. using permissions and roles at user level, at template level, and with some modules, at page level. For now, Google this and have read: "permission delete site:processwire.com" then let's talk...I need to run
  23. OK...here is an example (rough-ish...and maybe even ugly code...) but it should give you an idea... //was a delete request sent... if ($input->post->delete) { //this will be in the form of delete=xxxx where xxxx is the page ID. Check in Firebug $deletePage = $input->post->delete; $id = (int) $deletePage;//sanitize post value to integer $p = $pages->get($id);//get this one page whose ID was sent over using its delete button $title = $p->title; $p->trash();//as a backup in the interim, we trash the page instead of deleting it. echo '<p>The page ' . $title . ' was successfully deleted</p>';//there are better ways to check! } else { //list of pages - this is only an example...modify to return your particular user's pages! $out = '<form action="./" method="post"><ol>';//this form posts to self foreach ($page->children('limit=10') as $child) { $out .= '<li>' . $child->title . '<button type="submit" name="delete" value="' . $child->id . '">delete</button></li>'; } $out .= '</ol></form>'; echo $out; } There are better ways to catch errors and check if this page was actually deleted. Here also we haven't checked if this user has permission to actually delete this page....but this should get you on your way...
×
×
  • Create New...