Jump to content

derelektrischemoench

Members
  • Content Count

    22
  • Joined

  • Last visited

Community Reputation

3 Neutral

About derelektrischemoench

  • Rank
    Jr. Member

Recent Profile Visitors

861 profile views
  1. HI guys, I'm using twig for my frontend and I'm trying to pass $options to the menu for rendering. For some reason I can't achieve what I want, as I seem unable to pass associative arrays to the render() call in twig. I'm using markupMenuBuilder to render the menu. I generate it as follows: $menuBuilder = $modules->get('MarkupMenuBuilder'); $options = array( 'has_children_class' => 'has_children', 'current_class' => 'active', 'menu_css_id' => 'main', 'menu_css_class' => 'nav', ); $view->set('options', $options); $view->set('menuBuilder', $menuBuilder); to make menuBuilder accept the options I would have to pass them to the render function in php like this: echo $menu->render('sidenav', $options) I can't get this to work in twig since I don't get how to pass the options to the render function when using twig. Can anyone point me in the right direction plz? Best whishes deM
  2. Hi guys, I'm trying to resize images which I query through getRandom(). I can't seem to get it right though. What I have so far is: $randomImage = $pages->get($targetPageId)->images->getRandom() Which returns an image, albeit in original resolution. I assumed I should be able to call resize() on the image like so: $randomImage = $pages->get($targetPageId)->images->getRandom()->width(400) Which unfortunately gives me an exception. I assume this is because getRandom() might not return an image but something else(?). So how would I do this correctly? Greetings derelektrischemoench
  3. Hi Kongondo, thanks for the quick reply; I fixed my mistake by nesting the loops. I'm totally not used to php, which treats arrays very differently than other languages. What I ended up with was this: foreach ($menuItems as $item) { $targetPageId = $item['pages_id']; $randomImage = $pages->get($targetPageId)->images->getRandom(); $menuItemsRendered[] = array( 'page_id'=>$item['pages_id'], 'title'=>$item['title'], 'url'=>$item['url'], 'image'=>$randomImage ); } which works perfectly fine. Thx for the support.
  4. Hi guys, I'm struggling a little getting a menu rendered here. After having build the menu I want to manipulate it; I want to add all menu items to an array, grab an image from each of the target pages in the menu and then render each menu item with some pictures from its target page. I tried using getMenuItems() for this but somehow it fails, I probably don't really get how to properly use it. Here's what I have so far: $menuBuilder = $modules->get('MarkupMenuBuilder'); $menu = 'mainNav'; $menuItems = $menuBuilder->getMenuItems($menu, 2, $options); $bundledMenuItems = array(); $menuItemsWithPictures = array(); //build an array that holds the random picture for each category in the menu foreach ($menuItems as $menuItem) { $targetPage = $pages->get($menuItem->id); $menuItemsWithPictures['title'] = $targetPage->title; $menuItemsWithPictures['pictures'] = $targetPage->get('images'); //this array is intentional, I want to do some slideshow thingy there array_push($bundledMenuItems, $menuItemsWithPictures); } $view->set('menuItems', $menuItems); $view->set('bundledMenuItems', $bundledMenuItems); ?> (This code is probably highly questionable, I'm not really proficient in php; love ProcessWire but despise php...., but what the hell.) I can't, however, seem to render all the items with their corresponding pictures in the frontend. I'm using twig as a template engine; this is what var_dump returns in the frontend: pages: array(4) { [0]=> array(2) { ["title"]=> string(4) "Home" ["pictures"]=> object(ProcessWire\Pageimages)#235 (2) { ["count"]=> int(1) ["items"]=> array(1) { ["steinlampe_2_grayscale.png"]=> string(26) "steinlampe_2_grayscale.png" } } } [1]=> array(2) { ["title"]=> string(5) "Admin" ["pictures"]=> NULL } [2]=> array(2) { ["title"]=> NULL ["pictures"]=> NULL } [3]=> array(2) { ["title"]=> string(5) "Pages" ["pictures"]=> NULL } } ... which aren't the pages that I declared in the menu with menuBuilder. I there something I'm missing here? My desired menustructure should be: illustrationen leuchten impressum ... Does anyone have an idea what I got wrong here? Best regards, derelektrischemoench
  5. Thanks, that did the trick! Greetings, derelektrischemoench
  6. HI guys, I'm currently building a site which displays a selection of processwire pages in one frontend page. My Page tree looks something like this: flavors: a b c ... flavors is the page that gets rendered a, b, c... are child pages of this page. All of these pages contain an image field although some images are high res the other are low res. I added a checkbox field to select whether the image is high / lowres and i want to render them conditionally based on this checkbox value. I have troubles separating these pages though as I seem to be unable to query whether the high res checkbox is set. I'm using the twig template engine to render the frontend. My page selection looks something like this: $available_flavors = $pages->get(1017)->children(); $available_flavors_high_res = $pages->get(1017)->children('is_high_res_image=1'); In my frontend I render the values like that: <div class="row"> {% for flavor in available_flavors_high_res %} <div class="col-sm d-flex flex-column"> <div class="shishaFlavor align-self-center" style="background-image: url('{{ flavor.shisha_flavor_image.url }}')"> </div> <h3>{{ flavor.title }}</h3> </div> {% endfor %} </div> <div class="row"> {% for flavor in available_flavors_low_res %} <div class="col-6 col-sm-4 col-md-3 col-lg-2 d-flex flex-column"> <div class="shishaFlavor align-self-center smallImage" style="background-image: url('{{ flavor.shisha_flavor_image.url }}')"> </div> <h5>{{ flavor.title }}</h5> </div> {% endfor %} </div> The check whether the the high_res value is set, however gets ignored. I assume this has to do something with the way I select the child pages in the PHP snipptet above. Could someone point me in the right direction on how to correctly separate the images with the high-res- flag from the ones without? I guess this would boil down to correctly selecting the boolean. Thanks in advance, derelektrischemoench
  7. AAAAAWWW YEEEEA!. Thx... Don't know why I didn't think about that possibility myself. I only tried google cache but something was borked there. Anyways, thanks again and good luck getting your website stuff going ;-) Greetings DeM
  8. Oh yea, one other thing..... I tried rendering truncated posts on my front page, which worked fine. When I click on "Show more" on the truncated posts, I would expect the module to show me the full post and render the comments section etc. Well.... the rendering of the comments etc. works but the post remains truncated, though. It also outputs the "show more" link but when I click that, nothing happens. I use the "blog post" template to show individual posts, but I was unable to find a function that shows me the post in full..... Back when your blog was online I remembered that there was an argument that could be passed to renderPosts; something like renderPosts(truncate=false) or something like that. I tried that but when I do so, php throws an error. What was the exact argument / the correct way to enable have a single post including comments rendered in full? Best wishes, DeM
  9. Phew, nice to hear that. I was beginning to worry whether the documentation would be gone forever. but in that case.... This project of mine doesn't have a schedule so I'm going to wait until you've got your documentation up and running again because w/o it I'm lost. I'm excited to see the new stuff you've got planned, so good luck on your coding, for now .... Greetings from Germany, DeM
  10. good evening gentlemen, so I have recently set up a Vagrant LAMP stack with the your Blog Module to, well, develop a blog. Unfortunately though, I seem to be unable to reach your website on which you so beautifully used to explain the ins and outs of the API to the module. Apparently the domain got deleted according to the notification on the site. So, is this a permanent state, did you stop the further development of the module or can we expect to see your site up and running again in a few days? I really liked the tutorials you offered there, since I don't know that much about web development and it offered a great starting point to get stuff going. Best wishes, DeM
  11. Hi Guys, I was wondering whether there is an option to change the language of the publishing date of each post and also the archives from English to German. So far though, I was unable to find a solution to this. Is this possible? To elaborate: I want individual posts and the archive to say : 2015 März rather than 2015 March I tried changing the locale in my header.inc but that didn't help. So is there a way to achieve this? Greetings from Germany derelektrischemoench
  12. Hi guys, thanks for the great tutorial, however, I get zero output. Which is unfortunate. I'm new to this whole thing and my php-skills are poor, but could this have to do something with the last line of the file, the template-include? // include site's main template which outputs everything include("./home.php"); It would be awesome if anyone could help me with this. By the way, what would be my main template? I thought there was no such thing, the only thing that's consistent in my pages are the includes of the header and footer. /edit: I managed to do the redirect etc., after the mail is sent my code displays a success message, unfortunately though, it doesn't send a mail. I've tried several of my email adresses as recipients, it just doesn't work. Checked my spam folders as well, no luck there. I'm developing locally on a WAMP stack, could this have something to do with that perhaps something about the configuration of my apache server? /edit2: when I inspect the output of the site I get the following line: <form action="./" method="post"> Do I need to specify a designated mail option in a separate php- script? or does the one Ryan posted already do its job? Best regards, Chris
  13. Hi guys, I've got a little problem here which I can't completely get my head wrapped around. So I've got a site which has links to several picture galleries and I want to set one image as a thumbnail to enter the gallery, which so far, isn't that big of a problem. Then, I'd like to place a caption for the gallery inside that div on top of the image to make it animatable. Now my first approach would have been to use the css "background-image" property for the background and then use regular markup for the captions and animate these. But unfortunately I can't use the api with css. I've tried inline styles but that didn't work, then the image covered the caption. Basically I'm looking for something like this: <div class="thumbnail"> <a href="..."> (Link to my gallery) <div class="flex-item6" style="background-image: (<?php echo $image=$page->images->get ("chrysanthemum_thumbnail.png")->url; ?>)"> <span class="overlay">stuff</span> </a> </div> I just sketched this up, I'm on the road and can't access my original code, but I hope you get the idea. When I tried this earlier, either the markup wasn't displayed or it showed under the image when I used position:relative in my css. So where did I mess up probably somwhere with all the brackets and stuff when calling the api...? And is there a solution to this without using inline-style? /edit: I tried implementing it via css, which worked but that ultimately means that I would have to store my thumbnails separately in some folder and can't access the via the backend Thx Greetz derelektrischemoench
  14. Thx. The critical link I was missing was the whole image- field thing. I read tons of other stuff while googling for a solution and all of them had the echo $page->images - code but only from the code I wondered how PW could find the path to those images. Of course by storing it in an image field on the site. Quite obvious, actually. Thanks again.
×
×
  • Create New...