Jump to content

Pete

Administrators
  • Posts

    4,054
  • Joined

  • Last visited

  • Days Won

    67

Everything posted by Pete

  1. You can do this on any PageArray: echo $yourresults->getArray(); Taken from here: http://cheatsheet.processwire.com/ (you'll need to click on "advanced" at the top to see this though.
  2. You could do category.name=cat1name|cat2name|cat3name Basically the pipe character --> | <-- means OR, which should work for your case. The above is for the page name field, but you could just as easily do category=1027|1038|1057 if you want to match against the page ID
  3. No worries, if you run into anything else then let us know. A really useful tool for the most common functions is the cheatsheet if you've not already seen it: http://cheatsheet.processwire.com/ Welcome to ProcessWire by the way, and have fun!
  4. I'm confused - this would surely just echo the URL of that page: echo $header_page->url; ?? To render it you would want this instead: $header_page->render(); So in your other script, you could do this: // Include ProcessWire require("../index.php"); // Get header $header_page = wire()->pages->get("/external_head/"); $footer_page = wire()->pages->get("/external_foot/"); echo $header_page->render(); //.... the rest of your other script goes here echo $footer_page->render(); That should work I think, unless I've misunderstood what you're asking for. It also assumes that there will be no conflicts between variables in ProcessWire and your other script, but you would know if that's the case soon enough when it throws you errors I must admit, I do like the concept. I know of an intranet script I've worked on in the past where I tried to make ProcessWire work inside that script's header and footer for old pages, and new pages had the header and footer and the pages themselves in ProcessWire, but this would have been a better idea in terms of wrapping a consistent header and footer around both the old and the new pages until they're all ported over to ProcessWire.
  5. I think the people are your starting point in this case, as each one that's added would relate to places and events and populate those sections. The trouble would be keeping track of which places and events have already been added and linking to them accordingly, but I suspect that you've got the perseverance to pull it off since it seems you've already collated this data yourself over a number of years
  6. Now available in the modules directory: http://modules.processwire.com/modules/admin-template-columns/
  7. Thinking about how you would use a person#s free-text search string (assuming you wanted to) like this: You would be wanting to look out for words like "born" first, and then look for a 4 digit number. More complex is this: as you would then have to look for both "born" and "died" and then the year, but that's not too difficult. Worse still is this nightmarish example: Nobody is likely to type that in, but your key words there would be birthday, born, died and posion with a date being harder to pull out depending on locality of the person searching (for example, I could have typed "October 1 1981" instead, so you would need some sort of regex to catch the most common of those if you wanted to). Once you have your result from that query though, you could weight (or just categories) the results by people who were born or died on that day, people that have birthdays on that day and people that were poisoned on that day. And now I'm getting a headache thinking about it all But I definitely think that if you allow search strings like this then matching against key search phrases (born, birth, birthday, died, dead, death, murdered etc) and then looking for some form of date is the way to go to work out what the user actually wants. I think you might give up at the point someone types "Who was born or died between October 1 1990 and 22 November 1990 and who was poisoned on 3 February 1700..." etc etc - more than one date might get tricky, but it feels like the best way to approach it is to assume people won't type in anything ridiculous as those who do will be in the minority (hopefully!) At any rate, I think you're going to have some fun (and headaches) with your search algorithm!
  8. It sounds like you might be getting hung up on how to structure each entry - my advice would always be to treat people and categories separately where you need to place a person in more than one category. For example, all of your people would go under /people/ with a template called "person" and each category stored in a tree like /categories/deaths/, /categories/deaths/suicide/, /categories/deaths/murders/ with template called "category". That way you could create a Page field called "categories" (Page List Multi Select like this would be favourite: http://processwire.com/videos/page-fieldtype/ ) and add it to the "person" template so that you can tag multiple categories against the same person. This way, you can do some searches like this: $people = $pages->find('template=person, category=suicide|poison'); That will return a PageArray of all people who match categories of suicide or poison. You could also do some weighting of results so that the more categories they match the higher they come in the results, but I think your biggest hurdle will be turning your human-readable search string into something useful. Once you've done that though, you're simply matching the keywords against categories in ProcessWire and the rest is relatively easy Something like this as a quick example: <?php foreach ($people as $person) { echo "<h1>$person->title</h1>"; // Their name echo "Died of: "; echo "<ul>"; foreach ($person->categories->find('parent.name=deaths') as $death) { // Searching under a parent page name of deaths within this person's categories will return how they died - quite lengthy for some historical figures! echo "<li>$death->title</li>"; } echo "</ul>"; } Of course, you could have a whole separate categorisation system for deaths rather than lumping things together under categories like this, but since you're likely to have a great many categories and everything you would search for in this system is a means of categorisation I thought I'd do the example above.
  9. Yep - I was just using it for debugging purposes to see if I could get it to dish out any data. When it fails it just 404's, so I suppose others are testing in browsers and getting errors maybe.
  10. But you can create a fieldgroup in a template already I think we may need some visual drawings in Photoshop or on a piece of paper scanned in maybe to explain what's being asked here
  11. You could do: $config->var = array('item' => 'val', 'item2' => 'val2'); echo $config->var['item2']; Doesn't look as neat as you want, but should do the trick.
  12. Will upload it to modules directory next week when I'm back home
  13. Nope - you've still lost me on why you would want to re-use fields that make up an article (which is a single thing) within the same template. It doesn't make sense to me. Many (infinite, within reason) separate pages can use the same template, each article would surely be a separate page using that same template? I still don't see the reason to re-use those fields within the same template.
  14. Sorry, I probably caused that slight code issue when I changed diogo's code
  15. Ah, right. In that case you can only copy the fields one at a time (from the advanced tab). But again though, I'm not sure where this would save a lot of time as such fields are set up once and that's it. It would be interesting to hear benjaminE's use case.
  16. Boris - I think your problem is you're trying to wrap a <p> tag around a <form> tag which I don't think you can do in HTML anyway (the browser will helpfully try to close the tag before the form). Try wrapping it in a <div> tag instead and you'll have a lot more luck. You could also just apply the styling directly in the form tag as well, so <form style="your-style-here"
  17. To re-use the same field multiple times in one template you are talking about repeaters. Otherwise if you just want to group fields together neatly in a template you might want to try a fieldset - but this is simply a wrapper for grouping fields together, it won't let you save fields as a group and re-add the whole group to another template (I can't imagine any scneario where you would actually want to re-use the same fields enough times to warrant this type of functionality).
  18. Hi ryan I also got the 404 issue and I believe it is to do with how various browsers (maybe?) handle this line: header('Content-Type', 'application/json; charset=UTF-8'); Changing that to the following, my issues were resolved on Firefox: header('Content-Type: application/json'); Hopefully that helps others - I guess there may be something "non-standard" or maybe not globally recognised in the line that's in the module - it's all a bit beyond me, but this change resolves it
  19. But by the same token, there's no big problem with just putting modules as you need them on a project into your central site/modules directory - if I understand your setup correctly they won't add any overhead until you actually install them on a specific site anyway, they'll just sit there ready to install.
  20. Good point on the IP in an office - I hadn't thought of that yet I'm subject to it daily!
  21. Apple only though
  22. Nice work - I like it. Just one question though: getUaString concatenates the user agent and IP address - surely that means I can switch to other browsers and vote multiple times? Wouldn't IP be enough on its own?
  23. Bwah, pocket money... . . . . . . .
  24. Guy - try this: http://processwire.com/talk/topic/236-module-page-link-abstractor/ You may have to re-save your pages though (I'm genuienly not sure). On another note, is there any particular reason the site is under a subdirectory? You could also try this anywhere in your <head> tag in the head.inc file, but this may present other potential issues in your templates (just so you're aware): <base href='http://yourdomain.com/subdirectory'>
  25. Link to Hanna Code: http://modules.processwire.com/modules/process-hanna-code/
×
×
  • Create New...