EvanFreyer
Members-
Posts
11 -
Joined
-
Last visited
EvanFreyer's Achievements
Jr. Member (3/6)
0
Reputation
-
Yes, they are. I just double checked.
-
I ran into some problems while developing, perhaps someone could help me? I am trying to use the pageName as the identifier right now and everything works, but $page->name always returns the english page name and not the localized. I fixed that with using $page->localName($user->language). However, my selector does not seem to work that way. It seems as if it does not find the local value. I am using $page->find("name=".$sanitizer->selectorValue($localName)). The English version works flawless.
-
@LostKobrakai: I think, that is the best solution. Thanks! =)
-
I thought, URL Segments are not part of the page-name restrictions as well since I only saw them as an alternative to GET-parameters. I changed the programming, so that it will search for an ID rather than the title of something, so that still works, but the URL is not as pretty. But just for the sake of discussing things: If I integrate a tagging system for news and if I like to have some kind of overview of all news by a certain tag, I was under the impression, that I can use URL Segments to indicate which tag I was searching for. Since all Tags would be unique, the name alone could be my identifier. Do I have to use GET-Parameters, if I wanted to do it the "PW-way", since something like news/bytag/ÄÖÜ is not supported? I hope, I made myself clear, I can be a little bit confusing .
-
@teppo: Thanks for the info! I removed the redirection and now I can access the page. However, it seems to strip umlauts from the url. I haven't found that option yet. @mr-fan: Code examples are not relevant right now. I added a template and allowed URL Segmentation. I don't have any rules set up at all, so it just accepts it. Until now, an Umlaut leads to the default 404 page and the code of the template was not executed at all. With teppo's changes to the htaccess (I should have known that, damn... thanks again ), the page is at least called. Now I have to search, where processwire or the htaccess strips my Umlauts.
-
Hey there, I have a problem with URL Segments and Umlauts in it. I want to grab the a segment of the url and use it as a parameter to find a something in Processwire. The problem is, that if I input an umlaut into the url, processwire immediately throws a 404 error page and I am not able to transform my inputs. Is there a way to get around that problem? Cheers, Evan
-
@Roope: Yeah, that one looks better, thanks for the update! @kazu: Recursive means, that a piece of code calls itself, so that it can manage the same task again and again. Regarding the navigation, this pattern ensures, that you can print the navigation for the third, fourth, n-th level as well without modifying your existing code to do that explicitly. See, if we take your code, you will only get the navigation to the second level. If somehow you want to build the third level as well, you have to add that to your code and if you want to drop the list elements and go for example for just the text and a break, you have to change your code in three places. This won't be necessary with the recursive version. If you look closely at Roope's code, you see, that it calls itself here: // iterate possible childs // NOTE: except for homepage, since those are already included in the array // we pass to the function as first level pages (same logic added to class 'parent' name) if($item->hasChildren() && $item->id != 1) { $str .= buildNav($item->children); } Here, we see, that our navigation has child elements and so we call the same function again, but with the children as parameter. If the function then finds children again, the whole thing happens again and so forth. Of course it is important to ensure, that this function terminates. Otherwise, this will be a infinite loop and not a recursive function .
-
Hi there! Maybe I am missing something obvious and I could not find anything regarding this in the forums. If this asked before: Sorry! I can not find an option to remove a page from a PageTable without deleting the actual page. For me, the PageTable module lets me add numerous pages to a parent page, so that I have more control over which items will be displayed and which ones will not. But sometimes I want to switch pages and remove one from the parent page without deleting the child altogether. Is this possible with the default module or does it have to be extended for this purpose? Cheers Evan
-
Yeah, I did not change the variable name. Furthermore, you need to call the function in your template. So you should insert another line after the code: buildNav($homepage);
-
While Roope's solution works, you will only get the direct children in your nav. You could unify this with a recursive function. Modifying Roope's code like this should work: function buildNav($page) { echo "<ul>"; foreach($page->and($page->children) as $item) { // class name for item wrapper $class = $item->id == $page->rootParent->id ? 'current ' : ''; if($item->hasChildren()) $class .= 'parent '; // open item wrapper if(!empty($class)) { echo "<li class='". rtrim($class) ."'>"; } else { echo "<li>"; } // item link element echo "<a href='$item->url'>$item->title</a>"; // markup for possible childs if($item->hasChildren()) { buildNav($item); } // close item wrapper echo "</li>"; } echo "</ul>"; } I have not tested the code, but it should work. It could be, that you have to tinker with the markup a little bit. Edit: Whoops, wrong variable name.
-
Hey there! First and foremost: Thanks for making PW. I discovered it lately and I am using it right now to develop a corporate website with different designs and microsites. PW is giving me exactly the type of flexibility and ease-of-use, that I need. It is incredible and it is a CMS as I would develop it, if I have the time (and the skill ). I noticed a weird behaviour with the render()-options in my version (2.6.1), that I can not pinpoint exactly. I have some fields in my page, that I want to render with a specific template, so that I can share that template for all the pages, that uses this field. For example, I have a image carousel template, which takes a page with a specific repeater and renders all the items in one template file: <section class="microsite-section carousel slide" id="carousel-microsite-<?=$page->id?>" data-ride="carousel"> <ol class="carousel-indicators"> <?php $first = true; $i = 0; foreach ($page->image_carousel_repeater as $item) { echo "<li data-target='#carousel-microsite-".$page->id."' data-slide-to='".$i."'".($first ? " class='active'" : "")."></li>"; $first = false; $i++; } ?> </ol> <div class="carousel-inner" role="listbox"> <?php $first = true; foreach ($page->image_carousel_repeater as $item) { // echo "<div class='carousel-item item".($first ? " active" : "")."><img src='".$item->image_carousel->url."' alt=''>"; echo "<div class='carousel-item item".($first ? " active" : "")."' style='background-image:url(".$item->image_carousel->url.")'>"; echo "<div class='carousel-caption'>".$item->image_carousel_text."</div></div>"; $first = false; } ?> </div> <!-- Controls --> <a class="left carousel-control" href="#carousel-microsite-<?=$page->id?>" role="button" data-slide="prev"> <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span> <span class="sr-only">Previous</span> </a> <a class="right carousel-control" href="#carousel-microsite-<?=$page->id?>" role="button" data-slide="next"> <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span> <span class="sr-only">Next</span> </a> </section> (Please excuse the weird code, it is just a prototype.) In the main template, I call this template: $content .= $page->render('microsite-image-carousel.php', array('appendFiles' => array(null))); There you see, that I use the additional render-options (which are sadly not documented in the API Cheatsheet btw), because I don't want to append any files. But if I use the appendFile-Option, PW will include the main file nevertheless: $content .= $page->render('microsite-image-carousel.php', array('appendFile' => null)); Now my guess is, that render('template-file') only renders the page with this file but still with the options connected with the main template, that this page-object is derived from. But why do these two calls behave differently? I thought, they meant the same thing only with the option to append multiple files. Thanks in Advance! Cheers Evan By the way: Is there a way to configure a template to append multiple files?