Jump to content

diogo

Moderators
  • Posts

    4,314
  • Joined

  • Last visited

  • Days Won

    80

Everything posted by diogo

  1. Try $child->logo instead of $pages->logo
  2. Sorry, I wasn't really thinking when I did that... I guess my head is still on vacation mode (does this answer to your question kongondo? ) Should be working now.
  3. Makes all the sense to me. Added it to Github with a reference to both for the contribution. Thanks!
  4. And to revert (removes the id from the end of the string): foreach ($templates as $t) { $t->pageLabelField = preg_replace('/ id$/', '', $t->pageLabelField); $t->save(); }
  5. You can also add the ID to the "list of fields to display in the admin page list" field on the advanced tab on each template. To do it quickly for all templates, put this code on any page and load it: // get all templates foreach ($templates as $t) { // if fields are the default (empty shows only the title) if ($t->pageLabelField == "") { // make new string with title and id $t->pageLabelField = "title id"; } else { // if not, add " id" to the existing string $t->pageLabelField .= " id"; } // save the template $t->save(); }
  6. of course... thanks Soma
  7. Actually it makes sense that it doesn't work because it's a private property. Sorry for that... There's a "default link to css stylesheet" in the module's configuration options, did you try that? The weather is very unpleasant here for the moment, you should dream of other places
  8. I never tried this, but by looking at the module it appears that this would work: // if using Ryan's example: $rss = $modules->get("MarkupRSS"); $rss->title = "Latest updates"; $rss->description = "The most recent pages updated on my site"; $rss->css = "{$config->urls->templates}styles/rss.css"; // <- here goes the css url $items = $pages->find("limit=10, sort=-modified"); $rss->render($items); edit: oh, and welcome edit2: changed $config->path->templates to $config->urls->templates. Thxs for finding this Soma
  9. I think it isn't... and I'm not sure if uninstalling the module should delete the field. Or maybe it can ask if, and then delete. I guess Soma is right, and we are hijacking the thread with this...
  10. I was thinking of this when Pete created the install routines for my module http://processwire.com/talk/topic/3474-admin-custom-pages-module/?p=37140 Since we have field tags now, the modules that create fields could give them a tag with the name of the module and another tag that would be for all modules. The important here would be that all the modules use the same tag for the second case (let's say "modules"), and follow same logic for the first case (maybe the name of the module class...) I suspect that this would be the right way to create two field tags, one "modules" and one "module-admin-custom-pages". $field = new Field(); $field->type = $this->modules->get("FieldtypeTextarea"); $field->name = 'ACP_scripts_and_styles'; ... // create the field tags (the "-" before "modules" makes it collapsed in the admin) $field->tags = "-modules module-admin-custom-pages"; $field->save(); edit: my suspicion was right. It works. I will add this to the module as soon as we decide on a common tag for all modules. What do you guys think?
  11. Or we can work on a print.css for the cheatsheet. shouldn't be too difficult, and would always be on date.
  12. Little explanation of Wanze's code. Hope it helps: // total starts with zero $total = 0; // loop through all grants and store each of them in the $grant variable for their part of the loop foreach ($page->grants as $grant) { // echo this particular grant cheque_date echo "Date granted: {$grant->cheque_date}"; // echo this particular grant amount approved echo "Amount ${$grant->amount_approved}"; // add this particular grant amount approved to the total that we have in this moment (in the end of the loop the total will be the sum of all amounts) $total += $grant->amount_approved; } What you don't have in your code is "+=" that adds the amount of this grant to the total. In your code the total is always the same as the previous amount and in the end it will be equal to the last amount. -- $page->grants->sort('-cheque_date')->first()->cheque_date; For what I understand this returns the value the most recent cheque date. you can echo it directly like this: echo $page->grants->sort('-cheque_date')->first()->cheque_date; or store it in a variable $last_cheque_date = $page->grants->sort('-cheque_date')->first()->cheque_date; ...and use it later echo "the most recent cheque date is {$last_cheque_date}."; or // just a random example... if ($last_cheque_date < 165436524) { // do something }
  13. Or: echo "<h2>Amount \${$grant->amount_approved}</h2>";
  14. My code is assuming some things and has to be adapted to your situation. How did you use it exactly?
  15. I've just merged a pull request by Pete that automatically replaces the admin.php file and creates the scripts&styles field during installation. That's two steps less The version on github is now 1.0.4. Thanks Pete!!
  16. ... and if it still doesn't work, call as children of their parent (i'm assuming they have the same parent) $trabajos = $pages->get('trabajos-parent')->children("template=trabajo, sort=sort");
  17. Yep, never underestimate this sponge's absorbing power
  18. I was looking at brakets with much interest as an open-source software, but this makes me think that it will be just another adobe family product... Don't get me wrong, i understand that business is business, but it does turn my curiosity down a bit because I can imagine that 90% of their effort will have to do with making it work with other adobe products instead of focusing in the real text editor developing challenges. I may be wrong though...
  19. @pwired, there isn't any software that keeps compatibility with old versions of modules forever. That's why I think it's great that you don't have to use lots of third party modules with ProcessWire, and everyone should be aware of the risk of making a website completely dependent of them. Anyway, no one is forced to upgrade immediately to a latest version (or even at all), and Ryan shows he is always very concerned about breaking things for people, so I'm pretty sure that when it comes the time when that step really has to be taken, all modules (or a good alternative to them) will be already compatible. One thing I think it's important to keep in mind here is that software has to evolve. And this evolution will always be a balance between backwards compatibility and new and better features. You really don't want to use a software that stopped in time...
  20. Wow, I just had a flashback...I was using intype on windows. this was some years ago already, and I think it was still in alpha, but i liked it so much that i used it as my default editor. I can't say I was a coder back then, but for my basic learning it was great, and It looks even nicer now. Unfortunately I can't try it on linux. It's all explained here if you feel like some really geeky stuff
  21. kongondo, I edited the post. You might like to see my silly example
  22. nice tip: if you remove "&showoptions=1" from the url, you will have only the list without the search options. So, a very simple example of a link would be: echo "<a href='{$config->urls->admin}page/search/?submit=Search&template=article&category=general_news&sort=created&display=title,path,category,author'>all general news articles</a>"; edit: here is a quite silly example of how this could be used dynamically in a custom page (code and screenshot): echo '<dl>'; foreach($pages->get(1)->children("include=all") as $p){ echo '<dt>'; echo $p->title; echo '</dt>'; echo '<dd>'; echo "<a href='{$config->urls->admin}page/search/?submit=Search&template={$p->template}&sort=created&display=title,path'>search all pages with same template as {$p->title}</a>"; echo '</dd>'; } echo '</dl>';
  23. Like Wanze I really like the way that articles paginate in the admin, but you can always create a page in the Admin that lists all the articles any way you prefer. A very simple way o do this is to link to a pre-defined search in the admin. So, imagining that you want to list all the articles, just go to advanced search, and with the search field empty, limit the search to the articles template; or if you want all articles from one category, "limit to the template": "article", "search in fields": "category" and "search for": "category name or ID". You can for instance create a new admin page using my Admin custom pages module with some pre-built links. If you want a really clever system with this, study the urls that result from these searches, and create them dynamically by request. domain.com/processwire/page/search/?field=category&operator=0&q=general_news&show_options=1&submit=Search&template=article&sort=created&display=title,path
×
×
  • Create New...