Jump to content

PHPSpert

Members
  • Posts

    30
  • Joined

  • Last visited

Contact Methods

  • Website URL
    http://moveelo.com

Profile Information

  • Gender
    Male
  • Location
    Mexico

Recent Profile Visitors

4,379 profile views

PHPSpert's Achievements

Jr. Member

Jr. Member (3/6)

17

Reputation

  1. Just had the problem where I wanted all templates to be served as JSON. This is what I did: /wire/config.php $config->prependTemplateFile = '_init.php'; site/templates/_init.php: <?php header("Content-Type: application/json; charset=utf-8"); ?> and it worked fine. Now if you wanted to, you could simply create a field in Processwire for each page that allows for a custom setting, like: <?php header("Content-Type: " . $page->custom_content_type . "; charset=utf-8"); ?> in your appended file. Works like a charm.
  2. I'm trying to clone a page, it's repeater fields and other values to another page. will something like this work? $newPage = clone $page; $newPage->id = null; $newPage->name = "new-slug"; $newPage->save();
  3. I seriously didn't know this was possible. I guess if you're looking for a parent from multiple levels you could do $pages->find('created<=yesterday')->parents()->get("template=top"); // This obj exists so that means the children exist... NICE!
  4. Understood, but what if you want to get a page with children with a specific attribute? Maybe more specifically: $pages->get("template=accounts")->hasChild("created<=" . strtotime("-1 days"));
  5. It would be nice if ProcessWire had a has() selector like JQuery does. For example, so we could do this: $pages->get("template=accounts")->has("created<=" . strtotime("-1 days")); Is there something like that already or has it not been added?
  6. Web apps in PW? Hell yeah, Processwire is great for that. I love how I can map out my app before I get started into a tree. I actually built a lot of web apps on PW. One being http://collabmango.com PW saves a lot of time in building web apps. The selectors and not needing to deal with DB crap is a huge +
  7. Ok, here's another idea: let's say we're looking for "update" pages assigned to or owned by $user: function findUserPages($user, $template) { return $pages->find("template=account,user|assigned_user={$user}")->find("template={$template}"); } $pages_found = findUserPages($user, "update");
  8. I have a page architecture like this: account-data - 1010 (account, owner=clinton, assigned_users=brian) - Some update - Some project - Some task - 1020 (account, owner=jack, assigned_users=brian,clinton) - 1030 (account, owner=tom, assigned_users=clinton) - 1040 (account, owner=jordan, assigned_users=brian) What I want to do is give viewing permissions (for updates, projects and tasks) to users only if they are either assigned or own the parent account. I need to find out a clean way of doing this. For example, I could do: foreach($pages->find("template=task") as $item) { if($item->parents()->find("template=account,user|assigned_user={$user}")) ... But looping through all of the items is a pretty heavy task. Sometimes it has to go a few levels before finding the parent with the user info. Is there a better way of doing this?
  9. This is driving me crazy. I have a variable $course_page which is a repeater. I'm trying to get the next entry in the repeater. How? I've tried getNext(), next() and next.
  10. One of my clients may need to have the ability to import a csv of exam answers into PW. The exam template uses repeater fields for the questions. Is this possible?
  11. Soma, that plugin looks really good. I'm excited to try it out. I do a lot of small websites where most of the work is just creating pages, then filling out the content. So something like this will knock some time off the process. Ryan, that plugin looks good also. However, I don't see it as a huge time saver unless there's a specific use. Soma's plugin nearly takes away the need to switch back and forth between pages. The only thing is when we need to add and edit content in the body or other fields. By any rate, thanks for the contributions. You guys rock as always. There's a lot of new stuff to learn, create and improve. We don't all have the free time to dedicate our lives to these things but I like the minor additions here and there. When I get some time, I'd like to make some contributions also. I agree, sometimes little tweaks can create huge time savers. My idea might not be the best, but hopefully it gets a few minds working on how we can save more time in each of our projects and make additions down the road.
  12. So this month marks an entire year since someone opened me to the world of Processwire. Can't believe it's been that long. I have to say that without PW I would have lost many hours of coding and recoding classes, setting up basic websites and database tables. Aside from that, the API is something I would have killed for 5 years ago. PW has already given me a load of leverage of building projects fast and making way more money in less time. That said, after doing around 20+ installs since starting to use PW, I've noticed a few things about my work flow that I think could be improved. These improvements could spike productivity through the roof and save me even more hours and make me more dollars than before. There's a LOT of back and forth when setting up a website in PW. What we need is a way to reduce the amount of time creating new templates, fields and pages, as well as editing all of this stuff. Today I was thinking, wouldn't it be great if there was a way to just add a new page by typing it in a new slot below the other pages, selecting a template and clicking save. By default a template could be selected, for example the allowed child templates or the default-page template. Also, it would be cool to add and edit templates on the fly as well. Let's say we create a new page, click add new template (JQuery window pops up) and we can either add or edit the template right there as we're creating a new page. Also we could create new fields while editing the template. That way we could create a page on the fly with minimal settings, set up the template, add any additional fields we need and save it and publish it all in the same area. Now, this would not be easy to code by a long shot. Would take a lot of ajax calls and JQuery to get it to work. But having something like that would be wicked. With this, we could basically set up a page tree in 10 minutes or less. I know the obvious answer is, "well, go and code it," I seriously don't have the time for this right now. ProcessWireSexy was my planned theme but I'm still trying to find time to even start on it. Is there a theme out there like this that someone has already made? Someone has to have already thought of this.
  13. Wow - Yes, that's one way to do it. Thanks Ryan, you're a genius.
×
×
  • Create New...