Leaderboard
Popular Content
Showing content with the highest reputation on 10/18/2012 in all areas
-
It sounds like you are adding images to a PW page. Here's how you'd do that below. When you are manipulating values on a page, you usually want to have output formatting off. When that is the case, an image field will always behave as an array of images rather than 1 image. So the code below would be the same regardless of whether dealing with a single image field or a multi image field. The example also assumes your images field has the name 'images', but it can be whatever you want it to be. $page->of(false); // turn of output formatting if in template context, not necessary otherwise $page->images->add('/path/to/file.jpg or http://domain.com/path/to/file.jpg'); $page->save(); Note that $page has to exist (and have an 'id') before an file/image is added to it. So if you were creating a new Page, you'd have to do it like this: $page = new Page(); $page->template = 'name-of-template'; $page->parent = '/path/to/parent/'; $page->save(); $page->images->add('http://...'); $page->save(); If you want to delete an image, do the delete and save before adding another: $page->images->deleteAll(); $page->save(); // commit the deletion $page->images->add('http://...'); $page->save(); Or if you want to delete a specific image: $image = $page->images->first(); $page->images->delete($image); $page->save(); // commit the deletion $page->images->add('http://...'); $page->save(); Note that when you add() an image, if you are pulling from an http:// address then your PHP must support allow_url_fopen. Some web hosts have this disabled, though most don't.2 points
-
We've got pages and tags. Pages use template "company" and the template has a Page-field called "tags" (input method is checkboxes, template restricted to "tag"). Like this: c1 (tags: "t1") c2 (tags: "t1", "t2") c3 (tags: "t2", "t3") c4 (tags: none) Finding companies having (at least) one of the tags t2 or t3 would be: $pages->find("template=company, tags.title=t2|t3"); This returns pages c2 and c3 as expected. So far so good. But when we're trying to find pages without certain tag(s) selected, results aren't what we expected them to be. Like this: $pages->find("template=company, tags.title!=t1"); This gives again pages c2 and c3. There's obviously at least two things wrong with the resultset: - page c2 does have tag t1 --> should not be included - page c4 does not have tag t1 --> should be included And finally, what we were actually trying to achieve was finding pages with tag t3 but without tag t2: $pages->find("template=company, tags.title=t3, tags.title!=t2"); And this gives page c3, which is more or less understandable given the previous example of != not working the way it's supposed to be. Still it's wrong. It seems to me that != operator does not work correctly with fields having more (or less!) than one row per page in their database table. This just isn't covered with the way JOINs are used at the moment (and once again I'm not skilled enough to say how it should be done). I'm going to be away from the forums for a few days but I'm sure teppo will take over the conversation if there's any details missing regarding the way we're trying to do this. And yes, we're aware using filter() for the != -part would probably solve this, partly. Still the selectors don't work as expected and pagination would have to be handled somehow. (Edit: fixed a typo 'page t3' -> 'page c3' so that it wouldn't be misleading)1 point
-
Hi eomine and welcome to the PW forums. I think teppo is right and, fortunately, as your client runs his own server this should be easy to diagnose and rectify. Ryan recently posted a reply to a similar situation that might help you.1 point
-
Have you tried using URL instead of ID: http://processwire.c...t=/api/concept/ and so on? Although, judging from the symptoms, I'd be rather surprised if the problem wasn't mod_rewrite-related Edit: I'd recommend doing a Google search (I'm not a big fan of our dear forums built-in search thingy..) with something like "site:processwire.com/talk/ mod_rewrite". You'll find quite a few tips & tricks for troubleshooting + fixing mod_rewrite-problems that way.1 point
-
Have you seen this line from the License at http://imperavi.com/redactor/license/ Looks like a real showstopper ... It seems like this license is introduced for the current version 8.1.0. The older version 8.0.3 is available as a free download from http://imperavi.com/...edactor/getold/ but has no license included and links to the same license page quoted above. Unfortunately the wayback machine knows nothing about imperavi.com and so I was not able to find out about the changes introduced on October 10, 2012. Candycms uses the older version not the current 8.1.0, but also not the one under CC BY-NC 3.0. (some of this thoughts can be found in this thread, too: Redactor - WYSIWYG editor on jQuery)1 point
-
I'm definitely willing to build it unless anyone else has been interested in this. I need to spend a little more time playing with Redactor as I'm still not totally clear about what advantages it has over TinyMCE (other than being smaller). Though the API for it looks quite nice, but that's an advantage to the guy coding the module, not necessarily the end user.1 point
-
Another one to add to the mix: $count = count($page->children)-1; foreach($page->children as $n => $child) { $class = "a$n b" . ($count - $n); echo "<li class='$class'>"; } Using this method, you can target the first item with class "a0" or the last item with class "b0". You can also target any item from the start or the end by specify "a[n]" from the start, or "b[n]" from the back, where [n] is the zero-based index of the item from the start/end.1 point
-
Welcome WinnieB! Thanks for the kind feedback, glad that you are liking ProcessWire. The skyscrapers profile was originally written for PW 2.0 (the first open source release) and so I worry that techniques on the back-end of it aren't so up-to-date and wouldn't be particularly helpful to people. It does run in the current ProcessWire, but I feel like it's kind of outdated so a little worried it would confuse more than help. I do want to update it to be distribution ready again though--definitely on the to-do list. I haven't tried Renoise but really like current tracks by Mosaik (aka Radix) and know that he uses that. I did play around with Sunvox a bit this year, and was quite impressed by it. But time is hard to come by these days, so don't think I'll be back into making music for awhile. But I kind of want to get one of those recycled propane Tank Drums just to chill and play once in awhile.1 point
-
@Marty, Could you give this branch a try and let me know if it addresses your needs? It integrates with the ProcessRedirects module (if you have it installed) to automatically generate the short 'redirect_from' field for you.1 point
-
PW is a flexible tool. So if you wanted a way to set some site-wide settings and manage them from the admin you could: Create a template called something like "settings". This can be a file-less template. Create fields for the settings you wish to have, for example 'sitename' and 'companyslogan'. Add the fields to the settings template. Create a page with the template 'settings'. The page can be named anything but let's also call this 'settings'. Make the page hidden and publish. Now you can use this data in your templates using the PW api. $settings = $pages->get("/settings/"); <title><?= $settings->sitename; ?> | <?= $page->get("headline|title"); ?></title> <h2><?= $settings->companyslogan; ?></h2> This is only one way. Another way would be to do this settings in the config file.1 point
-
1 point
-
But there's a difference between integration and distribution. If it was really GNU compatible, then I could take Redactor and make my own version that just changes the name (RyRedactor), and then offer it available for use to anyone for free. At that point, people would no longer have to pay for Redactor. As a result, I think when they say "integration with open source software" they aren't telling the full story. But if we can find an example of another GNU open source software doing it, then we can follow their lead.1 point
-
I would help to because I need a shopping solution for a german client too1 point