Jump to content

Soma

Moderators
  • Posts

    6,808
  • Joined

  • Last visited

  • Days Won

    159

Everything posted by Soma

  1. Hey Peter glad you like it. 1. I think there's tons of examples out there. I agree it can be tricky if you're not into it so much. I often use a drop-down script (with some basic CSS) I modified some time ago, it's also used in my Teflon theme. https://github.com/somatonic/droppy it doesn't require anything except jQuery and some CSS. There's also CSS only ways to do it. 2. I'm a little careful not to add even more options. This I agree can be handy, since it's also possible use external urls. I think there's different ways to achieve it already what you want without adding more. xtemplates, xitem_tpl, options for example, but it would only be possible to add it to all links that have the template you define there. But there's another way that is possible since a couple versions. Adding a hook to the link item being constructed and modify it. Here simple example for use in templates: function getTagsString(HookEvent $event){ $tpl = $event->arguments[0]; // the template string $page = $event->arguments[1]; // the page getting rendered if($page->open_blank){ // $event->return is the complete link you get from the hook, modify to you needs $event->return = str_replace('href=','target="_blank" href=', $event->return); } } $treeMenu->addHookAfter('getTagsString', null, "getTagsString"); echo $treeMenu->render();
  2. Hmm, wire("modules")->get("ImagesManger")->options[key] should be enough The module sets the options array in the init. But you can also get it when you hook setMetaData() with $event->object->options['imagesEXIFField'];
  3. You can already get the settings via the module options.
  4. The hook does already allow you to do any additional custom field saving... Just add field you wish and populate it in the hook. Thx I'll have a look. Forgot FF isnt consistent across OS. I think I know what it is.
  5. Hey Mr MetaData! Yeah sure why not. Since it does add value and it's only optional I think this is good idea to add. I just went ahead and added support for MetaData in my last commit. You could now add a field "image_exif" and get the EXIF data stored when uploading images. I made the method setMetaData(), which adds the meta data on page/image creation, hookable so you can do a hook on it to store additional data. Not sure if this a good idea but maybe nice to have. v 0.0.3 fixed issue with images getting added twice to the assets folder (hope this is now ok) removed the performance intense pages search for image tags (In my testinstall with 120k pages this result in many second waiting to load the data table. and just output a link on all images to a PW search that will run a search. added EXIF data support. Let me know if that EXIF data reading is ok, or if it need a more sophisticated method. You can hook the Meta Data method like this from a autoload module: $this->addHookAfter("ImagesManager::setMetaData", $this, "hookMetaData"); public function hookMetaData(HookEvent $event){ $page = $event->arguments[0]; // page that the image will be added $file = $event->arguments[1]; // path of file in temp upload folder // do whatever you like $page->yourfield = "I'm the Meta Man!"; // will be saved to page }
  6. I think what's wrong is that you get the field object and not a value. $pt_field = $item->$field; and $item->$field = $pt_field; If you would output the $item->$field; you'll still see the old value I guess. If you would stringify by either add "$item->$field" or (string) $item->$field it would work. Also you're cycling each field on page I think isn't good idea. You should restrict to those fields that you want to change. I would do this instead, with an array you can define what fields, and also use the $field->getLanguageValue(langID) to get values. // define fields you want to change $fieldsArr = array('title','body'); $langAlt = $languages->get("de"); $langDefault = $languages->get("default"); $pa = $pages->find('/about/'); foreach($pa as $p){ $p->of(false); foreach($fieldsArr as $field){ $title = $p->$field->getLanguageValue($langAlt); // get the alternative lang value $p->$field->setLanguageValue($langDefault, $title); // set the new value } $p->save(); }
  7. Maybe you have to save the page and not the field. Also change $page to something else.
  8. The connection is failing before PW gets to know which page. I experience this on some "bad" hostings from time to time. That may seems it doesn't allow for enough connections because either too many people request or some connection didn't get closed to mysql for some reason.
  9. Soma

    ProcessWire on the web

    Damn, and I don't have a netbook!
  10. Dont you need to put the script outside after the div?
  11. Also have a look at my New ImagesManager module.. Too lazy to link on mobile..
  12. Hehe people actually read what I'm writing?! I wished nobody would ever ask more details about hat. ;-) No Sorry but I need some time... This is a rather hug.. huge subject I am not currently in a mood to respond...
  13. I regularely express myself.
  14. I think you both have valid points from your perspective. I think it comes down to that we're having the current ImageSizer getting some enhancement and trying to keep improving it and not having a dependency on an other lib which would need to be maintained also. The matter image and all its facets is such a huge subject in web development it's hard to sometimes argue about it. It's great to have some movement here happen and we all appreciate the work you do horst. It's also nice to suggest a different approach but it somehow sparked unwanted reactions because theres some good free time spent here. It's like telling someone after building his dreamhouse why not buy a house thats already built.
  15. On the page you selected if you browse the tree... It does say 'unselect'. Its there since maybe 2.1
  16. Well you test for if any results are found at all.What I do is check for if theres a result and show "no results found" or "out of range" and a link to first, or a redirect. Not sure its a good idea to show the a 404, like you also dont show one on a search result page if theres nothing found.
  17. There should be no page in pagination that has no results... Or do I miss something?
  18. Just wanted to correct a missunderstanding that I've read in the beginning... Haven't ready through all so sorry if you guys already solved it. If you have a page field multiple or single it will be a PageArray or a Page reference, so you can iterate them with foreach. No need to get the pages through id's or anything like that, they're pages objects already. foreach($page->drama_theatres as $drama){ echo $drama->title; } or if a single page reference field echo $page->drama_theatre->title;
  19. Yeah that normal and expected behaviour. And who would enter page number manually anyway? Edit: ah, to manually call a 404 you do throw new Wire404Exception();
  20. $value = $pages->find( "title%=$q" ); $pa->import( $pages->find( "template=abc, …|…|…=$value" ) ); $pa->import( $pages->find( "template=abc, title%=$q" ) ); What should that do? You have to explaing a little more for a short minded like me. I have an example that shows how to construct your own pager using the PW PagerNav class: // include paginator class require_once($config->paths->MarkupPagerNav . "PagerNav.php"); $pa = new PageArray(); $res1 = $pages->find("template=xyz, title%=space"); $res2 = $pages->find("template=abc, title%=hal"); $pa->import($res1); $pa->import($res2); // config paginator $baseUrl = $page->url; $limit = 4; $start = ($input->pageNum - 1) * $limit; $total = $pa->getTotal(); $pagerNav = new PagerNav($total, $limit, $input->pageNum); $pager = $pagerNav->getPager(); // construct paginator markup foreach($pager as $link) { if($link->pageNum == $input->pageNum) $class .= "on"; if($link->type == "separator") $item = '…'; else $item = "<a class='$class' href='{$baseUrl}page{$link->pageNum}/'>$link->label</a>"; $pagerMarkup .= "<li>$item</li>"; } // output paginator markup echo "<ul class='pager'>" . $pagerMarkup . "</ul>"; echo "total: $total<br/>"; echo "start: $start<br/>"; echo "limit: $limit<br/>"; echo "<ul>"; foreach($pa->find("start=$start, limit=$limit") as $p){ echo "<li>$p->title</li>"; } echo "</ul>"; Also in my ever growing gist examples https://gist.github.com/somatonic/5420536
  21. Pagination module doesn't work with in memory page arrays. Once you manipulate or merge arrays you operating in memory. Pager does need a single find db query to work. You'd need to create your own pager functions for in memory page arrays using the start and limit selectors.
  22. Scary that you can't reproduce this... Well, I just tested with latest version and now it seems to work as it should! The result of the previous test first example is now like this: Title: Space | Parent: Images Title: hubble-wallpaper-space | Parent: Space Title: hubble-wallpaper-space-647500_1600_1200 | Parent: Space Title: outer-space-stars | Parent: Space Title: space-space-584336 | Parent: Space Title: 1920x1080-wallpapers-of-nature-1249994468-1 space | Parent: Nature Title: nature_444_photos space | Parent: Nature Title: serena space | Parent: Nature Title: | Parent: Space Title: | Parent: Space Title: | Parent: Space Title: | Parent: Space ... So the pages with a "Nature" parent are showing now. So definately you fixed something that was causing this.
  23. Pete is from 2000BC you should know.
  24. You can use the InputfieldMarkup to add custom markup. $field = $modules->get("InputfieldMarkup"); $field->markupText = "<p>your html string here</p>";
  25. There is some "infos" on that sheet, you click "infos" see? There's "useful links". Also the forums contains lots of examples and bits of informations. Otherwise the source might be your best bet, and the HelloWorld.module. If you find any helpful posts you can send me links and I'll add it to the sheet.
×
×
  • Create New...