Jump to content

kongondo

PW-Moderators
  • Posts

    7,529
  • Joined

  • Last visited

  • Days Won

    160

Everything posted by kongondo

  1. Works fine here...
  2. Welcome to PW and the forums palacios000. Your $supplier is in PHP terms an object. With that, you have all attributes of that object at your disposal; its id, name, title, parent, children, when it was created - everything . So all you need to do is, e.g. echo $supplier->title; //or echo $supplier->supp_check_in;//No need to do the $pages->get(1234) again. Here I assume I assume blng_supplier is a single page field. If it is a multiple page field, you would have to loop through it..
  3. Glad you got it sorted.. Pagination: That's why I recommended to ensure you use the same PageArray for your totals and the renderPosts(), i.e. the $posts PageArray. Anyway, test and see. Limit: It is always good to limit results. With pagination, users can always get to the next results. What you set as a limit depends on other factors such as site traffic. So, it's up to you really but rule of thumb is to limit results if you don't need to show all of them at once. Code to remove: I meant to uncomment just the code for the totals count but you have already sorted that out, no worries.
  4. I was sleepy yesterday ....Ignore some of the above... If you will never use headline counts anywhere else but in your $sidebar, then you can just uncomment the /markup/posts.php code in renderPosts() in blog.inc. This (Blog) is a site profile so you can pretty much do with it as you want...Then, use the code I wrote above to get the total counts in your $sidebar. The only thing to ensure is that you use the same PageArray for $posts for your $sidebar (total count) and your renderPosts() ($content/rest of the post) - hope this makes sense.
  5. OK, I get you. In that case you will have the headline counts rendered twice . First on top of your 'rest of the posts' ($content) and secondly in your $sidebar with the code I showed you. You have a couple of options to deal with the first/unwanted headline counts: 1. Use CSS to hide the count in your 'rest of the post' 2. Modify the renderPosts() function to do what you want. 3. Modify /markup/posts.php to do what you want (only send $total if....blah blah -see pseudo code below) 4. Use my Blog module instead with 'post_count' = 0 to not output the posts' count for #3 suggestion..[see edit below; maybe not really necessarily if you want to completely get rid of the counts in renderPosts() if($total && $page->template !='posts') echo "<h3>" . sprintf(__('Posts %1$d to %2$d of %3$d'), $start, $end, $total) . "</h3>"; //OR if($total && $page->template =='blog-list') echo "<h3>" . sprintf(__('Posts %1$d to %2$d of %3$d'), $start, $end, $total) . "</h3>";
  6. 1. Those are not actual fields per se. No fields are created in the database. The method just 'creates' inputfields (i.e., HTML input 'areas') that are displayed in a module's configuration screen. The user configurable values in those fields are stored in the database (in that module's row in the 'modules' table in the 'data' column) in JSON-like format. On uninstall, a modules record is deleted from the database (i.e. its row in the table 'modules'), so, everything about the module is deleted: public function ___uninstall($class) in /wire/core/Modules.php/ $database = $this->wire('database'); $query = $database->prepare('DELETE FROM modules WHERE class=:class LIMIT 1'); // QA $query->bindValue(":class", $class, PDO::PARAM_STR); $query->execute(); 2. Although there are some methods (functions) specific to modules, you can use any(almost any?) PW and PHP method with modules. It is just PHP . If you are really into this, I would suggest to first study the source code of a couple of modules in the modules directory. If you are curious about some stuff have a glance at Modules.php and Module.php although you really don't need to do this. The following threads are also helpful RE configurable modules: https://processwire.com/talk/topic/5480-configurable-process-module-need-walk-through/ https://processwire.com/talk/topic/3343-how-can-i-setget-module-data-from-db-when-not-implementing-configurablemodule/ https://processwire.com/talk/topic/7581-configurable-module-default-values-on-install/ Other: https://processwire.com/talk/topic/1313-modules-process-and-the-difference/ ...which reminds me, I really need to get write those modules tutorials as promised...
  7. Use the following in your blog-list.php if that is where you have your $sidebar $posts = $pages->find('template=blog-post, limit=10');//or whatever the template of a 'post' is $start = $posts->getStart()+1; $end = $start + count($posts)-1; $total = $posts->getTotal(); if($total) echo "<h3>" . sprintf(__('Posts %1$d to %2$d of %3$d'), $start, $end, $total) . "</h3>"; Note: getStart() and getTotal() have nothing to do with renderPosts(). They are both PageArray methods. So, you can use them with any $pages->find() operation. renderPosts(): The first parameter accepts either a PageArray, a Page or a selector string. So, the following should work... $sidebar = renderPosts($posts, true)//our $posts above...which fetched 10 posts However, I am not sure I fully understand your question as renderPosts() with $small=true should already return the counts headline?
  8. You could have just appended a string, e.g. 'panel' to every id then ...Nice and short rather than using names...not that the browser cares anyway . But it works, that's what's important...
  9. Are you saying that it is now working fine after uninstalling Migrator?
  10. Do you have custom code in that? i.e. for pages that are selectable?
  11. Unless you can point to some agreed/standard web terminology, content type seems mainly to be a Drupal concept (OK, so there's also SharePoint but that's another story). It's just one way of organising and 'naming' content. MODx has resources, Drupal has nodes/content types (of which a 'basic page' is but one type), here we mainly organise our content using 'pages'. There's no right or wrong way....that's just the way it is. But we do like our 'pages'
  12. Minor typo: entry->title
  13. Max, Did you get help with this?
  14. @Mel, Please don't post the same question twice in two different topics, thanks. I have merged the two topics.
  15. Seems something wrong with your settings. A photo should absolutely show (that's how it works in the Blog module - authors have profile photos).
  16. I'd forget about incrementing anything...you already have unique numbers in page->id. Use faq->id and problem sorted, unless for some other reasons you need to start from 1....
  17. Image fields work the same as in any other template . What exactly went wrong?
  18. Remember you need to login with your email address and your account password. You can subsequently create a different supersuser with a different password (if you wish) and log in 'normally'
  19. I am getting confused myself! Is it possible for you to either point to a website that shows the 'effect' you want, or do a mockup of what you want or set up a demo install with your code over at lightning.pw?
  20. Could it be this FastCGI issue? https://processwire.com/talk/topic/5388-admin-pages-displaying-with-no-css/ https://processwire.com/talk/topic/4309-no-css-rendering-in-admin/
  21. Aah, silly me - didn't read that properly. PW version?
  22. Does this help? http://stackoverflow.com/questions/2075337/uncaught-referenceerror-is-not-defined Are you loading CSS before or after JavaScript?
  23. Jan's approach above would work but it is an all or nothing solution meaning, all members (irrespective of your 'sub-roles') will only be able to edit certain fields. If, however, you want say, Junior members to be able to edit fields A,B, Senior members A,B,D and Elder members A,B,C,D,E, then this approach would not work. For that you would probably need a module like 'Page Edit Field Permission' (Enables you to limit edit access (by role) to any field in the page editor.)
  24. Max, You need a 'name' attribute on the <a> where you are linking to that matches the href of where you are linking from (even and ID attribute will work as SiNNuT explained above). You just need to implement this the right way - i.e. match href to name/id, tag, etc). Read 6 Things You Should Know About Fragment URLs... and see example here on PW's Blog From link: <a href="#add-page-screen-now-with-ajax-helper">Add page screen now with AJAX helper</a> To link: (notice the 'name' attribute; it matches the href of the 'from link') <a name="add-page-screen-now-with-ajax-helper" href="#"></a><h3>Add page screen now with AJAX helper</h3>
×
×
  • Create New...