Jump to content

doolak

Members
  • Posts

    323
  • Joined

  • Last visited

Everything posted by doolak

  1. Would be great if there would be a possibility to set a specific limit for the amount of repeater items - or is there such a possibility and i just didn't found it? Cheers, Christian
  2. Sorry, saw just now that you can set the selectors in the options array - works great!
  3. Thanks for that great module, Soma! This makes it much easier to generate all kind of navigation without having to digg through code for hours. Just one question: Does the module still support the costum selectors you mentioned below? I am trying to hide the children of a specific template, doing it for now by replacing an parameter of the options array as follows: if ($page->template == news | $page->template == news_article) $options[max_levels] = 1; That works fine, but would be nicer to use those costum selectors. Are they still supported? Couldn't make it work for the example above...
  4. @ryan: Somehow i must have missed your answer in those days, sorry! There were two seperate templates, one for the news section and one for the articles. At last everything worked fine - but right now I recognized now that hiding the childs the way i did leaves the empty <ul></ul> - tag for those childs and opened a thread about that problem: After all i found the module "MarkupSimpleNavigation" from Soma now and this makes almost everything possible without digging through code. I thank you all very much for your help!
  5. Thank you very much for your answers! I made a error in reasoning - the children are hidden by the navigation template: $children = $rootPage->children('template!=news_article'); So of course it does not work to exclude them the way i tried with count($page->children), $page->numChildren or if($child->viewable()). I used the navigation snippet which was discussed already in another thread: http://processwire.c...e__hl__treemenu I took part asking how to hide the children - so i should not have made the error in reasoning now... Now i discovered that there is the module "MarkupSimpleNavigation" from Soma (thanks, Soma!) - works great and makes a lot of variations easier than digging into the code. Thanks again to everybody!
  6. Hi there, well - the title probably describes enough what i want to ask... I am working on a navigation and i want to avoid that a sublevel <ul></ul> - tag is generated when the children of that page is not viewable - so i want to verify if they are or not. I tried: if ($page->children->viewable()) $out = "\n<ul>"; ... but this does not work - seems that this is just possible for pages with $page->viewable() Would be great if you could help me. Cheers, Christian
  7. I have to correct myself: Even with the additional languages it may be a problem - if you want to add a new language pack to an additional language, you can't delete it without loosing all the values of the language fields, if you use them. If you just add a new language pack it will be added to the previous one, not replace it. So how would it be possible e.g. to replace a language pack with a newer version?
  8. Is there a possibility to delete a language pack or replace it? With the additional languages it's no problem - you just have to delete the language with its language pack, add it again and add a new language pack. But as the default language cannot be deleted it seems that you have to delete one translation file after the other - or is there another possibility? Cheers, Christian
  9. Perfect! Works like a breeze! I thank you so much for spending your time for my problem! Cheers, Christian
  10. Hey Soma, thanks for your effort and your help! I am just not sure about one thing. What is the purpose of that part: $this->set("tpl_team","basic-page"); $this->set("users_select","users_select"); $this->set("tpl_user","user"); $this->set("teams_select","teams_select"); Do i have to change just that part in a way that it matches with my own field names and leave the rest as it is? e.g.: $this->set("team","basic-page"); $this->set("team_mitglieder","users_select"); $this->set("mitglied","user"); $this->set("mitglied_team","teams_select"); I use the templates "team" and "mitglied" and the page fields "team_mitglieder" and "mitglied_team"... Or do i have to change the rest of the code, too?
  11. Ok, i found one thing which i think is not correct: In the second part - shouldn't it be $user->save(); there? But i tried it by saving the member page, too - so there it should have worked fine...
  12. Damn - i cannot get this to work. I tried a lot of variations, verified if the variables are correct and i read and read the code again - i think from the logical structure it should do what it is supposed to do. So as i said, i just can imagine that there is a small mistake somewhere. I tried "append" instead of "add" - but no difference. I am trying and trying - but i have no idea yet what's wrong
  13. Ok, got it: $page = $event->object; In the beginning of your code you wrote: // autoload module extends WireData Do i have to change the beginning of the module somehow? Here my complete code: <?php class Members extends WireData implements Module { public static function getModuleInfo() { return array( 'title' => 'Members vs Teams', 'version' => 1, 'summary' => 'Lorem Ipsum Dolor Sit', 'singular' => true, 'autoload' => true, ); } public function init() { $this->pages->addHookAfter('save', $this, 'hookPagesave'); } public function hookPagesave(HookEvent $event){ // get current page saved $page = $event->object; if($page->template == "mitglied"){ // iterate all team pages once foreach($this->pages->find("template=team") as $team){ // iterate each selected team in the current user page to map // and add or remove foreach($page->mitglied_team as $s_team) { // if team page is a selected one and not added, add it if($s_team === $team) { if(!$team->team_mitglieder->has($s_team)) $team->team_mitglieder->add($page); } else { // if it's not in the selected team but in array, remove it if($team->team_mitglieder->has($s_team)) $team->team_mitglieder->remove($page); } // save the mapped team page $team->save(); } } } // same for team page save if($page->template == "team"){ // iterate all team pages once foreach($this->pages->find("template=mitglied") as $user){ foreach($page->team_mitglieder as $s_user) { if($s_user === $user) { if(!$user->mitglied_team->has($s_user)) $user->mitglied_team->add($page); } else { if($user->mitglied_team->has($s_user)) $user->mitglied_team->remove($page); } $team->save(); } } } } } So far it does not work - but i can imagine it's just a small mistake somewhere...
  14. And has it to be $this->page->template instead of $page->template, too?
  15. Wow - that was fast! Thank you, Soma! Looks like exactly what i need - I will try and report how it works.
  16. Yes, i agree that this is a pretty rare scenario - but if one would have that possibility i can imagine that it would open some very nice new possibilities. In the frontend everything is nice - Team members are listed in the teams and on the members profiles one can see to which team the member belongs. I just would like to offer the admins the possibility to change the members of a team on both ends by editing them in the team or just changing the team on the members site. As far as i could find it out it would be possible with a hook: when saving the edited team the field on the members page has to be changed - and the same reversely. I found this thread and i will digg into it and try to find how i can do this: If anybody has a "quick solution" of course i would appreciate this.
  17. Hi there, is there any possibility to change the value of one field by editing the value of another field on another page? I have the following scenario: There is a member list of a sports club - when editing a member you have to choose the team(s) he belongs to. There are different sport teams - it should be possible to have the team members listed on the edit page of the teams, too. And - i would like to make it possible to delete or add a member from the teamlist to a team there. When a meber is added or deleted this should be visible on the member's edit page, too... If i remember there were some possibilities in the API which allow a database change - but i could not find them. But maybe there is another solution? Would be great if you could give me an idea if/how this could be handled. Cheers, Christian
  18. Hello there, is there a possibility to change the text of the email which is sent after a new comment is posted? I would like to give mny costumer a direct link to approve the entry... Cheers, Christian
  19. Hello there! First: Happy Eastern! Second: I want to have the success message and the error message displayed via Javascript, without reloading the page - but i have no idea how i could integrate this without modifying the module. Can this be done with a hook somehow? Kind regards, Christian
  20. @Soma: Thank you very very much! Works perfectly now. Here the corrected original code from post #9, which works fine as shown below - just, as Ryan already mentioned, don't forget do activate the support of page numbers in your template settings, under the "URLs" tab... <?php // get the images you are going to display $items_per_page = 4; $start = ($input->pageNum - 1) * $items_per_page; $total = count($page->images); $images = $page->images->slice($start, $items_per_page); // make this to give MarkupPagerNav what it needs $a = new PageArray(); // add in some generic placeholder pages foreach($images as $unused) $a->add(new Page()); // tell the PageArray some details it needs for pagination // (something that PW usually does internally, for pages it loads) $a->setTotal($total); $a->setLimit($items_per_page); $a->setStart($start); // output your images foreach($images as $p) { $img = $p->img; echo "<img src='{$img->url}' alt='{$img->description}' />"; } // output the pagination navigation echo $a->renderPager(); Kind regards, Christian
  21. Hello there, i am trying such simple image "pagination" which ryan described in post #9 - pagination works but page 1 displays still all 4 images (should display just 2 of them) - but there is a second page which then displays the last two pictures. Here is the code: <?php /** * Page template * */ include("./header.inc"); echo "<h1>" . $page->headline . "</h1>"; echo "<h1><?=$page->title?></h1>"; echo "<h2><?=$page->album_description?></h2>"; echo "<ul class='images'>"; // get the images you are going to display $items_per_page = 2; $start = ($input->pageNum - 1) * $items_per_page; $total = count($page->images); $images = $page->images->slice($start, $images_per_page); // make this to give MarkupPagerNav what it needs $a = new PageArray(); // add in some generic placeholder pages foreach($images as $unused) $a->add(new Page()); // tell the PageArray some details it needs for pagination // (something that PW usually does internally, for pages it loads) $a->setTotal($total); $a->setLimit($items_per_page); $a->setStart($start); foreach($images as $p) { $thumb = $p->size(100, 100); // specify your own width/height echo "<li style='width:100px; height:100px; float:left; margin:5px;'>"; // better to use a stylesheet echo "<a href='{$p->url}' class='lightbox' rel='gallery'>"; echo "<img src='{$thumb->url}' alt='{$thumb->description}' /></a>"; echo "</li>"; } echo "</ul>"; echo "<br style='clear: both;' />"; // output the pagination navigation echo $a->renderPager(); include("./footer.inc"); Any idea why it does not work as it should? Kind regards, Christian
  22. Hi there, i have the same problem when tried to move a site from dev to live server. I have reloaded the .htaccess, upgraded to the last version but the login doesnt work. I installed PW in another subdirectory and that fresh install works fine. As i wanted to test if it has sometghing to do with the encryption i copied field_pass from the database of the new installation to the live site and the userAuthSalt from the config - but still the same problem: the login page just reloads. Any other idea? Kind regards, Christian ===== Edit: I found the problem - the permissions on the folder site/assets/ and on the site/config where not correct - i changed them and the login workes fine now.
  23. If you have different templates with different content types you sometimes have to tell the clients how they have to use the title input field in the different cases - for example: - "normal" pages (here the label "Title" works fine, of course - i used the description to inform that this title is used for the menu and the pageheading) - newsarticles (The label "Title" is fine, but it will not be used for the menu, so i had to change the description to inform that its the title of the article but will not appear in the menu.) - team members (Here i have to use the title for the name and have to tell that the client - would be great in this case to have another label, f.e. "Name" and another description. In the moment i would have to extend the standard description again to inform that in this case it is used as name) Of course, if you have the title fields prefilled the client will see what function it has on the different pages - but if it would be technically possible without too big efforts, a module which allows different labels and description for the title field would be great! What do you think about that?
  24. Thanks for fixing it Works fine.
  25. Hello there, when i try to delete a page, which template ("news_article") i gave permission to be used just for one parent template ("news"), it can't be deleted and i receive the following message: My mistake or maybe a bug? Kind regards, Christian
×
×
  • Create New...