Jump to content

Jason Huck

Members
  • Posts

    136
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by Jason Huck

  1. Is there an easy way to get back the SQL query generated by a specific processwire selector? I have what appears to be a cartesian product and/or groupwise maximum bug in a selector, but I'm not sure how to confirm it. I'm querying for a set of pages with a specific template which are related to the current page. The returned pages include a URL field and a file field. The selector looks like this: $grades = $pages->find('template=grade,include=all,classification.title="'.$page->title.'",sort=series,sort=title'); "classification" is a page field. Series and title are text fields. I'm iterating through the results and outputting three text fields, a URL field, and a file (->url) field. On one of the nine pages using this query, it should only return one row, but it returns two. The text fields are identical for both rows. The URL and file fields are empty in the first row and populated in the second row. The other eight pages all work as expected with no duplication. Thanks, Jason
  2. Yes, that's exactly what I ended up doing. I just didn't realize that was an option until pwired provided the link to the other thread.
  3. For my purposes, it's close enough to be able to specify a different template file for each template. I point them all to main.php, which is empty. In config.php, I'm prepending an init.inc file that loads the correct view based on the value of $page->template. That may sound a bit circuitous, but it lets me have a structure like this (personal preference): /site/templates/ init.inc (all bootstrap code, prepended via config.php) main.php (empty) views/ base/ base.inc (global layout/markup, header, footer, nav, etc.) base.js base.less bio/ bio.inc bio.js bio.less location/ ...etc. for each view I'll probably stop prepending init.inc, and just move that code into main.php, since I still have to have one template file in the usual location anyway.
  4. Aha, that's close enough for me. Easy to implement, and now I only have one empty template file in the site instead of one for every template. Thanks!
  5. Let's say I have a "template" called "bio." In the most basic processwire usage, there's a 1-1 relationship between templates and template files. If you want to view a page created using the "bio" template at its natural URL, you have to have a corresponding file at /site/templates/bio.php. If you create a "no-file" template for bios, in order to display a bio page, you have to include it from another template, use url segments, etc. -- in short, do the routing yourself. I want to use the normal routing mechanism (as if there were a bio.php file), but not have to physically create bio.php, because at this point it's just an empty placeholder.
  6. I've abstracted all of my templating to the point that the files at /site/templates/[template_name].php are completely empty. Is there any way to get rid of the need for the empty template file and still have processwire's built-in routing work as expected? Thanks! Jason
×
×
  • Create New...