Jump to content

Soma

Moderators
  • Posts

    6,808
  • Joined

  • Last visited

  • Days Won

    159

Everything posted by Soma

  1. If you would show us some code, we would be able to help much easier.
  2. it does only show up in top navigation when on the forum pages.
  3. charliez, do you mean the board? Here? http://processwire.com/talk/forum/15-processwire-language-packs/
  4. It's hard to tell from here. There's a request being made but no data returned in the response? I think you need to make sure the fiel(cols) you make sortable can really be sorted using PW fields. Also it can be really hard to find problems, since only 1 little thing wrong and the whole breaks. What I did often was to output some debug info in getdata function (print_r or echo vars). If you inspect the returned data by the ajax request, you'll be able to see it or spot errors. One thing there's still left in the code (commented) is echo $selector; exit(); This will let you see the PW selector generated, make sure it is correct.
  5. I don't know if you know that variables/namings in php can't contain a dash "-". So also this is true to a field name in PW. So things like: $page->my-repeater-area doesn't work. I'm sure you know it, but typed it wrong in your post.
  6. Hmm, make sure everything is loaded. And check if there's any js error's or any ajax request's being made. Or try to put alert("hello"); at certain points in the /DataTable/DataTable.js to see if it gets there. If you can't figure it out send me your files and I'll work it out.
  7. I assume that my module is working out of the box? Just to make sure.
  8. Are you trying to use it on frontend or is it still in the admin?
  9. The DataTable.js contains the initialize script. There's an option "sAjaxSource": "getdata", which defines the ajax url. This is called automaticly by DataTable plugin when page is loaded. But I can't see why it wouldn't work, even if you renamed the module it should still work. It just calls "/page-you-are-on/getdata". I wonder if you're using this on frontend or in admin? Edit: Or have you renamed the table class? It is initialized in DataTable.js using var datatable = $('.dataTable').dataTable({ ...}); So if you renamed the class on the empty table output you need to rename it here too.
  10. You can try something like this: $parents = $page->parents->slice(2); foreach($parents as $parent) { echo "<li><a href='{$parent->url}'>{$parent->title}</a>"; // only output ">" if not the last entry echo $parent->id != $parents->last()->id ? " > " : ""; echo "</li>"; }
  11. Looking at your code, yes. Because ->get() will always get only 1 page and 6 random images from that page. Ryan's example won't do that because it uses ->find() and returns 6 random pages everytime. As I said it's not exactly the same, of course it depends a lot how many pages and images you have. But going with a case of 20+ pages with ~20 images each will work as good. Considering having 10000+ pages with each ~20 images, Ryans example would work still as good, but grabing all pages and images will most likely end in a out of memory.
  12. I think you're looking for something that isn't really there the way you maybe think. To my mind comes, that you could simply create a custom admin page and just output a markup table that list's all unpublished pages. There must be some thread about it with more examples how to create custom cp admin pages. Example: Create a new page under the Admin tree. Select the "admin" template and give it a title. After saving and publishing it will appear in the top navigation. If you go to the newly created admin page it will output "This page has no Process assigned." You then need to create a new Process Module. That Process Module would basicly look like this: (this is a quickly stripped example from a module I did a while ago) <?php /* * ProcessWire Module * Simple Example admin page Process module to output unpublished pages * * Put this module into you /site/modules folder * Create new admin page using "admin" template and assign this Process module * */ class ProcessUnpublishedList extends Process { protected $sel_unpublished = 'sort=-modified, status=unpublished'; public static function getModuleInfo() { return array( 'title' => 'Process Unpublished List', 'summary' => 'Show unpublished pages in the admin', 'version' => 100, 'permission' => 'page-edit' // or any other permission to manage access to this admin page ); } public function ___execute() { $out = ''; $fieldset = $this->modules->get("InputfieldFieldset"); $field = $this->modules->get("InputfieldMarkup"); $field->label = "Unpublished Pages"; $field->collapsed = Inputfield::collapsedNo; $table = $this->modules->get('MarkupAdminDataTable'); $table->setSortable(false); $table->setEncodeEntities(false); $header = array('Title','Status','modified','by user'); $table->headerRow($header); $rows = array(); $pageArr = $this->pages->find($this->sel_unpublished); foreach($pageArr as $p){ $status = ''; $status = $p->is(Page::statusUnpublished) ? "unpublished" : ''; $editUrl = "{$this->config->urls->admin}page/edit/?id={$p->id}"; $rows[] = $p->editable() ? "<a href='{$editUrl}' style='opacity:0.7'><s>".$p->get('title|name|id').'</s></a>' : $p->get('title|name|id'); $rows[] = $status; $rows[] = date('Y.m.d H:i:s',$p->modified); $rows[] = $p->modifiedUser->name; $table->row($rows); $rows = null; } $field->value = $table->render(); $fieldset->add($field); $out .= $fieldset->render(); return $out; } /** * example * accessing /processwire/adminpage_with_this_module/list2/ * will map to this function */ public function ___executeList2(){ $out = "List2"; return $out; } } Edit: This example shows that you can use certain processwire modules to create fieldsets or a MarkupAdminDataTable to generate markup. This is how PW itself does build all the admin pages pretty much. But you can also just create your own simple html markup and output that.
  13. I would guess that you're assets css and images arent loading because you installed PW in a subdirectory. When you include PW into codeigniter controller the page render output the markup but the paths are screwed. You need to either install PW in the root same as application and system (in case of codeigniter) but that may create problems, or leave it in a subdirectory and somehow fix the paths with htaccess vodoo. I don't really know the answer and what would be best in this case.
  14. You can use a WireArray and fill it with image objects from pages. Then get a random count from that WireArray. It's also in the cheatsheet. // new WireArray object for storing images $images = new WireArray(); // we find all pages using a specific template that have at least 1 or more images. // assumes the image field is named "myimages". If we deal with really lots of pages/images, consider using a limit to avoid performance problems $pa = $pages->find("myimages.count>0, template=basic-page, sort=random, limit=10"); // loop all found pages and import the images to the $images object foreach($pa as $p){ $images->import($p->myimages); } // output 4 random images from the wire array foreach($images->getRandom(4) as $img){ echo "<img src='{$img->url}'/><br/>"; } Reading again, and looking at Ryans code, it does pretty much the same, just little different way. Think about it again... Is there really any difference ? From: get ALL images from ALL pages and choose 6 random from them. To: get randomly 6 pages from ALL pages and choose 1 randomly from each page. I don't see really a difference, only that the second is far better and the way to go, because you limit the find for pages in the first place. Getting all images from all pages could create problems and not so scalable.
  15. http://processwire.com/api/modules/markup-pager-nav/ you may want to read this again. It says any limit greater than n=1.
  16. How about markup cache? Edit: Apart from that. Your initial thought about going from the referenced_pages side would make sense. Cycle all pages and check if any children found then add it and break. I just thought if you're going to use it as a list on page, why not use simple API, cache the markup and only rebuild it every hour. Of course you can't beat raw sql but I think at some point (page count) you anyway want use a cache.
  17. Direction: $events = $page->siblings->remove($page)->find("limit=3");
  18. I agree that it is somehow annoying. Not a major problem but when entering "s" it gets transfered to the page name, but the autocomplete doesn't. Wouldn't it be easy to add a on change event instead of keyup? I think that would work.
  19. I thought it is already like this. Not whole page (fields) are in memory unless you need request it.
  20. you can also use if($page->images->first()) ...
  21. Works with many to many too. $prs = $pages->find("title=Zoo|Theme park|Museum"); // maybe also use the name or id $poi = $pages->find("template=poi, poi_type=$prs"); EDIT: corrected code. yours doesn't work because "get" will return only 1 page and not page array.
  22. $pr = $pages->get("title=Zoo"); $poi = $pages->find("template=poi, poi_type=$pr");
  23. Do try a table repair... (could be) Adit: - or try opening a childpage and change something and save it. - or sort the last page to first place Also try trace 1 page (id) in the db table where the sort field is. Before and after you sort change one page in the admin, what happens in the db table? Does it change anything?
  24. It seems when there's a "'" in the string any "," gets stripped out. I also tested this just to confirm.
  25. Hi jamienk and welcome! I can't reproduce your issue with $page->image->url/path. They still work as expected in latest PW. I don't see what could be wrong with your code, just confirming that it works. Edit: Either your page or most likely field "images" doesn't seem to exists/work in your created page.
×
×
  • Create New...