Jump to content

Pete

Administrators
  • Posts

    4,043
  • Joined

  • Last visited

  • Days Won

    67

Everything posted by Pete

  1. Ah man, not sure how I missed that
  2. I could, I just didn't want to do it that way. Just me being awkward
  3. Hi Antti I knew this module existed but was looking for it in the modules section or on modules manager - could you add it please? It's perfect for a site I'm about to launch to map a few stray URLs
  4. Thinking about it, this could just be a case for MarkupCache, then it doesn't matter so much if I do it the longer way, or even saving something to a cache file on each user save maybe. Seems there are other options, though some more selector functionality would fall under the category of "nice to have"
  5. I personally think that for a ticket system you will be adding front-end forms for submitting tickets and displaying helpful articles (in the system I'm building at least) that I would add the management side of things to the front-end too. The page tree in the admin doesn't really lend itself to listing tickets, though I realise it is simple enough to add another page there. My other reason is I would like to add lower level users in to reply to tickets and want to keep the interface as simple as possible for them. Actually, reading that back they're all pretty weak excuses for not doing it in the admin, but I guess my main thought was that keeping it all front-end managed allows for more consistency for less experienced users, and the large intranet I'm building this to run inside already has a look and feel that is identical when adding content or viewing content.
  6. Although I think I was writing PHP without knowing this myself for about 5 years diogo, but yes - I would also have learned this if I'd started reading PHP books at an earlier stage
  7. This topic is a little redundant in that this page on the site supersedes it: http://processwire.com/about/roadmap/ (not your fault as it's not been mentioned here!) Your answer is most likely the first on the list for ProcessWire 2.5: "Support for maintaining separate draft and live versions of any page." I've edited the very first post to inform people to go there to see the latest roadmap.
  8. I'm with teppo - I always use the semicolon, and he's right on it being optional (though I would suggest it should be standardised on the default template for those not as familiar with PHP as well as for consistency). But then again I always stick my curly brackets at the end of a line as well rather than on their own like all the cool kids, so I'm a heathen
  9. Pete

    Hi Everyone

    Ditto on however many projects I've said I'm working on
  10. Hey folks I'm pretty sure it's not possible, but is there a way to mimic mySQL's SUBSTR() function using a selector in ProcessWire? I've created fields for forename and surname and added them to the users template, but I'd love to be able to get unique initials for the surname so I can have a list of A-Z links linking to pages containing surnames that start with that letter. I know there's a longer-winded way of doing it simply by iterating through all users but wondered if there was a quicker way? The mySQL way is as follows in case anyone was interested, and it is lightning fast (0.0006 seconds): SELECT DISTINCT SUBSTRING(surname,1,1) AS letter FROM yourtable As much as 0.0006 seconds is nice, I'm less worried about speed but just don't want to load all users into memory just for this since it will add a chunk of overhead as more users are added I also realise I could just create pages for all letters with links and display a "no users found" message on pages with no users whose surname begins with that letter, however I like to be neat and not have a link on the letters where I don't need to
  11. Ah yes, Soma is of course correct that since it runs on page save and saves the page at the end it will go on FOREVER. Like I said, it wasn't tested Changing $item->save to $item->save('sort_title') will of course work like he says.
  12. Well it's sort of specific to the template/fields evan has on his site, so no point in submitting it really unless you're reproducing his exact same structure. All it is is his function inside the default helloworld module that comes with every PW install (check inside site/modules directory, and read more here: http://processwire.com/api/modules/ ). You'll be up and running with your own little helper modules in no time
  13. No probs. On a few sites I've ended up creating a little site-specific module like this to check for various templates and do certain things after page save among other things and they can be really useful.
  14. Pricing is very difficult to be honest and unless you are looking to create many of the same types of site (homepage, services page, gallery, contact page for example) you can't really set a price up-front. Even with those types of sites I've often found the client will ask for something unique that means any pricing I might have had at the beginning is automatically different as a result of the unique needs. With that in mind I don't list prices myself and prefer to quote based on at least an initial spec. An analogy would be a plasterer, plumber or electrician trying to have a pricelist for clients without the client first telling them what they need - other trades don't do it and I don't think our industry is much different in that respect. What you can do once if you are in the situation after a few websites that many of them are similar is work out a rough price and put the words "starting from" in front of that price once you're more confident about it, but even then I would worry about potential clients ignoring the "starting from" and focusing on the figure next to it At the end of the day, to most people browsing the internet a website is a website - they just don't know how a "simple" request can mean hours (or on occasion days) of coding or alterations which is, again, a reason why I don't list prices personally. A possible idea for yourself is to work out how much money you need to survive, then take a look on job websites at how much web developers are getting paid near to you and work it out based off those two figures. You should at least be able to work out from a job advert what an average hourly rate is for a developer working at a larger company, though by all means feel free to charge higher than this since you are essentially being designer, developer, salesman and managing director and saving on overheads - you may also find you work longer hours than a normal day job so your fees should take things like that into account if you're trying to give a client a total price for the job up front rather than an hourly fee. Long story short, there is no right answer with pricing, but the world will definitely need more, better websites for the foreseeable future
  15. With just a little more work you could put that function into a module that runs on page save which would then be ideal for your needs For example, something like this: <?php class SortPageTitles extends WireData implements Module { /** * getModuleInfo is a module required by all modules to tell ProcessWire about them * * @return array * */ public static function getModuleInfo() { return array( // The module's title, typically a little more descriptive than the class name 'title' => 'Sort Page Titles', // version: major, minor, revision, i.e. 100 = 1.0.0 'version' => 100, // summary is brief description of what this module is 'summary' => 'Sorts pages by title by second word if first word is "a, the, an" etc.', // Optional URL to more information about the module 'href' => 'http://processwire.com/talk/topic/3306-sorting-by-page-title-with-some-complexity/', // singular=true: indicates that only one instance of the module is allowed. // This is usually what you want for modules that attach hooks. 'singular' => true, // autoload=true: indicates the module should be started with ProcessWire. // This is necessary for any modules that attach runtime hooks, otherwise those // hooks won't get attached unless some other code calls the module on it's own. // Note that autoload modules are almost always also 'singular' (seen above). 'autoload' => true, ); } /** * Initialize the module * * ProcessWire calls this when the module is loaded. For 'autoload' modules, this will be called * when ProcessWire's API is ready. As a result, this is a good place to attach hooks. * */ public function init() { // add a hook after the $pages->save, to sort certain pages if necessary $this->pages->addHookAfter('save', $this, 'sorttitles'); } /** * Hooks into the pages->save method and sorts pages with a certain template based on certain criteria * */ public function sorttitles($event) { $page = $event->arguments[0]; // Only run if the page we just saved has the "item" template if ($page->template == 'item') { $items = wire('pages')->find('template=item'); foreach ($items as $item) { if ($item->sort_title=="") { $item->setOutputFormatting(false); $new_title = (preg_match( "/^(the|a|an)\s/i", $item->title)) ? substr(strstr($item->title," "), 1) : $item->title; $item->sort_title = $new_title; $item->save(); } } } } } I've not tested it, but it's based on the helloworld module, so if you download it (attached) and put it in your /site/modules folder it should work for you, and hopefully be a good example of how easy it is to write modules too SortPageTitles.module
  16. Ah right, I didn't think you'd posted a mistake but it's one I've not personally seen before
  17. Pete

    .pw domains

    pewpewpewpew.pw A site for 1980's sci-fi laser sound clips
  18. Too... many... toilet references... ryan But yes, I instantly thought of plumbing too and agree with someone's comment on the MODx forums about the logo being reminiscent of the HTML5 and Magento logos. I think the only logical reason for another name is the fact that the new service will host other products such as WP, but it would have been nice to somehow keep it similar whilst descriptive somehow (xhost.com is for sale by some cyber-squatting domain holding company for example). That aside, the need to raise money through one service or another to keep a team working is just something that happens when many open source projects get to a certain stage from what I can tell. At some point during the lifecycle of a few of the projects I've kept an eye on, someone ends up working on support full-time or on coding full-time, and there needs to be a source of income at that stage. Usually the full-time coding side of things comes when the project attempts to add something massive as part of the core or rewrite all of the code every few years, but we're blessed with ryan developing optional modules to add functionality and having created a wonderfully abstracted API which allows for code changes behind the scenes and a set of API commands that will change very little if ever in most over the years and not break backwards compatibility *finally takes a breath*. Commercial support is a subject that has cropped up elsewhere on the forums in the past so that is about the most corporate thing that I can think of that might be on the horizon for ProcessWire as several devs have enquired about it, but that's a topic for the future, is something that doesn't affect 99% of users and doesn't affect the usual support on the forums anyway as it's all about paying for SLA's by web dev companies and... businessy stuff... (sorry, it's late and my brain is clouding over with a headache ). I've not been keeping up with MODx in recent years, but whilst they have always had a small, core team of devs doing most of the work I think a lot of ryan's impression of them being a big company may come from an active community (we're getting there as well, definitely!) and a smart looking website (nothing wrong with ours, just picking a description for theirs). Their website when I first discovered MODx definitely said "open source" to me: http://web.archive.org/web/20080103101906/http://www.modxcms.com/ whereas the current one is simply more businesslike and makes them look bigger despite it being more or less the same core team as 4 years ago. I wasn't really going anywhere with that last paragraph other than to say that it's difficult to gauge the size of the team or the capital behind a project from looks alone as the two are worlds apart - and there was a friendlier design in between that one and the current one too that reminds me a bit more of the current ProcessWire site and I think they should have kept for longer: http://web.archive.org/web/20110208164501/http://modxcms.com/ Whatever changes are made to any project, if they're big enough then some people won't like it. A lot of people just don't like change, but much of it can be alleviated by releasing a comprehensive FAQ when such changes are made as it prevents much of the speculation that so quickly spirals out of control. Anyway... my train of thought has pulled into the station and I think that's my lot for the night
  19. I see you've asked that last question over here franci: http://processwire.com/talk/topic/3311-is-pw-a-framework/ - just a heads up for anyone responding to answer there instead since it's a different topic
  20. Technically CodeIgniter and CakePHP are also "pure PHP" and a framework simply gives you a way to get a headstart on development using pre-defined classes etc. I think what you're really asking is if you can use it as a framework and just access its classes directly as with those framework and the answer is definitely yes, but there is no single correct way to work with it which is the beauty of it In ProcessWire, to use it as a framework you would bootstrap it and use the API to get stuff done. Here are some helpful links on that side of things: http://processwire.com/api/include/ - The first few lines show how simple it is to include and get started, then this one shows you the vast majority (maybe all?) of the API functions on one page: http://processwire.com/api/cheatsheet/
  21. With curly braces?
  22. Amsterdam was a blur for me - I was there on my stag do...
  23. Hi Ronnie - as horst says in his first reply: So it doesn't even attempt to check orientation at present. It's a fairly uncommon issue, but at the same time I don't think it's hard to read EXIF data in PHP (sure I've done it before) so it should be something that can be resolved as it would certainly help on photo galleries where this could crop up on newer cameras. Not that I know how - just explaining out loud EDIT: Here's the solution - http://stackoverflow.com/questions/7489742/php-read-exif-data-and-adjust-orientation - the original poster shows how to read EXIF rotation, then actual image rotation is pretty trivial from there. EDIT2: I just re-read horst's replies and the updated code sounds like it's on its way to ryan
  24. Pete

    The Future?

    I actually wrote a serious one line reply along the lines of "WTF?". Then I deleted it once my brain engaged
  25. I'll weigh in and say it's worth looking at some of the easier tutorials too. This topic mentions a couple: http://processwire.com/talk/topic/2565-rocking-the-pw-wiki-small-project-walkthrough/ It also mentions the Wiki which is worth a look too.
×
×
  • Create New...