Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 01/24/2015 in all areas

  1. this tutorial shows an application of the field: https://processwire.com/talk/topic/8635-simple-example-for-widget-management/?p=83418 whereby the user is able to select what pages a widget shows on, using a selector, or series of selectors.. so in this scenario, a widget can end up showing under some very complex/flexible circumstances, such as: - all child pages of a particular page - selected pages almost anything you can think of in terms of selecting a page with the selector api
    4 points
  2. Great Module! Thanks! I miss one litte functionality - display related posts (or did I miss something?). Maybe someone else needs this, so here is the code (I use this in a TemplateDataProvider): public function populate() { $limit = 3; $selector = array( 'template' => 'template=blog-post', 'id' => 'id!=' . $this->post->id, 'categories' => 'blog_categories=' . $this->post->blog_categories, 'tags' => 'blog_tags=' . $this->post->blog_tags ); // find posts same tag AND category $related = wire('pages')->find(implode(', ', $selector)); if ($related->getTotal() < $limit) { // find posts same category $related = $this->getRelated($related, $selector, 'tags'); if ($related->getTotal() < $limit) { // find posts same tag $related = $this->getRelated($related, $selector, 'categories'); } } $this->related = $related; } private function getRelated($related, $selector, $remove) { $selector['id'] .= '|' . (string)$related; unset($selector[$remove]); $rel = wire('pages')->find(implode(', ', $selector)); return $related->import($rel); }
    4 points
  3. Adrian, no need for custom field for that. Just set parent=page.otherpagefield as selector value for your page field. And thanks for the explanation, I got it! Nope, I mean this: parent=page.manufacturer kind values for page fields "define selector to find pages". They create ajaxified UI for field relations.
    3 points
  4. Got it! I found the Permissions class which is also based on PagesType and was able to find its instantiation in ProcessWire.php, which was helpful. I had to add the following to the init() method in my module: $customers = new Customers($this->templates->get('si-customers'), $this->pages->get("template=si-customers")); // Instantiates the Customers class $this->wire('customers', $customers); // Make the $customers variable available to templates My Customers class right now is just: <?php class Customers extends PagesType {} And is then required at the top of my module.
    3 points
  5. You're right, but extending the FieldtypePage and replacing mostly sleepValue() and wakeupValue() (maybe others, too) should do the job. Edit: Or just use this: http://modules.processwire.com/modules/fieldtype-page-with-date/
    3 points
  6. Regarding "related posts", I also think that it's a pretty important for any blog out there. As a blogger you want readers to stay as long as possible and visit as many posts as possible. A feed of related posts is a great way to achieve that. Not sure if it's still up-to-date, but I've used this Gist by Soma in some projects a while ago, mainly for the scoring part
    2 points
  7. OK kill me for being an idiot. To show my client the progress I am making I posted the dev site up to the server for him to see. Now sometimes, I get confused as to which I am looking at for front end, and which i am developing. I need to do SCSS on local machine, and keep pinging back and forth. So what happened is that down on local I changed the function to nice and simple as I described above. But on local I had forgotten to move the full articles under the summary. So that did not work. Meanwhile up on the server I had moved them, but still had old code working out the link, which is what I was trying to tidy up. Now have everything back in sync. Note to self : Stop working on either local or dev, just use one, then sync at the end. Thank you all for your patience and time. That was my bad. I need to tidy my development process.
    2 points
  8. I was a little confused at first too and thought it might work to generate dynamic/conditional dropdowns like you are describing with the Europe countries example - actually that is a field type that I think would be nice - I have been thinking about it the last couple of days actually What this relation fieldtype does is create a dropdown field that lists the entries for the selected field from all the matched templates/pages. The option value is the ID of the page that has the entry. Clear as mud right Maybe you just need to try it
    2 points
  9. i finally found some time to finish the greek translation, you can download it also from github processwire-greek-language.zip
    2 points
  10. Not sure I understand this module? Is this for creating relation between two page fields? When I select Europe, then in next field I can choose countries from Europe? That is already supported in core. But there seems to be much more in this module than just that. Maybe I should just try this
    2 points
  11. It does have one. Well works for me: http://processwire.com/blog/rss/
    2 points
  12. I'm not quite sure if this is worth to be a module. But I needed it... This Fieldtype creates a select list (drop down) in relation to another field (you can restrict the list by setting up certain templates and / or pages). Installation: 1. Clone the module and place FieldtypeSelectRelation in your site/modules/ directory. git clone https://github.com/justonestep/processwire-fieldtypeselectrelation.git your/path/site/modules/FieldtypeSelectRelation (or get it from the module page) 2. Login to ProcessWire admin and click Modules. 3. Click "Check for new modules". 4. Click "install" next to the new FieldtypeSelectRelation module. Usage: After installation, you'll have a new "Select" fieldtype that will allow you to define the items you'd like in the drop down depending on another field. Create a new field and assign type SelectRelation Click on the Details tab, there you find different fields to create your select list Field: required, choose another field you created before from which the select list should be populated Repeater: optional, if the field you chose is included in a repeater, select the repeater here Template(s): optional, restrict your result by setting certain template(s) Page(s): optional, restrict your result by setting certain page(s) Unique Values: optional, check this field if you want to avoid duplicate values (If you enable this, the string value will be saved instead of the ID. You will not be able to reference via ID.) Including not only visible pages: optional, include all hidden and unpublished pages and pages that user doesn't have access to view Multiple Output: optional, multiple selection (using ASMSelect) Unique Values Disabled If this field is not enabled the key is the pages_id and the value is the value from the other field. <select id="Inputfield_chosen_fruit" name="chosen_fruit"> <option value=""></option> <option selected="selected" value="1026">Strawberry</option> <option value="1030">Apple</option> <option value="1031">Banana</option> <option value="1032">Lemon</option> </select> Note: If you change the value of a field the value changes too. If you deleted a value the value now is empty and multilingualism works like a charm. Accessing the value: // single select echo $pages->get((int)$page->chosen_color)->color; // multiple select foreach ($page->chosen_color as $p) { echo $pages->get((int)$p)->color; } `chosen_fruit` and `chosen_color` are of the type SelectRelation. `title` is the page title and `color` a simple input field (TextLanguage for example). In `chosen_fruit` the selected field is `title`. And in `chosen_color` the selected field is `color`. Unique Values Enabled If this field is checked the key as well as the value are the value from the other field. <select id="Inputfield_chosen_color" name="chosen_color"> <option value=""></option> <option value="red">red</option> <option value="green">green</option> <option selected="selected" value="yellow">yellow</option> </select> If you don't check this box you might have duplicate colors (because there is more than one fruit which has a yellow color for example). BUT if you change the value of an field, your already chosen value stays the same, because there isn't a relation via ID. Access such a field like you are used to: // single select echo reset($page->chosen_color); // multiple select foreach ($page->chosen_color as $p) { echo $p; } TL;DR: I tried to save a comma separated list for duplicate values .It works until you change anything. For example, if you have two times the color yellow a key of the kind '1034,1036' may get saved. Now assume you change a basic color (the banana turns brown ), the selected value is now empty because a key like '1034,1036' doesn't exist anymore. And in the frontend you may get a wrong output.
    1 point
  13. FieldtypePageWithDate & InputfieldPageWithDate Module for ProcessWire - Page Reference with Date Field - Field that stores one or more references to ProcessWire pages Modified version of the FieldtypePage module in ProcessWire with extra datetime field containing the date a page was added to the inputfield. Github URL Link: FieldtypePageWithDate To install Copy to /site/modules/ and go to Admin > Modules > Check for new modules. Requirement Requires: InputfieldPageWithDate (will be installed automaticly) Tested on ProcessWire 2.5.6 dev Setup in back-end install both modules:FieldtypePageWithDate InputfieldPageWithDate create a new field in ProcessWire and give it a nameeg. myfriends as type choose PageWithDate choose the right dereference for your needs (all 3 modes work fine with this field)Multiple pages (PageArray) (in this example we are using this) Single page (Page) or boolean false when none selected Single page (Page) or empty page (NullPage) when none selected assign a selector to the field, in this example we will use users Template of selectable page(s) (select the user template) choose a label field, since we are using users set it to name Label Field name set an input field type, depending if you are using dereference of multiple or a single pagefor this example we are using AsmSelect save the field and assign it to a template of choice Add some users/friends to the field by editing a page with this template Usage in front-end In you template you can acces the field as you usualy do with any FieldtypePage. In addition to this the new parameter "assigned" is available Multiple pages if (count($page->myfriends)) { foreach($page->myfriends as $friend) { echo "id: ".$friend->id."<br>"; echo "name: ".$friend->name."<br>"; echo "assigned on: ".$friend->assigned."<br><br>"; } } This will output something like: id: 1031 name: johndoe assigned on: 2014-10-31 14:22:02 id: 1032 name: janedoe assigned on: 2013-04-15 23:16:38 Note: To use your own data/time formatting set $friend->of(false); to get a unix timestamp from the database Single page echo "id: ".$page->myfriends->id."<br>"; echo "name: ".$page->myfriends->name."<br>"; echo "assigned on: ".$page->myfriends->assigned."<br>";This will output something like: id: 1031 name: johndoe assigned on: 2014-10-31 14:22:02 Note: To use your own data/time formatting set $page->myfriends->of(false); to get a unix timestamp from the database Edited: removed extra date() formatting since value is formatted by default. Set assigned datetime manuallyYou can set datetime manually by assigning it to the page you add $friend = $users->get('johndoe'); $friend->assigned = "2012-01-01 12:12:12"; $page->myfriends->add($friend); $page->of(false); $page->save(); Edited: Added information on manually setting the assigned to a datetime value. (if you previously installed this module you need to update atleast the FieldtypePageWithDate.module file)
    1 point
  14. 'those many other irrelevant' data are actually very relevant ..Your find returns several Page objects (OK, could be one if only one hit found) each with lots of properties about the object. Because of this, var_dump() is not very helpful. What data exactly do you need from your find? Is that what you want to encode to json? Then you could do something like this... $myItems = array(); $items = $this->pages->find("template=ABCDE"); foreach ($items as $item) $myItems[] = array('id'=> $item->id, 'title' => $item->title); $myItemsJSON = json_encode($myItems);//
    1 point
  15. Well that's just plain impossible unless you changed something . Just to be sure, I've just tested it...
    1 point
  16. Seems to all be a-okay. v1 sent off to modules directory.
    1 point
  17. Thanks for this justb3a. We currently don't have this functionality. It looks like something I should add. I'll consider it.
    1 point
  18. Maybe you can with a lot of work. (not out of the box). Better to go with the flow then row against it.
    1 point
  19. Indeed, though it's a bit late. Done already. Hehe! And it works with 2.6 _________ Last round of bug-hunting (help would be awesome) before I release v1 tomorrow morning.
    1 point
  20. It should work fine in 2.5. Just haven't come to test So haven't marked as 2.5 in directory. If you try and it works let me know. I think some update for various admin pages shortcuts needs to get revised but other than that it should be fine.
    1 point
  21. Yeah, I did see that - just thought maybe someone could throw in a few hints. ;-) Because the module is pretty much done, and ready for release (I've even just made a few screencasts which I'll upload in the morning), I'm now wondering (again) if I should make this compatible with 2.5. I guess I jumped over to the 2.6-requirement because I just love the new ModuleConfig. But, I'm sure there are quite a few people who won't be moving over to 2.6 immediately, and that would like to use Jumplinks. So I think I'll just do it.
    1 point
  22. Any chance you could add this to the modules directory? There's a nice list here that's always growing: http://modules.processwire.com/categories/language-pack/ Never mind, you did already: http://modules.processwire.com/modules/process-wire-greek-language/
    1 point
  23. First post cleaned up as documentation is [mostly] ready. Module is now stable, from what I can tell, though v1 can only be released when PW 2.6 is released. (I'm assuming this is still a little while away... yes?)
    1 point
  24. I am assuming you are using the Pagination textformatter (there are a lot of text formatters) With normal pagination, you can use $input->pageNum as LostKobrakai says - this might work with the pagination textformatter too. So: if ($input->pageNum < 2) { $bigimage }else{ $littleimage; } Worth trying Oh, and welcome to Processwire!
    1 point
  25. Bumped to 0.9.3-beta. Added import from ProcessRedirects. (Did some bug squashing too.)
    1 point
  26. Working from another computer I replaced the .htaccess with a fresh copy and it appeared to fix the problem. Unfortunately, I didn't confirm the problem existed on that computer too before replacing the .htaccess Back on the original computer the problem persisted but was resolved by clearing the Chrome cache. So I coudn't be 100% on the exact cause. Never mind Thanks for your help
    1 point
  27. adrianmak, So, saving to a page is just like creating a page. (a page in this case being a group of fields in the admin). If you want to view the entries in some other format, you can create a frontend view for those pages, or you can create an admin page (via Process Module) or use the Admin Custom Pages module.
    1 point
  28. Hi Nico, it's about time for me trying your module. Fist of all: Thank you for sharing! I have a question about the title (or maybe a wish): The title can be pre-filled automatically. I like that. But it is limiting for me. Right now I have a separate field for the window title, called title_window. The reason: This gives me the freedom to name the page differently in the admin (for the page list and selections) and the real title output. The title is filled in by the editor and the title_window is left to set by the seo guy. In case the title_window (SEO) is not set, there is a fallback to the title, when I output the site. (I think that is the way Wordpress handles that too, in combination with the SEO module, if I recall this correctly.) (EDIT: Why an extra field and not the module: I do not like the tab clicking to the SEO area in the normal workflow of an editor. I want the editor to have the title and the SEO title close together. - But this is a matter of taste) Is there a way to mimic that in the module? Select a custom field with a fallback to title? (Of course there are workarounds for me - maybe this idea finds friends in the community But maybe this makes things too complicated. ) And some small thoughts: canonical I would like a comment to the canonical tag field what default you set in case the field is empty. (it is probably the page url without segments and variables?) segments and variable A question is how to handle segments and variables (page numbers) best? I use segments and page numbers for filtering content. To avoid double content I set my templates manually at the moment to set a noindex tag in case a segment or page number is found. I wonder if this is good practice/needed when there is a canonical tag. link rel="alternate" hreflang On my multi-language sites I have something like this: <link rel="alternate" hreflang="en" href="http://mysite.com/en/press/" /> <link rel="alternate" hreflang="es" href="http://mysite.com/es/prensa/" /> <link rel="alternate" hreflang="en-us" href="http://mysite.com/us/press/" /> This links same content in different languages together for Google. Depending on how languages are set up on the site, the module could easily write such code automatically. (Right now I have some hand coded stuff which does exactly that...) EDITED
    1 point
  29. Well, I'll be damned. That worked. (Although without any loading bar, obviously...) I am a very surprised, since I use the very same browser for the local or distant sites (ff 35) and a solid fiber connection. (I'll ask the future webmaster to try with his own provider... We'll be sure.) Anyway, it DOES work, you are my new hero, Nico Knoll. Can't thank you enough for that.
    1 point
  30. You are probably right. I had just tried to force a higher php version by adding a handler to the .htaccess using the cpanel file manager...probably not the best idea. This was just after trying to run ProcesWire Upgrade (only to be told I can't upgrade) I will check the logs when I am next near my computer and report back
    1 point
  31. Mod note: Moved to Modules/Plugins forum...
    1 point
  32. So, we'd be looking to redirect /2015/01/hello-world to /blog/hello-world, for example? Would a simple call like this suffice: $jumplinks = $modules->get('ProcessJumplinks'); $jumplinks->add('{year}/{month}/{path}','blog/{path}'); -- Side note: would you mind renaming this topic to "Module: Jumplinks" and moving it up to "Modules/Plugins"? (also, I think the tags should go...) I just don't want to open up a new topic when I release the final.
    1 point
  33. Okay, so I've actually decided to rename the module to ProcessJumplinks. I prefer it. https://github.com/mike-anthony/ProcessJumplinks Hit counter is done. Still need to work on importing from Redirects module - I'll do that tomorrow as I'm super-tired now. I don't think I'm going to make this compatible with the current stable (2.5.3). If you really want me to, please let me know. Will also work on docs soon - though my intro post covers a lot. Nice to have docs, however.
    1 point
  34. Hello, all! Sorry if this should be in another forum, but I didn't see one for general introductions, testimonials, and the like. I actually don't need help yet (the documentation and existing forum threads have already been immensely helpful), but I am just finishing up my first project using ProcessWire and felt the need to come here and say thanks. I've been designing/developing websites for several years now, and this is by far the most intuitive CMS I've used...from both a development and end-user standpoint. I just showed my most recent client the backend a couple of days ago and he was amazed at how easy it was for him to update content. So, thank you!
    1 point
  35. and that would be, I mean the eastern egg?
    1 point
  36. When you get into sending POST data, ProcessWire has an http class that you can use rather than something like CURL. The benefit of using PW's WireHttp class is that it will fallback to sockets if it has to, ensuring the class works just about everywhere. Here's an example of the same web service we outlined above, except that this one posts to it: $data = array( 'username' => 'ryan', 'pass' => 'mypass', 'email' => 'info@grab.pw' ); $http = new WireHttp(); $result = $http->post('http://www.domain.com/path/to/service/', $data); if($result) { $result = json_decode($result, true); if($result['status'] == 'success') echo "Success! $result[message]"; else echo "Error! $result[message]"; } else { echo "error posting data"; } As a side note, this service is using the same password for the user to add, and the web service password. In reality, you'd probably want those to be different things.
    1 point
×
×
  • Create New...