Jump to content

Pete

Administrators
  • Posts

    4,038
  • Joined

  • Last visited

  • Days Won

    66

Everything posted by Pete

  1. 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.
  2. Will upload it to modules directory next week when I'm back home
  3. 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.
  4. Sorry, I probably caused that slight code issue when I changed diogo's code
  5. 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.
  6. 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"
  7. 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).
  8. 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
  9. 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.
  10. Good point on the IP in an office - I hadn't thought of that yet I'm subject to it daily!
  11. Apple only though
  12. 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?
  13. Bwah, pocket money... . . . . . . .
  14. 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'>
  15. Link to Hanna Code: http://modules.processwire.com/modules/process-hanna-code/
  16. When searching for empty fields, you can do this: $something = $pages->find('myfield=')l So literally put nothing after the =. In your case though this might work: $adiconal->children('adicional_hab=standard|'); // I just went for single quotes for legibility Not sure leaving a blank after the pipe | - signifying OR - will work, but give it a shot.
  17. I think Soma makes a good point with his last sentence - many well-crafted queries can work far quicker than one cumbersome query. Plus the technology has moved on so much in recent years that your server shouldn't really strain under lots of queries. Also, there are many caching options for ProcessWire to cut some of those out (MarkupCache for select lists etc, ProCache to serve a static version of your site and other solutions as well).
  18. It's still a work in progress at the moment Tyssen and I'm on holiday now until the beginning of October so it won't be ready for a while unfortunately.
  19. Xeo - generally most of us would recommend that in a situation where categories can change that you might instead put an article for Milton under articles/milton and create your list of categories separately and tag Milton against different categories. This way it doesn't matter if the categories change or become more complex later on, the article is still under articles/milton and the categories can change as much as you like (in your example Milton could be tagged in the poetry category to begin with, but also under all of the child categories (american and revival in your example) later on so that you have lots of articles listed in the parent category of poetry and the list becomes more refined the further down the categories you go. Basically that way you're not breaking any URLs and can tag things easily in multiple categories - for example if you moved Milton to poetry/american/revival/milton but then had a category called poetry/poets and wanted milton under there too you would have a problem, so best to put the article itself under something like articles/milton instead and associate the articles with the categories separately so you can have that multi-category relationship going on.
  20. Ah nuts, something's wrong there then. Will look at it when I'm not on holiday (currently in France on 3G trying to catch up on some PW posts ).
  21. I like this site - nice and clean and modern. Good work! I've been meaning to try out Gumby at some point as well so will have to find time (like that ever happens ).
  22. I've been using the option "Custom PHP code to find selectable pages" today and didn't realise quite how powerful that was (a real "D'oh!" moment there!). Something I do find reasinably often is that I want to display custom page titles in the page tree more and more for certain projects and, whilst concatenation is nice, it would be extremely useful to be able to use something similar to generate the titles. For example, in one case I've got some pages that have categories attached to them whilst the pages themselves are simply named 1-infinity, but I'd like to pad the number with zeros. It would be great to be able to create a title based off something like this: return $page->category->prefix . str_pad($page->name, 4, 0, STR_PAD_LEFT) . $page->title; There are other more complicated examples with IF ... ELSE where it checks something from the parent page if a value in the current page is set, but this one is a relatively simple example to post. Is this possible, or could it potentially introduce too much overhead in the page tree?
  23. Pete

    Avatar for pwired

    I was feeling left out - now I have a hat thanks to Martijn's bowler from earlier in the topic Antti - I nearly lose my lunch every time I see your avatar. Problem is you post so much so it's hard to avoid
  24. It's perfectly fine not to use ProcessWire's $session functionality and just use $_SESSION. rya has said before it's fine to use one or the other, but pick one and don't try and use them both on the same page I'd do something like this personally: // Create a session variable called something like this after you start the session: $_SESSION['user_start'] = time(); // Then when they get to submitting the payment, just check whether they're within the 5 minute window if (time() - $_SESSION['user_start'] < 300) { // 300 seconds = 5 minutes // they're within the 5 minutes so save the details to the database } else { // sorry, you're out of time unset($_SESSION['user_start']); // and unset any other session vars for this task } I would probably actually store it all in a multidimensional array though actually so it's easy to delete the whole thing: $_SESSION['myapp']['user_start'] = time(); $_SESSION['myapp']['someuserinfo'] = "whatever"; // Then when you get past 5 minutes, if the user is still browsing the site you do unset($_SESSION['myapp']; It might even be better to have that in the top of the head.inc file to check the 5 minute window - that way if a user browses to another page the session time check is happening wherever they are on the site and cleaning itself up as it goes.
  25. I think in terms of security Ryan is generally more careful, but also not relying on old code lowers the risks as well. If you look at how often other systems release security updates it is actually quite worrying, and for me as a developer it has been a headache in the past. On the plus side I have used this very point to convert several sites. Keep your points coming - the more we discuss the more answers there are to potentially help you. There is still always the chance though that an agency you go to will simply be too invested in another system, so it's down to whether you take the job anyway and try to convince them later (might be in a better position to build it in their preferred system in a week then spend a weekend doing the same thing in PW to show them) or if you get the feeling that they don't want to try something new (which can raise some alarm bells in a fast-moving industry actually) then you might want to look elsewhere anyway. With regards to the agency you mentioned at the beginning it might be worth asking them a few questions like what JS library they use, or a dozen other questions I can't think of right now to see if they're actually dragging their heels in other areas of web technology - if they're playing it safe stuck in the past in several areas then that would be worrying, but its worth asking all sorts of things that make you look like you're well-versed in current technology (something they should like) and also so you can see if they give any worrying answers
×
×
  • Create New...