Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 12/05/2012 in all areas

  1. Today the german "Webkrauts" published an article by Michael van Laar about PW in their advent calendar: http://webkrauts.de/...012/processwire I think by tomorrow the new revision of a german podcast called "Working Draft" will be published where I talked over 20 minutes about PW. And here it is: http://workingdraft.de/99/ [everything in german, sorry]
    4 points
  2. I am making my own collection in a google site, though I would be nervous of putting them in the wiki as I think the accuracy of some of my notes are suspect to say the least! I am not bad at explaining things, however (Which is a touch of a relief since I am meant to be a professional writer!) One thing that would be very useful is some very, very short howtos with examples. I have found what I search for most is things like "how to get the output from a page field" or "what path do I write to include something;" really simple stuff that tends to get left out because the more experienced writer forgets that not everyone is starting with their knowledge. It is the curse of "assumed knowledge" that haunts every technical manual. "What do you mean, you can't read my mind?" This has been a problem with just about every open source system I have ever attempted to use - the documentation is brilliant, as long as you already know how to use the software .... So, covering the basics, complete with one or two simple examples that can be copied and pasted, would be extremely helpful. To a certain extent, I suppose, it is probably going through many of the variables in the API and expanding them to show how they are used. I sometimes wonder whether the eventual Book that everyone rushes out to buy, ought to be actually the edited result of the community created documentation. Not sure if that has been done or not. Joss
    4 points
  3. Your module has to implement the ConfigureableModule Interface: class MyModule extends WireData implements Module, ConfigurableModule Then you can implement the following method, PW will handle saving and displaying the module options! static public function getModuleConfigInputfields(array $data) { $fields = new InputfieldWrapper(); //Generate a Text field for entering the API Key $field = $modules->get("InputfieldText"); $field->attr('name+id', 'apiKey'); $field->attr('value', $data['apiKey']); $field->label = "API Key (Developer Key)"; $field->description = 'Enter the API key'; $fields->append($field); return $fields; } The code above should let you save the API Key in the module config options. Now in your module, you can retrieve the key: $apiKey = $this->get('apiKey'); //or $apiKey = $this->apiKey; Hope this helps! Also I suggest looking at other modules which have config options
    3 points
  4. Hey all! Finished 1.0 version! Updates for version 1.0 [add] Added Textile mode, with huge number of enhancements [add] Added auto mode select (yes!) [add] Added PHP mode, even though there are no means to invoke that yet [enh] Enhanced quote rendering in markdown [enh] Added many styles (sup,sub,cite,code,ins,del,…) [fix] Fixed the default values (and saving the default values) [cng] Show invisibles is off as default Note: Still testing in various browser Please, let me know on github, what works and what doesn't. Thank you!
    3 points
  5. Don't use images in text wysiwag. Seriously. I think u can avoid a lot of issues. Think if you replace img with a different size and ratio. I stoped doing it and use other ways a long time ago. You just give away control, and editors start to think they need to do design. All websites we done with free images in text are horrible after 1 month in hand of a client and lots of maintenance needed. Use repeater to make blocks with images and a option to align or size. Or intext tags where to put image. Theres even a module. And your back in control. And other nice effect.
    2 points
  6. At present I don't think there's a better way since those images are hard-coded in TinyMCE's output and the filename essentially changes when you upload a new one. But one way we might accommodate it is to provide a new setting with the images field that lets you enforce a specific filename… perhaps [field-name]-n[index].[ext]. That way if you replaced an image, the new filename would be the same as the old (so long as you didn't go from JPG to PNG or something). No doubt might cause some unexpected browser cache issues, but most solutions have compromises of some sort or another. This could be a worthwhile option to provide.
    2 points
  7. Isn't good for search-engine ranking? Really? Don't think so. You would never give or render a url "/about-us" anyway in your site, so what is the problem again? Google won't ever think there's "/about-us" and in case someone enters a link like this it will get redirected (301) to the one with slash. There's not 2 urls that work, only one. The one without get's redirected. Never ever seen or heard or experienced any issue with such things regarding search engines or SEO. Once you start messing around with it, like some with and some without and some that have children have one and pages without don't, will make things difficult changing it will give maybe some problems with search engines. IMHO this discussion about trailing slash is far from being relevant at all. So I don't need an answer or think there's none. Personal taste and influenced by how you think it should be
    2 points
  8. The obvious problem with this approach is that you need to understand how caching works and what results it can have; ie. after adding these headers some users won't see new versions of changed files until a year later, which could result in quite a few strange situations. Of course you could say that your files never change, which may or may not be true (or if they do, all related filenames also change.) For me, at least, it just doesn't work that way. That's also why I don't think something like this should be enabled by default -- although I do agree that PW could perhaps provide an easy mechanism to set something like this up Here's another (rather good) article about expires headers by Christian Johansen. Highly recommended, if you're going to play around with those.
    2 points
  9. Hi Joss, Thank you for the link, I think this could be very useful for future reference. I've actually used some of the frameworks mentioned in the article, namely Twitter Bootstrap, Foundation and the Golden Grid System. I find this kind of frameworks to be very useful for certain projects, and they certainly save a ton of time. My beef with them, though, is that whenever I use any of these in a project, I find myself somehow changing the way I like to work to really take advantage of their power. So, what I'm currently doing is using my own, home-made "framework". This approach has worked great for me so far. Anyway, this is actually my first of hopefully many posts to come. Claudio
    2 points
  10. Ryan, I have bookmarked a ImageClass on github which has this functionality. I never used this class, your ImageSizer and Antti's Thumbnails where alwas sufficant for me, but maybe you can copy some lines from there? https://github.com/s...Images.php#L151 Edit: Now I think this class isn't very useful for this. The time I bookmarked it I thought it is great, but now with some weeks working with php and PW at least cropping part of this class looks pretty simple. It guess PW made me learn some php.
    2 points
  11. Thanks guys, I've actually been working a lot on textile recently and want to push some big changes to the code soon. In the meantime Antti, if you do go down the textile route, then you probably want to use the TextileRestricted() method as this is meant to deal with input that's coming from untrusted sources such as public comments. The normal mode in textile supports a far wider range of features.
    2 points
  12. I wonder if Spritely would come in handy for better cross browser compatibility and the clouds.
    2 points
  13. Words of encouragement from the Pub's amateur psychiatrist (Read best in a soft spoken, German accent) Ah, you are here because you have been reading things in this forum about pages that have left you confused, disorientated, befuddled. You thought you knew what a page was - you have been thumbing through them, folding them, studying them, wrapping things up in them and scrolling up and down them for most of your life! A page is this solid item - this great lump of data stuffed with things. But now you have come to Processwire, and everything you thought was true, simply isn't any more. For in Processwire pages are completely different - they are not great gulps of information, but tiny little things, nothing more than a link to the more interesting world of fields and templates; just a little blip of data in your huge fascinating database. Pages in Processwire are used for all kinds of things. They can be used as a marker in your pages list. They can be used as a group parent for other pages. They can be used as categories, tags or lists or users. And they can even be used for simple drop-down selects - just to supply a label and value. It can seem crazy to use such an iconic thing like a page for such a mundane and trivial task! But don't worry and fret, don't lose sleep or pace the floor as you think the reputation of the noble page is being crushed! In Processwire, they are fulfilling their duty to the full - and the more slight the task, the more they bound up to the wall and jump up and down shouting "use me, use me!" And, as a bonus, they can even be used for content - for all that stuff you thought was a page, but in Processwire isn't! So, don't be put off by the Processwire page - use it for everything! it is much smaller than you think, takes up hardly any space at all, is well behaved and only will do its thing when it is called. In fact it is hardly a page at all .... and then again, it is also so much more!! Better now? Joss Freud
    1 point
  14. Hi, Here is another processwire powered site, completed recently. http://www.kapelis.com/ the way this is setup would not have been possible without processwire, which has made it easy and accessible for the client to update all aspects of the site without having to code or use a wysiwyg... -marc
    1 point
  15. Wow. you know where I am going? That is one up on me - I never know! These are just the sort of rough notes I keep for myself on everything - I have a memory like a swamp (but less attractive - too many years in the music business) If you can set up a category that is called pages for checking or being worked on or something so some poor unsuspecting innocent does not wander in and think this is Gospel, I would be happy to start putting in all kinds of stuff. Actually, that is a good idea whoever is inputting stuff on a Wiki - the good side of a wiki is that it encourages community co-operation. The not so good side is that there is often a lack of editorial process, and readers can get really messed up! Getting some sort of oversight also frees up and encourages contributors - they are less worried writing something that might be wrong or has already been covered, or needs to be cleaned up if they think someone else is going to check the entry before they put their foot in it. I would suggest a series of banners: "This article has been adopted as part of the official documentation" "This article is awaiting peer review and is not yet adopted as part of the official Documentation" "This article is currently work in progress and should not be used as an authoritative source." The last one would be automatically added to all new entries. Oh, and all articles should be related to PW versions, so stuff that applies to v2.2 but not to 2.3 is clearly marked as such, for instance. If anyone has ever used the Joomla documentation via google, they will know that they can spend hours trying to make something work that wont because they ended up on the old help site by mistake. (Oh, was that only me then?) Other bits and pieces that jump to mind is with relating the WIki to a snippet library (possibly) and making sure things like the SyntaxHighlight GeSHi extension is installed (probably is). I could waffle on all day about this stuff - mostly because I am no fan of MediaWiki! (but use it anyway.) Anyone got a great big Java servlet based server so we can install Liferay??? Joss Edit: On a side note, I have just cooked baked salmon and served it with a turnip and carrot purée with orange zest, a mushroom and fennel sauce and pepper and pea cous-cous. Just thought I would throw that in.
    1 point
  16. I have an image field with setting 'Maximum files allowed' set to 1 (in case that's relevant). I drop an image in it and save and then use that image in a textarea field when editing copy (with TinyMCE if relevant). But is there a neat way to replace such an image for a new version? Right now I am dropping in a new image and saving except then the textarea shows a placeholder space not the image which makes sense as the original is gone but if I select the placeholder and click the image icon in the TinyMCE toolbar then I get an error (saying the image is gone) rather than an opportunity to choose the new version. I know I can delete the image placeholder in the copy and add the new one but then I loose stuff like any alignment or size settings. Anyone know if there is a neater way to perform the replacement of images?
    1 point
  17. Big improvement, glad to see it I know the original design contributed to me initially overlooking PW. The one thing that is driving me nuts right now is the "motor" mono-space font in the documentation, something about it I just find really hard to read, in fact I've gone as far as to use stylish to force it back to courier. Anyway, just my opinion, not really a great idea to get fancy on pre-formatted text used for docs.
    1 point
  18. Correct me if I'm wrong, but what Google doesn't like are 302s. 301s aren't themselves bad, but can be less helpful to pagerank when stacked. I don't agree with the broad statements of the linked article. A properly used 301 is in fact a great thing for SEO. But also something to be careful with if you want to maximize the value of it. My experience has been that proper use of 301s is one thing that separates the good SEOs from the unknowing ones. They enable you to relocate URLs in a manner Google will transfer pagerank through. They also enable you to ensure people are always arriving at a consistent URL, thereby making it extremely likely that people will link to you in a consistent manner. Lack of properly used 301s increases the odds of diluted pagerank and duplicate content penalties. When someone loads domain.com in their browser and it 301s to just www.domain.com (or the opposite), thats a good thing. When someone types www.domain.com/about-us in their browser and it 301s to www.domain.com/about-us/, that's a good thing. When you have an old About Us link at domain.com/page.php?id=123 that 301s to www.domain.com/about-us/, that's a good thing. This is all good for SEO and good for the users. If this is consistent and stays that way, the external links that you build up over time will also be consistent. The pagerank that you accumulate over time will be maximized, not diluted. And what rare external links that point to content at an inconsistent URL will be identified as such by Google while still transferring pagerank. Where benefit starts getting lost is when you use 301s in a manner that sends it through several paths. My understanding is that Google does dilute pagerank somewhat the more 301s it has to go through in order to meet a request. Example: link points to domain.com/page.php?id=123, which redirects to www.domain.com/page.php?id=123 which redirects to www.domain.com/about-us which then redirects to www.domain.com/about-us/. The user still gets to the right place (good) but the pagerank value of the link that was pointing to domain.com/page.php?id=123 has been diluted to some extent (though don't know how much). Meaning, lost potential, but certainly better than a 404. A smart SEO keeps tabs on this stuff and corrects the first 301 to redirect to the proper URL rather than having to go through further unnecessary 301s. Pagerank potential gets maximized rather than diluted. The use of a slash vs. non-slash shouldn't be a factor for SEO, so long as it's consistent and 301s to the proper version (excluding root level of course). When someone is advising you to always use trailing slashes, I think this is what they are really saying: 1. Always be consistent in how you link to your own pages (regardless of slash standard). Preventing an unnecessary 301 here reduces the chances of some other 301 getting stacked on top of it. It maximizes the value of the link. 2. Standardizing on a trailing slash reduces the chances of having to implement more 301s later (further reducing the chances of a 301 stack). From an SEO standpoint a trailing slash will scale better because there is no functional reason to ever have to change. Whereas, without a trailing slash there is potential for having to change to one in order to accommodate future growth. I keep up with SEO stuff, but it's not my full time job either, so someone correct me if any of this has changed.
    1 point
  19. fmgujju, Can you check on processwire.net? I just made it a little larger, which can't hurt. Well thinking about it, it looks really strange on your computer, as if font smothing isn't on for your browser under a certain fon size (i'm sure it's this).
    1 point
  20. Thanks much for the feedback. That's nice of you. Well Chrome != Chrome, looks like you're on Windows? It looks top sharp on Chrome OSX. That's how it looks for me. So changing it to other font-weight will make it look to bold here . But I'm sure we can look into it, but have to say it's the usual webfont != webfont != browser != os. Never can get it perfect for all except chosing Arial or Verdana. I'm sure you know already. Well, maybe just a tin larger will make it look better.
    1 point
  21. I really like the new design. It's modern, sleek and most importantly clearly stating all of the important features up front with try out demo download links. That is what most of every other CMS has it on their site to promote their CMS. Congratulations to Ryan and his team who work hard to make it happen. Just the small thing I have notice on the Chrome browser. Main features text is not showing up clearly (font is breaking up) on the Chrome browser. Please see attached snapshot and highlighted area. If I turn-off font-weight then looks much better. I would suggest to make a change since Chrome browser has gain lot of share in the market now-a-days. Without CSS modification:Original With CSS modification:Removed Font-Weight
    1 point
  22. This might be a more efficient way to go, by converting multiple $pages->get() calls into 1 $pages->find() call. $ids = array(); while($row = $result->fetch_array()) $ids[] = $row['video']; $bw = $pages->find("id=" . implode('|', $ids) . ", category=17|23|9");
    1 point
  23. Well, just for fun, these are my rough notes (I have hidden all the ones that say things like "what the bloody hell is this?" or are my notes directly about one of my projects https://sites.google.com/a/stonywebsites.co.uk/cms-notes/
    1 point
  24. Wow, that cat got well and truly skinned! Joss
    1 point
  25. Hello, Wow, I totally forgot about those old games until Joss reminded me about that bit of gaming dialogue! Obviously, on the whole, coding has moved ahead leaps and bounds. But sometimes, I wonder... Are there any points where coding "of old" did things better or easier than coding now? Probably, this is completely crazy. And while we're doing fantasy coding, maybe there's room for an "unless" statement in PHP... if($page->intro_image) { <img src="<?php $page->intro_image->url"; ?> alt="intro image" /> } else { echo "You forgot to add an intro image! Please edit the page now."; } unless($page->no_images_checkbox="1") { echo "You chose not to add an image to this page!"; } Thanks, Matthew
    1 point
  26. Quick, dirty version: https://gist.github.com/4215822 First argument is 'key' so the function can globally remember its index, then how many arguments you like - those are strings that get looped. Can be upgraded to do the string break up (so you'd pass something like "left|center|right"), and if you added autocreating the key (by sha1-ing the argument string), you could get to <div class="<?=switch('left|right|center')?>"> But I'll leave that up to you -- Of course, you can use this for the zebra table as well <tr class="<?=switch('zebra','odd','even')?>">
    1 point
  27. That doesn't really matter - the advantage of a wiki is that everyone (who is a registered user, in the case of wiki.processwire) can edit anything, and annotate their changes as to why they made the edit. My own feeling is that people should be a bit more relaxed about diving in and adding to the wiki, as I am sure that the PW community is one place where you can be sure of a supportive and friendly response to contributions.
    1 point
  28. I think you are looking after this:
    1 point
  29. Well THANK YOU very much ! I've made quite a lot of different tries on that problem but wa sunable to solve it by myself and now I go a little step further. That's very nice of you to take the time to provide such detailled explanations in your answers. I still have a long way to go to better understand those 'pages' issues... But what makes it incredible is how your explanations often make it so simple and clear. That's when I feel like improving a lot in a few seconds and when Processwire becomes something incredibly powerful... And good thing also about the selectorValue() sanitizer... I've missed that one, although I had problems with commas in another field of my site ;-) Well... I can then go on with my coding. Thanks again!
    1 point
  30. Thank you Ryan, you are absolutely right!
    1 point
  31. I did what I should always do when I have a problem like this: strip everything back, I created a new mamp site folder with simple PHP and echoed out words to help me understand what was going on on each page reload. Then I adapted it to my PW installation, all seems OK now. The putting it into words thing is surprisingly handy - helps me understand much better! At top: <?php $settings = $pages->get("template=settings"); $info_bar = $settings->info_bar; $out = ""; if ($info_bar) { if (!isset($input->cookie->InfoBar) && $info_bar) { setcookie("InfoBar", $info_bar, time()+3600*24*30); $out = "Field exists and cookie wasn't set so cookie set anew!"; } elseif (isset($input->cookie->InfoBar) && $input->cookie->InfoBar !== $info_bar) { setcookie("InfoBar", $info_bar, time()+3600*24*30); $out = "Cookie existed but content didn't match, so cookie reset!"; } else { $out = "Field has contents but cookie matches so nothing needed to be done"; } } else { $out = "Field is empty!"; } ?> At output: <?php if ($settings->info_bar && $input->cookie->InfoBar) { if ($input->cookie->InfoBar !== $settings->info_bar) { ?> <div id="info_bar"> <div class="container"> <?php echo $settings->info_bar; ?> <a class="close" href="javascript:void(0)">x</a> </div> </div> <?php } } ?> May help people out if they're stuck too
    1 point
  32. Added it: http://modules.processwire.com/modules/template-editor/
    1 point
  33. Thanks Ryan, although that's quite an overstatement what you're saying. But I'll take it. It's always nice to get feedback, especially positive one coming from the Guru Himself.
    1 point
  34. @digitex: You may have a logical problem, if I've understood you right. Let's say you've got rental periods like this: A1: 2013-01-05 ... 2013-01-12, cottage A, booked: 0 B1: 2013-01-05 ... 2013-01-12, cottage B, booked: 0 A2: 2013-01-12 ... 2013-01-19, cottage A, booked: 1 B2: 2013-01-12 ... 2013-01-19, cottage B, booked: 0 Now if you're targeting the repeater items with a selector like this (left some details out) "date_from>=$fromvalue, date_to<=$tovalue, booked=0" to find out which cottages are available from 2013-01-05 to 2013-01-19, you'd get items A1, B1 and B2. Then, using the method Ryan described in post #14 of this thread, it's easy to find those items correspond to cottages A and B. But this does not mean both of those cottages are available for the whole period, just like you're saying. So, if the rental period (say 14 days) spans over more than one rental term (7 days), it's necessary to repeat the procedure for each of the terms individually and only then you're able to see which cottages appear in the results for all the terms. Combining all of the above, I'm suggesting something like this (haven't tested so no guarantees): // rental terms of the desired period in a handy structure $termsInPeriod = array( array( 'start' => '2013-01-05', 'end' => '2013-01-12' ), array( 'start' => '2013-01-12', 'end' => '2013-01-19' ) ); $cottages = array(); foreach($termsInPeriod as $term) { // find matches for this term $matches = $pages->find("template=repeater_rental_period, date_from>={$term['start']}, date_to<={$term['end']}, booked=0, include=all"); // no matches this round --> no matches on the whole, no matter what may have been found before if(!count($matches)) { $cottages = array(); break; } // array to hold found cottages for this term $termCottages = array(); foreach($matches as $item) { $property = $pages->get((int) substr($item->parent->name, 9)); if(!$property->viewable()) continue; // skip if property is unpublished or something // now you have the $property and the matching repeater $item $termCottages[] = $item->id; } // some results from previous rounds? // - yes, then find out common matches // - nope, first round --> use the results as is if(count($cottages)) $cottages = array_intersect($cottages, $termCottages); else $cottages = $termCottages; } In the end $cottages should hold all the cottages available for the given period. I'm using $item->id because of the array_intersect(). I'll leave it to you to form a structure like $termsInPeriod from your input - and probably this is fuel for your own thinking at most anyway.
    1 point
  35. Can I just say that if ever there is a book written about how to use ProcessWire, this should be the foreword - it's perfect! I did fail to read it in the suggested accent and read it in an Austrian Arnold Schwarzenegger accent - it was amazing (like this - http://bit.ly/c7op9H ).
    1 point
  36. Let me know if you ever plan on running for president. I would emigrate to the U.S. just to vote for you. Works perfectly. I'm glad I found an actual issue and not another case of "what am I doing wrong".
    1 point
  37. The problem is that page $f doesn't know the repeater item changed. Those repeater items are individual pages themselves. You can solve this by saving the repeater item ($g) rather than the owning page ($f): 1. Replace your $f->save(); with $g->save(); 2. Also replace your $f->of(false); with $g->of(false); 3. Lastly, I also suggest replacing your first line with this: $found = $pages->find("parent=/invitations/$user->name, guests.guest_name=" . $sanitizer->selectorValue($form['oldname'])); Adding that selectorValue() sanitizer in there will prevent problems from occurring if the guest_name happens to contain characters like commas or quotes.
    1 point
  38. You could do it easily adding classes with PHP, but CSS allows you to do this: tr:nth-child(odd){ background-color: red; } tr:nth-child(even){ background-color: blue; } edit: Joss was faster and mine would be a damn ugly table...
    1 point
  39. With CSS 3: tr:nth-child(odd) { background-color:#ccc; } tr:nth-child(even) { background-color:#666; } Or, there is this JQuery to add classes (I haven't tried this, just stole it....) <script type="text/javascript"> $(document).ready(function() { $(".myTable tr:even").addClass("bgOne"); $(".content div:odd").addClass("bgTwo"); }); </script> Joss
    1 point
  40. I think you need to provide more detail. For the sites I have build I have always used the one /tools/ page which has many subcategories, like: /tools/recipes/recipe-categories/ /tools/recipes/recipe-types/ /tools/tags/common-tags/ /tools/tags/events-tags/ /tools/cities/ etc... Some of those are editable by client, others just for superusers.
    1 point
  41. You can put templates within templates. So, if the central bit of data is the same each time, but the content that goes around it needs to be different, you can include one inside another. For instance, you can create a file called layout1.inc that has one version of the layout. Then include that in your template in the right position. You can create several different layouts and decide which ones you want using options on your template. You can make the entire template up with 4 or 5 includes, all supplying different parts of the layout For instance, I have a general page that looks like this: <?php $maincontent = "TB_mainbody.inc"; $secondcontainer = "TB_sidebar.inc"; /* * Construction */ include("./includes/TB_head.inc"); include("./includes/main_layout.inc"); include("./includes/TB_foot.inc"); ?> The two variables at the top relate to includes that are in main_layout,.inc, in this case. So, this template calls three includes, and one of those (which has some very simple markup) calls two more that has all the main fields for the template. I can change the variables and I end up with something completely different. It is probably a case of drawing it on a piece of paper, Joss Edit: By the way, the reason I split the above into three files rather than have one full of variables, is that I like to be able to change the header and the footer of my template independently sometimes. It is not any better, but can make it a bit more reusable.
    1 point
  42. Love it. The clouds don't move for me in Chrome or Firefox on Windows 8 but they do in Safari... albeit very jerkily! Whether they move or not isn't essential though since it's the content that counts and the focus should be on the screenshots. I'm seeing both sides of the argument (not that anyone's arguing) on having the Futura admin theme on the homepage - I wonder if these three areas should be some sort of slideshow instead? Perhaps the middle panel could start out as the default admin theme - if only to match the colours - and then fade through? It's a tricky one as all the shots show off the admin or a module, but I wonder if somehow it needs to show what you can create with ProcessWire too as Tripsite and VillaRental from your site sold me on ProcessWire ryan!
    1 point
  43. Not to completely hijack this thread, but... you may wish to read this: http://www.cmscritic.com/critics-choice-for-best-free-cms-goes-to/ I've sent Ryan the badge below for ProcessWire.com if you feel like showing it off
    1 point
  44. I think that's a matter of opinion. You could always create two templates which are allowed to be children of its parent. Eg: project_brief and project_full then let the client select which they want for each "project". Or, you could provide the client with checkboxes to determine if they want to show/hide certain elements on each page. Eg: if ($page->show_breadcrumbs == 1) { include("./breadcrumbs.inc"); } Ultimately PW gives you ultimate control over what you (the developer/designer) want to do with the site. You can go many ways about displaying the content. "views" using urlSegment, different templates or even giving the client choices by way of checkboxes. There are probably many more too. EDIT: Perhaps you can give us an example of what you are trying to achieve ADB and I'm sure there's some really easy ways to achieve it. I've yet to find something in PW that isn't easy to implement or that someone already hasn't provided code for.
    1 point
  45. You need to look at INTERCAL. From the page -
    1 point
  46. Greetings, I have to say, it's satisfying to know that there are others here of my generation. Often, it feels like Web development is utterly dominated by the brilliant and capable under-25 set. To Joss: yes, your point about the conditionals is precisely what I was talking about! Maybe it's also because we are writers, and any time we say "If..." we eventually also have a "Then..." We also have "Unless" and "However," which might be neat additions to PHP! This touches on a bigger subject for me: in recent years I've become fascinated by the whole idea of coding as a "language." Of course, we use the words "language," "syntax," "verbose," etc., all the time in this world, but I'm talking about a more fluid interpretation. What we do, more and more, becomes a way to communicate subtle and complex ideas. And the fact that it is international makes it like some kind of universal poetry. Anyway, I'm just posting some thoughts that are on my mind a lot these days. Thanks, Matthew
    1 point
  47. My first experience of programming (I am old enough that it wasn't called coding back then) was with a large Prime mainframe owned by Ed Ross of Quantime. (and the incredible statistical analysis program called Quantum) I was only in my teens and my brother was working there in sales. Now, I would love to tell you how what I did related to what I do now, but since it was all on punchcard and there is rather a large gap in the middle, I haven't the foggiest!! By 1977, things had leapt on in, well, leaps, and I remember going into the company to play the brand new game they had just been sent - Zork! Never did solve it though ... I have a copy somewhere, perhaps I should try again! Joss
    1 point
  48. This is exactly correct. Lets say you've got this page /user-profile/ in your site. You also have a template called user-profile, and it has URL segments enabled. In the code, all you need to authenticate is to compare $user->name to $input->urlSegment1. Meaning if user 'onjegolders' accessed the URL: /user-profile/onjegolders then you would allow them to make changes to their profile. if(!$user->isGuest() && $user->name === $input->urlSegment1) { // user is authenticated and may change their password if($input->post->submit_pass) { if($input->post->pass !== $input->post->pass_confirm) { echo "<h2>Passwords do not match!</h2>"; } else if(strlen($input->post->pass) < 6) { // if you want to enforce a minimum password length (recommended) echo "<h2>Your password is too short. Must be 6 characters or more.</h2>"; } else { $user->of(false); $user->pass = $input->post->pass; $user->save(); $user->of(true); echo "<h2>Your password has been changed</h2>"; } } echo "<form action='{$page->url}{$user->name}' method='post'>"; echo "<p><label for='pass'>Change your password</label>"; echo "<input type='password' name='pass' /> "; echo "Confirm: <input type='password' name='pass_confirm' /></p> "; echo "<input type='submit' name='submit_pass' />"; echo "</form>"; } The above was just written in the browser so may need tweaks.
    1 point
  49. I agree with that guy's generalisations - frameworks are always bad. I hate saving tonnes of time and love reinventing the wheel on a daily basis because I have nothing better to do and love watching the years fly by.
    1 point
  50. Using getItemKey isn't really necessary since you can already get that from the foreach(). I think that CSS is where all this really belongs, but if needed to support legacy browsers without using the ":" options in CSS, here's another approach... I'm writing in the browser without testing, so forgive me if this needs adjustment. foreach($page->children as $key => $item) { $class = 'a' . ($key+1) . ' z' . ($page->numChildren - $key) . ' ' . ($key % 2 ? 'odd' : 'even'); echo "<li class='$class'>{$item->title}</li>"; } From there, you should be able to target any item directly with CSS: li.a1 { /* first item */ } li.z1 { /* last item */ } li.a2 { /* second item */ } li.z3 { /* 3rd from last item, etc... */ } li.even, li.odd { /* self explanatory */ } The "a" class is counting from the beginning while the "z" class is counting from the end. You could substitute any class name, but I'm just using "a" to refer to "from the beginning" and "z" to refer to "from the end" (US alphabet).
    1 point
×
×
  • Create New...