Jump to content

webhoes

Members
  • Posts

    233
  • Joined

  • Last visited

Everything posted by webhoes

  1. Thanks @fbg13, Let me soak on that for while...
  2. Thanks @fbg13, that works. Can you explain why this works in functions? I can not understand it yet...
  3. I have made this function and it gives me the following error: Error: Uncaught Error: Call to a member function find() on null in function renderChildBlocks(PageArray $children){ $out = ""; foreach ($children as $child){ $image = $child->images->first(); $image = $image->size(300,169); $image = $image->url; $total = $pages->find("template=schildpad, habitats.title%=$child->title")->getTotal(); $out .= "<div class='uk-grid-width-1-3'><a href='" . $child->url . "'><img src='" . $image . "'></a>"; //$total = 0; $out .= ""; $out .= "<a href='" . $child->url . "'>" . $child->title . "</a> (" . $total. ")<br></div>"; } return $out; } Not as a function but on a template page it works perfectly. What did I do wrong? This works... foreach ($children as $child){ $image = $child->images->first(); $image = $image->size(300,169); $image = $image->url; $out .= "<div class='uk-grid-width-1-3'><a href='" . $child->url . "'><img src='" . $image . "'></a>"; //$total = 0; $out .= ""; $total = $pages->find("template=schildpad, habitats.title%=$child->title")->getTotal(); $out .= "<a href='" . $child->url . "'>" . $child->title . "</a> (" . $total. ")<br></div>"; } $content .= $out;
  4. Thanks @Robin S and @LostKobrakai! All becomes more clearer every moment. I working on learning PHP and PW at the same time. For the overview pages I have come up with this in the end: $children = $page->children; foreach ($children as $child){ //$total = 0; $out .= ""; $total = $pages->find("template=schildpad, habitats.title%=$child->title")->getTotal(); $out .= "<a href='" . $child->url . "'>" . $child->title . "</a>(" . $total. ")<br>"; } $content .= $out; Until yesterday I made a structural thinking error. I used the template of habitat instead of turtle to get what I want from the turtle page. That doesn't work ofcourse. Hence the frustration of not getting any results... But now I see stuff
  5. Thanks @LostKobrakai I understand. Without using the child/parent setup how would I do the following. page is turtle and linked to a habitat (another page) with a title Swamp. How will I show the amount of turtles that have a link with Swamp? Swamp (amount of turtles). Turtle 1 - title -body -habitat (page reference) -> swamp Habitats consistst of childs - swamp, river, lake, etc I could not get that figured out in my own test site, hence I was looking into the child/parent solutions like the demo site.
  6. Thanks @LostKobrakai. I had already read this and read it again with this site in mind. If I am correctly is describes the basic normalization method. that would mean method 3 with the use of Page fields en bidirectional page fields. @Robin S what do you mean a primary (important) relationship. question 2: is most cases not as it makes the url too long question 3: yes and no. Turtle - title - body - habitat - Habitat - title -body http://site.com/turtletitle <- is ok http://site.com/habitattitle/turtletitle <- should be ok too I think. Or should this be avoided? Most parts that build up the turtle page are like habitats (temperament, location, food, specie name, album). The main interest is the turtle, all others are extra information (but needed for a complete story). As the demo site also has a different approach -> City -> cities (child) -> skyscraper (child) What would be the benifit to use this with processwire. It seems like a reverse thought. But interesting to understand, for me atleast.
  7. Would the following setup be logic? and give maximum flexibility for outputting to the front site, including a search form with keyword and field for continent, habitat, food and temperament. Specie (parent with some own fields like title, body, images, etc.) childs to specie: Continent (perhaps with own child called country), habitat, food, temperament, album (for photo's), etc. Then also a page for author and the child for author is book With a bidirectional link I can link specie to book.
  8. Hello, I am working on a personal site of mine. I have a basic setup but run into some difficulties. As basis I am now looking at the demo (skyscraper) website. I have noticed that the setup is different to what I would have expected. I would like to know if I should change my setup to make more clever use of processwire. Now I have a basic setup like this: Specie (template specie)(can have 0 or more subspecies)(can be in 0 or more books) Subspecie (template specie) Region (a (sub)specie can live in in one or more regions) Book (a specie can be in one or more books) Author (there can be more authors per book) I want to have the following: A google map with all species show on the map (reasonably working, but not per page of shown species) A list of all authors with the number of books (can't get this done) List of all books with the amount of related species in it (can't get this done) A list of all species (working)(a google map of listed species of that page) Basicly all the suff the skyscraper site has. What I have noticed is that skyscrapers a childeren of cities. That made me think if I should take another approach. Given on this info... what would you suggest.
  9. Hello, I keep getting this error at the checkout. public_html/www1/wire/core/Page.php(1481): ProcessWire\Wire->___callUnknown('parseCart', Array) I installed it all twice but the error remains. Any solutions? Sanne
  10. Thanks @AndZyk, If I am correct this is basicly the navtree. I am looking for something dynamic. The page it belongs to should be seen as the 'root' page and only show the first line of childeren of that page. Most of of those pages are in a foreach. In the frontpage of the site is every childpad is a new css row. So per row aka childpad I should only see the childeren for that childpage. Hopefully I explain it clear enough...
  11. Hello, I have a page that consists of the body of the page and the title and bodies of it's childpages with a foreach. That part works. Each childpage can have a sidebar if filled. What I can't get done is getting the childpages of the childpages. I want the titles of those child/child pages in the sidebar of their parent. main page |sidebar About (parent) | no listing of Part 1 etc... Part 1 (child) |list childpages to Part 1 <- can't get this to work Part 2 (child) |list childpages to Part 2 <- can't get this to work Part 3 (child) |list childpages to Part 3 <- can't get this to work This is my code so far... I tried several other options, but none got what I want. Can somebody give me a hint... <div id='main'> <!-- main content --> <div id='content'> <h1><?php echo $title; ?></h1> <?php // Primary content is the page's body copy echo $page->body; ?> <?php $this_page = $page->get(id); // if the rootParent (section) page has more than 1 child, then render // section navigation in the sidebar (see _func.php for renderNavTree). if($page->rootParent->hasChildren > 1) { $sidebar = renderNavTree($page->rootParent, 3); // make any sidebar text appear after navigation $sidebar .= $page->sidebar; } ?> </div> <!-- sidebar content --> <?php if($sidebar): ?> <div id='sidebar'> <?php echo $sidebar; ?> </div> <?php endif; ?> <?php foreach ($pages->get($this_page)->children as $child) { $image = $child->images->first(); $image = $image->url; ?> <div id="content" style="background: url('<?php echo $image; ?>') no-repeat center top;"> <h1> <?php echo $child->title; ?></h1> <?php echo $child->body; ?> <?php if($sidebar): ?> <div id='sidebar'> <?php foreach ($child->child->children as $children2) { foreach ($children2->children as $child2) { echo "<h1>{$child2->url}</h1>"; } } ?> </div> <?php endif; ?> </div> <?php } //end childpage foreach ?> </div>
  12. How about disabeling _main.php and make a footer.inc with the stuff needed? That won't get parsed in your places.php I think.
  13. Hello AndZyk, I noticed that on the project details. The background is set to #121212 but it still seems partly transparant for some reason. I have not jet found the part to disable that. Those are modx chunks. I used some parts of a modx template. If this template ever goes live, I will populate them with variables from the page.
  14. I will try to check on different computers to see if I can solve the button issue. Thanks.
  15. Hello BitPoet, thanks. I meant to get rid of the arrows as I don't want a slider. Just removed them. Is the div of the waves too high? I use firefox too and here it works. The images of the portfolio page should also be clickable. Do they work with you? Sanne
  16. Hello, I have been working on my first pw site the last view days. Normally I work with Wordpress. I never really had to make a theme myself so this was a nice challange. I took some parts from another theme and added some scripts I found online. The waves on the frontpage are based on repeating field. A text area, background color, wave color and yes/no for the waves. The contact form is made of PHP as I could not get a javaScript solution working. Please share some input to make it better... and please be nice as it is my first attempt at PW.. link is: pw.webhoes.nl Sanne
  17. Hello, I have a question if this module can do the following. I have a turtle that lives in one ore more states (US) or countries. I want to show this on a map on the page about that turtle. The input has to based on just the name of the state or country as I want to use the same also just for a text reference (like a tag). Besides that I want a big map on a sperate page that combines all the turtles and shows which are located where with a hoover link to that turtle (page). The final step is a page per state or country that show the map of that region on top and all related posts below... It's a bit ambitious but I had to ask...
  18. Thanks I had == at first but could not get it working and thought it might be that. I got it workig this way: <?php $waves_yes = $extra_bodies->extra_waves; ?> <div class="svg_waves" <?php if ($waves_yes == 1) { echo "";} else { echo ' style="display:none"';}; ?>> I know it is better to seperate, but I am still learning and getting this far with all was quite challenging
  19. Hello, I am just started playing around with processwire and it looks very nice. I am not a real developer (hopefully start this education next year). I am working on a template where I took some javascript from aother template. For the front page I have created a repeating field blok wich holds a text blok, a background color and a waves color and waves checkbox (0/1). This all is working. But when the waves checkbox is unchecked I want to add to the div display:none. This part is not working as it is part of the for each for the block (I think). I am a bit stuck, can anyboy give me a hint? testpage is pw.webhoes.nl This is the for each loop <?php foreach($page->extra_body as $extra_bodies) { ?> <div class="container-fullwidth" style="background-color:<?php echo "{$extra_bodies->extra_bg_color}"; ?>"> <div class="container"> <section> <div class="row"> <div class="col-md-12 body-front wow fadeInUp animated"> <?php echo "<p>{$extra_bodies->extra_body_text}</p>"; ?> <?php echo "<p>{$extra_bodies->extra_waves}</p>"; ?> </div> </div> </section> </div> <script type="text/javascript">var waves = <?php echo "{$extra_bodies->extra_waves}";?>; if (waves = 0) document.getElementById('svg_waves').style.display = "none"</script> <div class="svg_waves"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 157"> <g id="footer_wave" fill="none"> <g id="Artboard" fill="<?php echo "{$extra_bodies->extra_wave_color}" ; ?>"> <g id="waves" transform="matrix(-1 0 0 1 1649 31)"> <path id="wave--bg" d="M62.871 104.03C216.871 87.324 286 79.324 589 79.324S958 125 1249 125s445.587 1 445.587 1L1678 225 183.67 235.324S-91.129 120.734 62.871 104.03z"/> <path id="wave--bottom" d="M72.868 151.295C103.996 138.363 484.122 47.5 650.155 47.5c166.034 0 320.54 45.056 611.54 45.056 291 0 464.044-67.495 464.044-67.495l-80 132.939-1437 32s-167-98.777-135.871-111.71v73.005z" opacity=".06" transform="matrix(-1 0 0 1 1794.739 0)"/> <path id="wave--middle" d="M43 2c154-9.807 423.81 29.65 538.81 45.5C696.81 63.35 966 94 1257 94c291 0 457.203-42.22 457.203-42.22l-69.753 97.447H201.001S-111 11.807 43 2z" opacity=".15"/> <path id="wave--top" d="M616.074 103.938c-293.347 0-472.782-20.373-472.782-20.373l70.315 97.447h1455.087s329.601-143.286 174.36-153.093c-155.242-9.807-605.136 26.69-721.063 42.54-115.927 15.85-212.571 33.479-505.917 33.479z" opacity=".1"/> </g> </g> </g> </svg> </div> </div> <?php } ?> Below is my code for the home.php template that includes the above code. <?php namespace ProcessWire; ?> <?php /* include_once("./_header.inc"); */ // home.php (homepage) template file. // See README.txt for more information ?> <div class="container"> <header> <!-- Top Navbar --> <nav id="headeroom" class="navbar navbar-fixed-top navbar-intro navbar-intro-full headeroom-padd" role="navigation"> <div class="container"> <!-- Brand and toggle get grouped for better mobile display --> <div class="navbar-header"> <button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#main-navbar-collapse-fixed-top"> <span class="sr-only">Toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a class="navbar-brand navbar-brand-img-lg" href="/"><img src="<?php echo $config->urls->templates?>/images/Logo_webhoes.png" alt="Webhoes" class="img-responsive"></a> </div> <!-- Collect the nav links, forms, and other content for toggling --> <div class="collapse navbar-collapse" id="main-navbar-collapse-fixed-top"> <?php /* <div id="search-wrap" class="navbar-form navbar-right"> <form class='search' action='<?php echo $pages->get('template=search')->url; ?>' method='get'> <input type='text' name='q' placeholder='Search' value='<?php echo $sanitizer->entities($input->whitelist('q')); ?>' /> <button type='submit' name='submit'>Zoeken</button> </form> </div> */ ?> <ul class="nav navbar-nav navbar-right"> <?php foreach($homepage->and($homepage->children) as $item) { if($item->id == $page->rootParent->id) { echo "<li class='current'>"; } else { echo "<li>"; } echo "<a href='$item->url'>$item->title</a></li>"; } // output an "Edit" link if this page happens to be editable by the current user if($page->editable()) echo "<li class='edit'><a href='$page->editUrl'>Edit</a></li>"; ?></ul> </div><!-- /.navbar-collapse --> </div> </nav> </header> </div> <?php /* ?> <div class="container-fullwidth animated fadeIn"> <section id="zoom-out-header"> <div id="zoom-out-background" style="background: url('[[*blog_main_image]]') no-repeat center center; background-size: cover; "></div> <div id="zoom-out-tagline"> <div class="container"> <div class="row no-border no-marg-tb"> <div class="col-md-12"> <h1 class="no-marg-b backg-black-transp20 color-light text-center padd-20">$page->title; </h1> </div> </div> </div> </div> </section> </div> */ ?> <?php // if there are images, lets choose one to output in the sidebar if(count($page->images)) { // if the page has images on it, grab one of them randomly... $image = $page->images->getRandom(); // resize it to 400 pixels wide //$image = $image->width(1140); uit om responsive te maken // output the image at the top of the sidebar... $header = $image->url; // ...and append sidebar text under the image // $sidebar .= $page->sidebar; } else { // no images... // append sidebar text if the page has it // $sidebar = $page->sidebar; echo "$config->urls->templates"; ?>images/full-bg.jpg" <?php } ?> <!-- Full Page Image Background Carousel Header --> <div id="carouselFade" class="container-fullwidth container-marg-b color-primary-backg carousel carousel-fade slide bs-full-slider bs-full-slider-h50 animated fadeInDown"> <!-- Indicators --> <ol class="carousel-indicators z-index-2"> <!--<li data-target="#carouselFade" data-slide-to="[[+idx:decr]]" [[+idx:is=`1`:then=`class="active"`]]></li> --> </ol> <!-- Wrapper for Slides --> <div class="carousel-inner"> <div class="item active"> <div class="fill header-fill" style="background-image:url(<?php echo $header; ?>)"> </div> <div class="carousel-caption height-100 caption-vertical z-index-1" > <div class="caption-vertical-item"> <h1><?php echo "$page->title"; ?> </h1> <p class="lead marg-b20"><?php echo "$page->headline"; ?></p> </div> </div> </div> </div> <!-- Controls --> <a class="left carousel-control z-index-2" href="#carouselFade" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left"></span> </a> <a class="right carousel-control z-index-2" href="#carouselFade" data-slide="next"> <span class="glyphicon glyphicon-chevron-right"></span> </a> </div> </div> <div class="container"> <section> <div class="row"> <div class="col-md-12"> <!-- breadcrumbs --> <div class='breadcrumbs'><?php // breadcrumbs are the current page's parents foreach($page->parents() as $item) { echo "<span><a href='$item->url'>$item->title</a></span> "; } // optionally output the current page as the last item echo "<span>$page->title</span> "; ?></div> </div> </div> </section> </div> <div class="container-fullwidth" style="background-color:<?php echo $page->bodyBackgroundColor; ?>"> <div class="container"> <section> <div class="row"> <div class="col-md-12 body-front"> <?php $page->headline; ?> <div class="wow fadeInUp animated"> <?php echo $content; ?> </div> <?php // Primary content is the page body copy and navigation to children. // See the _func.php file for the renderNav() function example $content = $page->body . renderNav($page->children); ?> </div> </div> </section> </div> <div class="svg_waves"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 157"><g id="footer_wave" fill="none"><g id="Artboard" fill="<?php echo $page->bodyWavesColor; ?>"><g id="waves" transform="matrix(-1 0 0 1 1649 31)"><path id="wave--bg" d="M62.871 104.03C216.871 87.324 286 79.324 589 79.324S958 125 1249 125s445.587 1 445.587 1L1678 225 183.67 235.324S-91.129 120.734 62.871 104.03z"/><path id="wave--bottom" d="M72.868 151.295C103.996 138.363 484.122 47.5 650.155 47.5c166.034 0 320.54 45.056 611.54 45.056 291 0 464.044-67.495 464.044-67.495l-80 132.939-1437 32s-167-98.777-135.871-111.71v73.005z" opacity=".06" transform="matrix(-1 0 0 1 1794.739 0)"/><path id="wave--middle" d="M43 2c154-9.807 423.81 29.65 538.81 45.5C696.81 63.35 966 94 1257 94c291 0 457.203-42.22 457.203-42.22l-69.753 97.447H201.001S-111 11.807 43 2z" opacity=".15"/><path id="wave--top" d="M616.074 103.938c-293.347 0-472.782-20.373-472.782-20.373l70.315 97.447h1455.087s329.601-143.286 174.36-153.093c-155.242-9.807-605.136 26.69-721.063 42.54-115.927 15.85-212.571 33.479-505.917 33.479z" opacity=".1"/></g></g></g></svg></div> </div> <div class="container-fullwidth" style="background-color:#<?php echo $page->body2BackgroundColor; ?>"> <div class="container"> <section> <div class="row"> <div class="col-md-12 body-front wow fadeInUp animated"> <?php echo "$page->body2"; ?> </div> </div> </section> </div> <div class="svg_waves"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 157"><g id="footer_wave" fill="none"><g id="Artboard" fill="#<?php echo $page->body2WavesColor; ?>"><g id="waves" transform="matrix(-1 0 0 1 1649 31)"><path id="wave--bg" d="M62.871 104.03C216.871 87.324 286 79.324 589 79.324S958 125 1249 125s445.587 1 445.587 1L1678 225 183.67 235.324S-91.129 120.734 62.871 104.03z"/><path id="wave--bottom" d="M72.868 151.295C103.996 138.363 484.122 47.5 650.155 47.5c166.034 0 320.54 45.056 611.54 45.056 291 0 464.044-67.495 464.044-67.495l-80 132.939-1437 32s-167-98.777-135.871-111.71v73.005z" opacity=".06" transform="matrix(-1 0 0 1 1794.739 0)"/><path id="wave--middle" d="M43 2c154-9.807 423.81 29.65 538.81 45.5C696.81 63.35 966 94 1257 94c291 0 457.203-42.22 457.203-42.22l-69.753 97.447H201.001S-111 11.807 43 2z" opacity=".15"/><path id="wave--top" d="M616.074 103.938c-293.347 0-472.782-20.373-472.782-20.373l70.315 97.447h1455.087s329.601-143.286 174.36-153.093c-155.242-9.807-605.136 26.69-721.063 42.54-115.927 15.85-212.571 33.479-505.917 33.479z" opacity=".1"/></g></g></g></svg></div> </div> <?php foreach($page->extra_body as $extra_bodies) { ?> <div class="container-fullwidth" style="background-color:<?php echo "{$extra_bodies->extra_bg_color}"; ?>"> <div class="container"> <section> <div class="row"> <div class="col-md-12 body-front wow fadeInUp animated"> <?php echo "<p>{$extra_bodies->extra_body_text}</p>"; ?> <?php echo "<p>{$extra_bodies->extra_waves}</p>"; ?> </div> </div> </section> </div> <script type="text/javascript">var waves = <?php echo "{$extra_bodies->extra_waves}";?>; if (waves = 0) document.getElementById('svg_waves').style.display = "none"</script> <div class="svg_waves"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1440 157"> <g id="footer_wave" fill="none"> <g id="Artboard" fill="<?php echo "{$extra_bodies->extra_wave_color}" ; ?>"> <g id="waves" transform="matrix(-1 0 0 1 1649 31)"> <path id="wave--bg" d="M62.871 104.03C216.871 87.324 286 79.324 589 79.324S958 125 1249 125s445.587 1 445.587 1L1678 225 183.67 235.324S-91.129 120.734 62.871 104.03z"/> <path id="wave--bottom" d="M72.868 151.295C103.996 138.363 484.122 47.5 650.155 47.5c166.034 0 320.54 45.056 611.54 45.056 291 0 464.044-67.495 464.044-67.495l-80 132.939-1437 32s-167-98.777-135.871-111.71v73.005z" opacity=".06" transform="matrix(-1 0 0 1 1794.739 0)"/> <path id="wave--middle" d="M43 2c154-9.807 423.81 29.65 538.81 45.5C696.81 63.35 966 94 1257 94c291 0 457.203-42.22 457.203-42.22l-69.753 97.447H201.001S-111 11.807 43 2z" opacity=".15"/> <path id="wave--top" d="M616.074 103.938c-293.347 0-472.782-20.373-472.782-20.373l70.315 97.447h1455.087s329.601-143.286 174.36-153.093c-155.242-9.807-605.136 26.69-721.063 42.54-115.927 15.85-212.571 33.479-505.917 33.479z" opacity=".1"/> </g> </g> </g> </svg> </div> </div> <?php } ?>
×
×
  • Create New...