Jump to content

electricarts

Members
  • Posts

    42
  • Joined

  • Last visited

Everything posted by electricarts

  1. Yeah, tried it before. Didn't work because of my spelling mistake (Team_Photo vs. Team_Foto). Now this works too. This was too much information for me today. Again, thanks for your help and patience. Also thanks to DaveP and Christophe!
  2. Yes! Thanks for that! Works like a charm. One last question before i try to learn the next PHP "thing": How do i deal with the path for the image? I've a image field "Team_Photo" inside of the repeater. The Maximum files setting under the Details Tab is set to 1. src="<?php echo $image->url; ?>"> Would be nice for me, but it doesn't work.
  3. Oh god, i think i'm too dumb for such things. Maybe i shouldn't do anything related to PHP in the future and should stick to the design things. The id is of course different for all instances. There are two "blocks" on the team member page. This div class="uk-grid uk-text-center team-thumbnails"> <div class="uk-width-1-5 uk-container-center"> <img class="uk-thumbnail uk-border-circle" data-uk-modal="{target:'#g-wertich'}" src="<?php echo $config->urls->templates?>layout_images/g.wertich.jpg" width="130" height="130" alt="$image->description" alt=""> <div class="uk-thumbnail-caption">Gisela Wertich</div> <a class="more-infos" href="#g-wertich" data-uk-modal>Mehr Infos ...</a> </div> <div class="uk-width-1-5 uk-container-center"> <img class="uk-thumbnail uk-border-circle" data-uk-modal="{target:'#g-suhr'}" src="<?php echo $config->urls->templates?>layout_images/g.suhr.jpg" width="130" height="130" alt="$image->description" alt=""> <div class="uk-thumbnail-caption">Gabi Suhr</div> <a class="more-infos" href="#g-suhr" data-uk-modal>Mehr Infos ...</a> </div> </div> is for displaying member photos in a row (just 2 for this example) with the name underneath and a "Mehr Infos" link. When clicking the link, the appropriate modal comes up. The code for this is <?php foreach($page->Teammitglieder as $member): ?> <div id="g-wertich" class="uk-modal"> <div class="uk-modal-dialog"> <a class="uk-modal-close uk-close"></a> <div class="uk-modal-header"> <h2><?=$member->Team_Name?></h2> <img class="uk-thumbnail uk-border-circle team-detail" src="<?php echo $config->urls->templates?>layout_images/g.wertich.jpg" width="100" height="100" alt="$image->description" alt=""> </div> </div> </div> <?php endforeach; ?> <?php foreach($page->Teammitglieder as $member): ?> <div id="g-suhr" class="uk-modal"> <div class="uk-modal-dialog"> <a class="uk-modal-close uk-close"></a> <div class="uk-modal-header"> <h2><?=$member->Team_Name?></h2> <img class="uk-thumbnail uk-border-circle team-detail" src="<?php echo $config->urls->templates?>layout_images/g.wertich.jpg" width="100" height="100" alt="$image->description" alt=""> </div> </div> </div> <?php endforeach; ?> Here i copied this first (working) foreach block and changed the id. But as i said, this doesn't work and i'm too dumb to understand what i have to do to use this logic to make it work for all team members.
  4. Ahh, i see. But my main problem of understanding is still there. This code below now works for one member. <?php foreach($page->Teammitglieder as $member): ?> <div id="g-suhr" class="uk-modal"> <div class="uk-modal-dialog"> <a class="uk-modal-close uk-close"></a> <div class="uk-modal-header"> <h2><?=$member->Team_Name?></h2> <img class="uk-thumbnail uk-border-circle team-detail" src="<?php echo $config->urls->templates?>layout_images/g.wertich.jpg" width="100" height="100" alt="$image->description" alt=""> </div> </div> </div> <?php endforeach; ?> What do i have to do for the rest of the members? I can't copy this block for the next member, because the name would be (of course) the same.
  5. Ok, i thought that something went wrong because when i use that simple example <?php foreach($page->Teammitglieder as $member): ?> <div id="g-godany" class="uk-modal"> <div class="uk-modal-dialog"> <a class="uk-modal-close uk-close"></a> <div class="uk-modal-header"> <h2><?=$member->name?></h2> <img class="uk-thumbnail uk-border-circle team-detail" src="<?php echo $config->urls->templates?>layout_images/g.godany.jpg" width="100" height="100" alt="$image->description" alt=""> </div> </div> </div> <?php endforeach; ?> in the frontend i see just "1461499306-79-1" instead of the name in the <h2>. Is this foreach loop correct?
  6. Thanks for all your help, guys! Ok, i understand the different syntax now. But what i don't understand is the encapsulated structure when working with foreach in PHP. In PW i have a field "Teammitglieder" which is the repeater field. It contains the other fields like "Team_Name" or "Team_Hobbies". The first foreach loop ($page->Teammitglieder as $member): ?> goes thru the repeater field. For my understanding something like a container (comparable to a div in CSS), right? But now my problem begins. How do i select the name and "echo" the content of the field "Name"? $member->Team_Name works but is only usable with just one team member. How can i select the right field (the appropriate name of that member)? How can i "extract" all the member infos and insert the right ones at the right place in the HTML? I mean i have 6 div's (with all the HTML for the modal inside). One div for every member. How will the right name of the 3rd member (3rd repeater field in PW backend) be inserted an the right place (3rd div in the team template). Maybe it would be easier and more logical to give every team member a site and get the entries in the team template from there?
  7. Today i learn more about PHP than in the complete last month. Thanks for your patience! In the meantime i had a working modal for one team member. But then i realized that i need separate entries for many team members. Every team member has a name and a phone number. So i tried your code, but it doesn't work. First, could it be that instead of <?=$member0>name?> it should be <?=$member->name?> ? Then there is a error: Parse Error: syntax error, unexpected '<' (line 108 of /Users/mario/Sites/marios-imac.local:5757/site/templates/team.php) which is the </ul> . I think i've to learn more PHP because i don't understand the first line of your code. The colon is a replacement for the opening brace. But why it's followed by ?> which means end of the block?
  8. Thanks for your reply, DaveP! That works for a simple HTML structure. And thanks for the suggestion. But do i have to use array_slice to distribute the fields for a encapsulated HTML structure? I have a structure like this: <div id="g-wertich" class="uk-modal"> <div class="uk-modal-dialog"> <a class="uk-modal-close uk-close"></a> <div class="uk-modal-header"> <h2>Name-Field</h2> <img class="uk-thumbnail uk-border-circle team-detail" src="<?php echo $config->urls->templates?>layout_images/g.suhr.jpg" width="100" height="100" alt="$image->description" alt=""> </div> <h3>Aufgabenbereiche</h3> <ul class="modal-list"> Responsible-Field </ul> <h3>Kontakt</h3> <p class="bezeichnung"><span><i class="uk-icon-phone uk-icon-justify"></i></span>Phone-Field</p> <p class="bezeichnung"><span><i class="uk-icon-mobile uk-icon-justify"></i></span>Mobile-Field</p> <p class="bezeichnung"><span><i class="uk-icon-envelope uk-icon-justify"></i></span><a href="mailto:Mailaddress-Field"> E-Mail senden</a></p> <h3>Hobbies</h3> <ul class="modal-list"> Hobbys-Field </ul> <h3>Motto</h3> <blockquote> <p><i class="uk-icon-quote-left uk-icon-large uk-icon-left"></i>Blockquote-Field</p> </blockquote> </div> </div> I need to insert the foreach items as "Name-Field", "Responsible-Field" and so on. So my understanding is, that i have to "split" the array, right? Mario
  9. Hi, another stupid question from a PW newbie. I'm working on a page which displays team members with some information (name, phone number, ...). For the person who edits these infos later i wanna make it as simple as possible to change the entries. I was trying to use the repeater field for some sort of grouping the infos for the several team members in the backend. This works like expected. But how to display the entries in the frontend? There i need the separate fields (name, number ...) to be able to do a formatting. Is there another way of grouping the fields in the backend, but access the individual fields for displaying in the frontend? Mario
  10. Because i really wanna use the Menu Builder, a friend of mine helped me to build a working solution. ​ We're using the above mentioned solution from @Webrocker as a basis. Maybe it's helpful for others who wanna use the Menu Builder and the UIKit Navbar and so i post the code here: <nav class="uk-navbar"> <?php $mainmenu_items_json = $pages->get('name=main-menu')->menu_items; // this is the menu page in menu builder, could also be fetched with the ID $mainmenu_items = json_decode($mainmenu_items_json, true); if( count($mainmenu_items) > 0 ){ $out = '<ul class="uk-navbar-nav">'; foreach($mainmenu_items as $id => $item){ $isCurrentPage = ($item['pages_id'] == $page->id || ($page->parent_id != 1 && $item['pages_id'] == $page->parent_id)); $subs = false; if(!isset($item['parent_id'])) { $url = ($item['url']) ? $item['url'] : $pages->get($item['pages_id'])->url; $target = (1 == $item['newtab']) ? 'target="_blank"':''; foreach($mainmenu_items as $sub_id => $sub_item){ if(isset($sub_item['parent_id']) && $sub_item['parent_id'] == $id) { $subs = true; break; } } $class = 'class="'.($subs ? 'uk-parent ' : '').($isCurrentPage ? 'current uk-active' : '').'"'; $out .= '<li '.$class.($subs ? ' data-uk-dropdown="" aria-haspopup="true" aria-expanded="'.($isCurrentPage ? 'true' : 'false').'"' : '').'><a href="' . $url . '" class="" ' . $target . '>' . $item['title'] . '</a>'; if($subs) { $out .= '<div class="uk-dropdown uk-dropdown-navbar uk-dropdown-bottom"><ul class="uk-nav uk-nav-navbar">'; } foreach($mainmenu_items as $sub_id => $sub_item){ if(isset($sub_item['parent_id']) && $sub_item['parent_id'] == $id) { $url = ($sub_item['url']) ? $sub_item['url'] : $pages->get($sub_item['pages_id'])->url; $target = (1 == $sub_item['newtab']) ? 'target="_blank"':''; $out .= '<li><a href="'.$url.'" class="'.$target.'">'.$sub_item['title'].'</a></li>'; } } if($subs) { $out .= '</ul></div>'; } $out .= '</li>'; } } $out .= '</ul>'; echo $out; } ?> </nav> It's like @Webrocker says: The best of both worlds! And as a side note: My friend didn't know anything about PW before. After 15 min. he had that solution ready. I think that says everything about the flexibility and the possibilities of PW. Thanks for that CMS and the really great community here! Mario
  11. Thanks jannisl and kongondo for your reply! Unfortunately i'm far from knowing PHP very good. This problem here is the last step to motivate me enough to really learn PHP. I used the github link from jannisl and tried to modify this (hopefully) working bootstrap navbar for UIKit. It looked like the easiest possibility for me to understand. I changed the classes and added the missing div. But it doesn't work. No entries in the navbar and the inspector shows only the root page. The modified code looks like this: <nav class="uk-navbar"> <ul class="uk-navbar-nav"> <?php // navigation bar consists of homepage and its visible children if($homepage->id == $page->rootParent->id || $homepage->url == $page->menuActiveOverrideUrl) { echo "<li class='uk-active'>"; } else { echo "<li>"; } echo "<a href='//$config->httpHost$homepage->url'>$homepage->title</a></li>"; foreach($homepage->children as $item) { if($item->numChildren(true)) { echo "<li class='uk-parent' data-uk-dropdown>"; echo "<div class='uk-dropdown uk-dropdown-navbar'>"; echo "<ul class='uk-nav uk-nav-navbar'>"; foreach($item->children as $sub_item) { echo "<li><a href='//$config->httpHost$sub_item->url'>$sub_item->title</a></li>"; } echo "</ul>"; echo "</div>"; echo "</li>"; } else { if($item->id == $page->rootParent->id || $item->url == $page->menuActiveOverrideUrl) { echo "<li class='active'>"; } else { echo "<li>"; } echo "<a href='//$config->httpHost$item->url'>$item->title</a></li>"; } } ?> </ul> </nav> Could someone point me to the mistakes i made? Mario
  12. Hi, i'm starting my first real project with PW (coming from Contao and a little bit of WordPress). I wanna use UIKit as CSS framework and right now i'm trying to setup the navigation. I wanna use the Menu Builder and everything is fine, except one "problem": For a dropdown in the navigation bar the submenu ul has to wrapped in an extra div. Something like this: <nav class="uk-navbar"> <ul class="uk-navbar-nav"> <li class="uk-active"><a href="">Active</a></li> <li><a href="">Item</a></li> <li class="uk-parent" data-uk-dropdown="" aria-haspopup="true" aria-expanded="false"> <a href="">Parent</a> <div class="uk-dropdown uk-dropdown-navbar uk-dropdown-bottom"> <ul class="uk-nav uk-nav-navbar"> <li><a href="#">Item</a></li> <li><a href="#">Another item</a></li> <li class="uk-nav-header">Header</li> <li><a href="#">Item</a></li> <li><a href="#">Another item</a></li> <li class="uk-nav-divider"></li> <li><a href="#">Separated item</a></li> </ul> </div> </li> </ul> </nav> Is this possible with the module or do i have to write another solution? And how could i add the attributes (data-uk-dropdown)? Mario
  13. Hello, i'm brand new to PW (coming from Contao CMS). For a new project i really wanna use PW instead of something else. But because i'm not that php-hero, i wanna ask if someone has done this before and could give me some tips how to do it in PW. We need a "Geolocation Search". I think i've to explain this because i don't know the right english term for this: In the frontend, the user type his hometown's zip-code (5 digits here in Germany) in a field, choose from pre-defined distances (lets say 10 km, 20 km and 50 km) around his location, hit search and see which locations from an address database are inside that radius ( in a simple list or which would be very nice at a Google Map). I've already discovered Ryan's Map Marker Module which translates the address to useable Lat/Long coordinates. What i don't understand right now is how to filter the address entries for the specific distances and to display them in the frontend. Has somebody done something like this already in PW or is there a module which i didn't found till now? Mario P.S. Sorry for my terrible english.
×
×
  • Create New...