Jump to content

kongondo

PW-Moderators
  • Posts

    7,479
  • Joined

  • Last visited

  • Days Won

    146

Everything posted by kongondo

  1. All the instructions are in the index.config.php file. See below, edited to reflect your current setup. Have you also read this? https://processwire.com/api/modules/multi-site-support/ - Edit: OK, I see you said you have. <?php /** * ProcessWire multi-domain configuration file (optional) * * If used, this file should be copied/moved to the ProcessWire installation root directory. * * ProcessWire 2.x * Copyright (C) 2013 by Ryan Cramer * Licensed under GNU/GPL v2, see LICENSE.TXT * * http://processwire.com * */ if(!defined("PROCESSWIRE")) die(); /** * Multi-domain configuration: Optionally define alternate /site/ dirs according to host * * If used, this file should be placed in your web root and then edited as follows. * * This function returns an array that should be in the format where the array key * is the hostname (including domain) and the value is the /site/ directory you want to use. * This value must start with 'site-', i.e. 'site-domain' or 'site-something'. This is to * ensure that ProcessWire's htaccess file can recognize and protect files in that directory. * * Note that if your site may be accessed at either domain.com OR www.domain.com, then you'll * want to include entries for both, pointing to the same /site-domain/ directory. * * Each /site/ dir has it's own /site/config.php file that should be pointing to a separate * database. You shouldn't have two different /site/ dirs sharing the same database. * */ function ProcessWireHostSiteConfig() { return array( /* * Some Examples (you should remove/replace them if used). * Just note that the values must begin with 'site-'. * */ 'domain1.com' => 'site-domain1',//these value, site-domain1 is a folder/directory 'domain2.com' => 'site-domain2', 'domain3.com' => 'site-domain3', /* * Default for all others (typically /site/) * */ '*' => 'site', ); } Finally, what do you mean it is not working? What exactly are you seeing? Any errors reported?
  2. @adrianmak, for all Fieldtypes (page fields, date/time field, colour picker, etc, etc...both custom and core) if you want to check if they have settings that can be configured by the user, edit that field and check out their 'Details' and 'Input' tabs. Please try that and let us know if you still can't get time to display in your 'Post Date'. Edit: Beaten by Diogo
  3. You won't find anything specific to Blog. I suggest you search the forums at large for something like this: 'limit page editing to the user that created that page' https://processwire.com/talk/topic/3271-can-i-limit-page-editing-to-the-user-that-created-that-page/ Read that whole thread and modify the autoload module to suit your needs.
  4. '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);//
  5. Also wondering whether to define a 'related post' as only one that has this matching 'tag' AND this matching 'category' to the exclusion of also has either this matching 'tag' OR has this matching 'category'...Hmm, maybe let the dev decide... Edit: Also wondering if can/should use or-groups here? Just my loud musings here in case I forget...ignore me
  6. Thanks for reminding me about this one (I actually forked it a long time ago and forgot about it!! Never thought to use it). Interesting approach Soma uses - raw MySQL (although I don't think I'll have to hook into anything if I adopt this). I'll compare it more closely to justb3a's plus any other ideas I might have and make a decision...
  7. Well that's just plain impossible unless you changed something . Just to be sure, I've just tested it...
  8. Thanks for this justb3a. We currently don't have this functionality. It looks like something I should add. I'll consider it.
  9. Yes, it's difficult to tell since we don't know where your first foreach ends in your code above and whether you are overwriting the variable $child since we also don't know if $out is in the loop or not.
  10. Antti, you mean this? Select Multiple Transfer http://modules.processwire.com/modules/inputfield-select-multiple-transfer/ https://processwire.com/talk/topic/4425-module-select-multiple-transfer/
  11. @LostKobrakai, Here's a couple of links on indexing... http://www.sitepoint.com/optimizing-mysql-application/ http://codesamplez.com/database/mysql-indexing-tips http://weblogs.sqlteam.com/jeffs/archive/2007/08/23/composite_primary_keys.aspx http://www.percona.com/files/presentations/WEBINAR-MySQL-Indexing-Best-Practices.pdf http://stackoverflow.com/questions/14206868/two-column-as-a-primary-keys-in-mysql http://stackoverflow.com/questions/217945/can-i-have-multiple-primary-keys-in-a-single-table http://stackoverflow.com/questions/5835978/how-to-properly-create-composite-primary-keys-mysql http://stackoverflow.com/questions/1823685/when-should-i-use-a-composite-index http://stackoverflow.com/questions/5446124/mysql-why-not-index-every-field
  12. You have the author title in the array keys...But you have to first make sure that you have entered the 'titles' of your authors in their user pages, i.e. the 'Display name (first and last name) field that Blog adds to user pages otherwise the array keys will be empty . Again, we are using their 'titles' not their 'names'. However, if you want to use their names instead, just modify the code above like so...(but I prefer title ) //find blog authors $authors = $users->find('roles=blog-author|superuser, sort=title');//sort doesn't matter here, so can remove //array to hold author NAMES and their posts' count $authorsList = array(); foreach ($authors as $author) { //count number of posts by this author $authorPublishedCnt = count($pages->find("template=blog-post, created_users_id={$author->id}")); //we assume no two authors with identical NAMES, otherwise older will be overwritten //author NAME is $key and their post count $value $authorsList[$author->name] = $authorPublishedCnt; } //sort the associative array $authorsList by posts count ($value), DESC arsort($authorsList,1); //output the author list and post counts foreach ($authorsList as $key => $value) { #this is just for testing. Use your own markup of course echo 'Author Title: ' . $key . ' - Author Post Count: ' . $value . '<br>'; }
  13. I see. The following should do it. It could probably be made simpler but can't think straight this late hour //find blog authors $authors = $users->find('roles=blog-author|superuser, sort=title'); //array to hold author TITLES and their posts' count $authorsList = array(); foreach ($authors as $author) { //count number of posts by this author $authorPublishedCnt = count($pages->find("template=blog-post, created_users_id={$author->id}")); //we assume no two authors with identical TITLES, otherwise older will be overwritten //author title is $key and their post count $value $authorsList[$author->title] = $authorPublishedCnt; } //sort the associative array $authorsList by posts count ($value), DESC arsort($authorsList,1); //rest of your code here to loop through the sorted array above
  14. That's exactly what that code does . Did you try it? Or am I missing something here? What do you want your list to show? Authors only? Or authors + their count of posts? e.g. John - 35, Mary 23, Simpson 5?
  15. Btw, unrelated, note that it is possible to change the author of a post. When editing the post, just go to its settings tab and under 'Created by User' you can change the user.
  16. @Rjay, `data_exact` is just the name given to that index, in other words the index 'Keyname'. I'm no expert but hope the following clarifies this:
  17. Cool. But that will just show the number of posts they have but not (necessarily) sorted according to their individual posts count. For that you would need something like this... $posts = $pages->find("template=blog-post, sort=created_users_id.count");//you might want to limit results depending on use case //test it....it should output the list in DESC order... foreach ($posts as $post) { echo $post->createdUser->title . ' - ' . $post->title . '<br>'; } Count selectors – finding matches by quantity http://processwire.com/api/selectors/#count
  18. Mod note: Moved to Modules/Plugins forum...
  19. You are right, of course...I am having one of those days...I better go to bed
  20. Check your image's fields Input Tab and tick checkbox at 'Overwrite existing files?' Since version 2.5.1
  21. Your var_dump(empty($page->verein_datum)); worked for me as expected
  22. Also...unless you actually changed the template name from 'blog-post' to 'blog_post'...then this line is also wrong... if($p->template->name === 'blog_post' && $p->blog_categories->title == 'Swatches'){ And, you could even shorten it to if($p->template == 'blog-post' && $p->blog_categories->title == 'Swatches'){
  23. blog_categories is a Multiple Page field. This will not work $p->blog_categories == 'swatch'; This has been pointed out above with example code by LostKobrakai. Edit - see next post...
×
×
  • Create New...