Jump to content

teppo

PW-Moderators
  • Posts

    3,208
  • Joined

  • Last visited

  • Days Won

    107

Everything posted by teppo

  1. @Ryan: looks like I made a mistake somewhere; can't repeat my earlier results either. It definitely looks like it was CKEditor that kept stripping that class after all. This time I'm having problems with extraAllowedContent though -- it doesn't seem to affect anything no matter what I do; tried all the examples you posted and nothing works. Right after adding "allowedContent => true" class stays, but without that it disappears as soon as the field gets focus. Any idea what could be causing this? Edit: extraAllowedContent is definitely sent to CKEditor. At the moment that specific editor instance has editor.config.extraAllowedContent set to "pre[class]", but still for some reason class is removed. Strange. Edit 2: Got it.. pre[class] isn't enough, it needs to be pre[class](*). It's working now
  2. That's odd. The plugin I mentioned (pbckcode) adds classes to pre elements and those were definitely removed by HTML Purifier; right before purify() they existed, right after it they were gone (did a var_dump() before and after to make sure.) I might have to double-check this to be sure though, as I've been using customized CKEditor module since then. You're probably right. It acting overly zealous was probably just because of my admittedly uncommon use case With data-* attributes (and HTML5 elements) problem is simply that HTML Purifier only allows tags / attributes it already recognizes and since there' no HTML5 support built-in it removes all those. Whitelist instead of blacklist or some kind of heuristics probably makes sense, but it can feel rather stiff at times. Thanks, I'll try this out
  3. What you're seeing happens because your featuredImg returns "Pageimages" (multiple images) instead of one Pageimage object and that URL points to where they all reside. I'm guessing your featuredImg isn't limited to only one image via field settings? You need to do either that or specify which image you want, like this: <?php if(count($page->featuredImg)) echo "<img src='{$page->featuredImg->first()->url}'>"; ?> By the way: when dealing with multiple images / Pageimages object, you'll have to check with count() if any images actually exist. With one Pageimage you can simply check if $page->featuredImg evaluates to true (like you did in your code above.) Edit: looks like I'm too slow today..
  4. @kyle: Just tried creating pages via API in PW 2.2.9 and 2.3.1 and in both setting template, title and parent was enough, name wasn't needed.. and like @Wanze and others pointed out above that way PW automagically creates unique names. Then again, I can't really remember how this stuff worked in earlier versions, so perhaps it hasn't always been quite as simple.. Anyway, even if setting name and making it unique yourself is necessary, I'd still suggest using built-in $sanitizer (in API context wire('sanitizer')) for sanitizing your page name instead of own custom code. This way you'll get page names that are 100% compatible with PW (and with less code.)
  5. @Ryan: any chance that you could add an option for setting HTMLPurifier HTML.Allowed? Inline mode is way more usable than regular editor (partly because annoyingly tiny CKEditor windows, but for other reasons too) -- only problem there is that I can't really use it as it keeps stripping tags and attributes I really need At first I thought this should be a setting of HTMLPurifier, but perhaps a CKEditor setting makes more sense. HTMLPurifier already supports setting config options, it's just that there's no way to do it right now in CKEditor without hacking it's processInput() method. Another issue, though this may be more about HTMLPurifier than CKEditor, is that stuff like HTML5 elements and data attributes can't be allowed this easily; they would have to be added as custom attributes and elements, one by one. No wildcards supported here. I don't know if there's really a sensible way to implement a setting for these, though. (As for real world usage example, pbckcode plugin which I use both to edit code and add simple metadata (such as language) uses data-attributes. Luckily it also adds classes, which can be allowed via HTML.Allowed, so problem is mostly fixed with that.) Edit: forgot to add that in addition to HTML.Allowed, CKEditor allowedContent setting needs to be set too. Otherwise content is saved properly but parts of it might get removed when activating the editor, which isn't very nice Annoying thing is that the format for allowed content seems different in CKEditor and HTMLPurifier. I might be completely off the track here though -- while testing this I simply disabled whole CKEditor allowedContent filter by setting it to "true".
  6. Our clients have reported identical problems a few times. After clearing browser history things have returned to normal. This is probably unrelated, just wanted to point out that the issue may not be site-related at all..
  7. Possibly just a slip, but.. you didn't mention A List Apart there? Other than that, http://www.zeldman.com/, http://davidwalsh.name and http://addyosmani.com/blog/ are quite entertaining... oh, and http://blog.ponyfoo.com/ of course! Too much good stuff to keep track of nowadays but that's what Twitter is for.
  8. OK, that didn't work quite as planned -- too much content there obviously. Was it actually cut in the middle like that or did the part with that URL you're trying to output show up too? If it did, it'd be nice to see that and a few lines around it, just to make sure.. What I was looking for was what your $outBody variable exactly looks like at that point -- ie. if it has PHP code, such as <?= ...whatever... ?>, in it. In that situation simple echo wouldn't eval the code and it would print out as-is. @Soma: that shouldn't be needed. PHP echo and short echo can both handle ternary operator just fine.
  9. Short excerpt from search.php of Foundation site profile: // if the above doesn't find anything (perhaps due to MySQL minimum word // length or stopwords), switch to non-indexed phrase match if(!count($matches)) $matches = $pages->find("title|body%=$q, limit=$limit"); This is actually pretty nice idea -- use faster method first and only if it seems to fail switch to slower one. Don't know how much difference that really makes, but still. Also: there's a pager now, which is pretty obvious improvement already
  10. I may be a bit tired here, but I can't see how that was even related to what I asked above Let's try this instead: insert <?= var_dump($outBody) ?> right before your "$partial->set('text_area', $outBody)" row and paste it's result here. This should pretty much show if I was on the right track or not.
  11. This all seems a bit confusing, so I'm not really sure if I'm even on the right track here, but still: is that first piece of markup + PHP you posted actually a variable value, ie. your variable contains stuff like "<p><?= ... ?></p>" etc.? In that case the problem would be that just echoing out a string containing PHP won't (and shouldn't) evaluate that PHP as code. You'd have to use eval() for that, which on the other hand is something I'd strongly recommend against. Anyway, if that's the case I'm sure there are a ton of better options -- but before going any further I'd like to confirm if my guess was anywhere close to reality?
  12. Selector operator "~=" means that at least one of the fields you've defined (teaserBody, contentHeadline, contentBody) has to contain all specified words. Order doesn't matter, though. Are you absolutely sure that's the case? This could also have something to do with either stop words or length limitations, so you might want to test it with longer words and/or change selector from "~=" to "%=". This is a bit slower, but so far I've been using it pretty much everywhere without any severe performance issues.
  13. @Hieu Do: there was some discussion about Apache Solr a while back, though I don't think anything concrete came out of it (not yet, at least.) Most of the modules publicly available are listed at the modules directory, so you might want to check that out at some point.
  14. @videokid, take a look at _main.php: <?php if($page->summary) echo "<meta name='description' content='$page->summary' />"; ?> <link rel="stylesheet" href="<?=$config->urls->templates?>foundation/css/foundation.css" /> String interpolation only works when variable is in double quotes and in those cases it's just easier (and source-wise more readable) when single quotes are used instead of escaped double quotes (\"). On the other hand, elsewhere it just makes sense to use double quotes
  15. Short version: use pages for your tags and page type field to select them. In field settings (tab "Input" to be precise) there's an option called "Allow new pages to be created from this field?" -- this is how you can let your users create new tags on the fly. If you need additional details, I'm sure others will fill in those for you, I'm in a bit of a hurry right now..
  16. "Uncovering the Native DOM API"; splendid article about working with raw JavaScript: http://t.co/d87vnDGIL4

  17. One useful thing to do when having issues like this (if you haven't already done it) is to check your site log files (/site/assets/logs/errors.txt) and - if the site isn't public yet - try turning debug mode on. This could reveal something about the issue. What @horst is referring to sounds like it could be related to blowfish support.. but that should throw an exception which in turn should be difficult to miss. Anyway, that could also be related to the issue here. PHP version info would be helpful to make sure if that's really the case. And ultimately, as @horst already pointed out above, password recovery is your friend here
  18. Did anyone find a solution for this? Having same issue and it's kind of a bugger.. I find myself constantly dragging CKEditor windows larger
  19. Try contacting those who made current version via related forum thread, http://processwire.com/talk/topic/926-french-fr-fr/. If they're no longer around, you could always release your own version anyway. Translations can be found from modules directory, see http://modules.processwire.com/categories/language-pack/. If there's an outdated version there, you'd have to either find the original author or ask Ryan for help with this. I'm afraid that this is really a question to Ryan, but as a partial answer: so far I can't remember hearing of any security issues with PW, so there's not much data to base this on, but I would expect all affected (and still available via GitHub etc.) versions to be fixed if one was actually found. If not by Ryan himself, then definitely by someone else around here. We're rebuilding some sites with PW that were originally built almost a decade ago.. so I would definitely answer "yes" here. In our case 4-5 year lifespan is very common and I honestly wouldn't have even considered PW if I thought that was a problem. Minor versions (as in 2.1, 2.2, 2.3) tend to be pretty big updates for PW, though I don't think any of them has really broken anything big time -- I've updated sites successfully from 2.1 => 2.2 => 2.3 without having to rewrite any code at all. Ryan has definitely made these updates pretty painless, trust me (just take a look at this thread, where version 2.4 compatibility with 3rd party modules was discussed.) On the other hand I would still recommend taking the approach of only updating sites between those if there's a need for it. It would be nice to always have all your client sites (especially if you're hosting those yourself, like we are) at the same (and latest) version, but honestly speaking that's not always meaningful. If there's something in the next minor version you really need, then by all means update. There have been proper update instructions for these jumps that you really should read first, though switching from 2.2 to 2.3 pretty much only meant replacing core files with new ones and so on. Updating from 2.0/2.1 to 2.2 was a bit more complex, I believe, as 2.2 introduced whole language support system - we probably won't get that kind of stuff all the time.. Keep in mind that PW is nothing like WP, where unattended site becomes a black hole of security issues in a few months. As I mentioned before, I haven't heard of a single, fatal security flaw so far and I've been around for a while. Oh but we do: http://processwire.com/talk/topic/1109-processwire-irc-channel/ No problem - and welcome to the forum!
  20. Thanks Pete, already saw one "answered" -label today.. now we just need more solved cases ;-)
  21. .. and in case that you actually want to alter values of previously created repeaters, not just create new ones, seems that this related thread holds an answer for you. You'll have to save the repeater items individually, not just page that contains them. Try something like this instead: $faqQA = $page->faqQA->get(0); $faqQA->of(false); $faqQA->title = '1'; $faqQA->body = '1'; $faqQA->save(); Completely untested and not something I've ever done, but looks like it should work (and kind of makes sense since repeaters are, under the hood, actually pages.) Edit: fixed broken example. Probably
  22. @gtoirog: have you tried reading the docs, most importantly http://processwire.com/api/templates/ and http://processwire.com/api/variables/? This is all explained there
  23. @NoDice: shouldn't be any specific problems with that - though it wouldn't hurt to do some kind of test-run for moving the site before actually publishing it. You know, just to make sure. Regarding link issues, check this thread too, there are couple of methods to fix and/or avoid these mentioned. In short, either do the page save trick introduced by Soma, dump SQL and search+replace as mentioned by Ryan or install Page Link Abstractor to avoid the whole issue entirely (read the module description carefully, though, as it changes the way your links work a bit.)
  24. First of all: welcome to the forum, @NoDice! Not that much really, though it naturally depends on your past experience and so on. With CushyCMS (as far as I can tell from a quick look at their video guide) you'll have to learn how their system works, insert special attributes within your HTML markup and stuff like that. With PW you'll be learning how to insert basic PHP tags within your markup -- not that big a difference. Before you install PW and dive into it's default templates, I'd suggest that you read the basics of working with PW from our docs. ProcessWire is a very simple system to learn: all you really need to understand in order to get started are the basic concepts of pages, templates and fields (and a little bit about querying them and their values with the API.) As an example, you could have a template called basic-page with fields "title" and "body". By default that template would use basic-page.php in /site/templates/ as it's template file. To print out whatever values those fields have you could do this in said template file: <h1><?php echo $page->title; ?></h1> <p>This is static content, not coming from any page field. This will appear on <strong>each page using "basic-page" template</strong> as-is.</p> <?php echo $page->body; ?> Doesn't look too complicated, now does it? Of course you will pretty soon need a few other tricks, such as using foreach to iterate through things like image field containing multiple images, but that's all described in the docs and it's also dead simple. As @MarcC pointed out, it's possible but since multiple pages typically share one template you'd be affecting all of those pages. Then again, if you have a special page for something specific (such as "contact us") you can always create a new template (and a new template file) for that page.. OR you could do something like this in any of your template file: <?php if ($page->url == "/contact-us/") { ?> <h3>Our office is located here:</h3> <iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="https://maps.google.com/maps?q=disneyland,+paris&output=embed"></iframe> <?php } ?> With ProcessWire your options are almost limitless. Don't worry, it'll all fall in place once you start playing with it It's a bit ugly and not something I'd recommend, but: you can also have a field (or a couple of fields) in your templates (all of them or just some) that spit out raw HTML, CSS, JS etc. I say it's "ugly" because it could easily lead to various problems, such as broken page structure and so on, and I certainly would like to avoid such a thing on a client-managed website -- but as long as the site is managed only by you and a few other all of whom know enough to be careful not to break anything and not to insert any dangerous, external scripts etc. it's feasible option. Edit: just wanted to point out that essentially you're wondering whether to use an easy-to-use yet full-blown CMS with almost infinite possibilities (PW) or something that's designed to be "an easy way to change content" (CushyCMS.) Think about it this way: getting used to PW will take more than those "few minutes" CushyCMS promises, but once you do learn how to use it there's absolutely no limit to what you can do with it. On the other hand, if you're a) certain that your needs will stay small and b) really prefer a hosted, service-free tool then you should definitely go with CushyCMS. All in all it depends on your needs and preferences
  25. Have file permissions by any chance changed -- ie. does whatever user your web server is running as have write access there etc.? That would probably be the most common reason for something like this. If you're not sure which user that would be and your site is running on Linux, "ps aux | grep apache" (or echo shell_exec("whoami") in any PHP file) will give you good idea. .. oh, and of course there's always the possibility that there simply haven't been any errors ..
×
×
  • Create New...