Jump to content

ngrmm

Members
  • Posts

    481
  • Joined

  • Last visited

  • Days Won

    3

Everything posted by ngrmm

  1. this is my page-tree –projects –– project A –– project B –– project C –categories –– x –– y every project has a page-field and the options are the children of categories. the categorie are the menu of the site. how ist possible to falg the right <li> on a project-site? this my code and i don't know how select/flag only the <li> of the current page category <ul> <?php $root = $pages->get("1052"); $children = $root->children(); foreach($children as $child) { // for the other sites $class = $child === $page ? " class='on'" : ''; // project $ci = $child->id; $pc = $page->category; $class2 = $ci === $pc ? " class='on2'" : ''; echo "<li $class $class2 ><a href='{$child->url}'>{$child->title}</a></li>"; } ?> </ul>
  2. yes, everything at right place.
  3. i had to comment them out because of hosteurope i installed PW 2.7.2 and PHP version is 5.6
  4. i did a blank installation. i had to change .htaccess these were the changes: # Options -Indexes # Options +FollowSymLinks and # <IfModule mod_php5.c> # php_flag magic_quotes_gpc off # php_flag magic_quotes_sybase off # php_flag register_globals off # </IfModule> i had to comment them out but after the last step i get this error. [sat Mar 05 16:07:52 2016] [error] PHP Fatal error: Class 'InputfieldSelectMultiple' not found in /is/htdocs/wp1164483_ZCA9MSF2EZ/www/site/tmp/wire/modules/Inputfield/InputfieldAsmSelect/InputfieldAsmSelect.module on line 7, referer: http://www.*****.***/tmp/install.php
  5. thx LostKobrakai but i'm a beginner in php. i'll try to understand arrays are
  6. this works, but it might be not the best or shortest solution <ul> <?php $root = $pages->get("/"); $children = $root->children(); foreach($children as $child) { $class = $child === $page->rootParent ? " class='on'" : ""; if( $child->id == $pages->get("/page_A")->id ) { echo "<li $class ><a >{$child->title}</a>"; } else { echo "<li $class ><a href='{$child->url}'>{$child->title}</a>"; } echo "<ul>"; if( $child->id == $pages->get("/page_A")->id ) { foreach($child->children as $grandchild) { echo "<li ><a href='{$grandchild->url}'>{$grandchild->title}</a></li>"; } } echo "</ul></li>"; } ?> </ul>
  7. i want to output a menu with just one dropdown-option and an class="active" if the user is on the active page this is my tree – root –– page A –––– child page A –––– child page A –––– … –– page B ––– child page B ––– child page B ––– child page B –– page C ––– child page C ––– child page C and the output should be like this –– page A (just dropdown, no link! just text) –––– child page A (link) –––– child page A (link) –––– … –– page B (link) (children should not be listed) –– page C (link) (children should not be listed) and if the current page matches A, B and C matches on any level a class should be added to page A or B or C this my code so far but i dont how to make page B and C an link and page A just text and how not to output the children of page B and C <?php $root = $pages->get("/"); $children = $root->children(); foreach($children as $child) { $class = $child === $page->rootParent ? " class='on'" : ""; echo "<li $class ><a >{$child->title}</a>"; echo "<ul>"; foreach($child->children as $grandchild) { echo "<li ><a href='{$grandchild->url}'>{$grandchild->title}</a></li>"; } echo "</ul></li>"; } ?>
  8. i solved it this was: $articles = $pages->find("template=photo|video, highlight=1, sort=created, "); $articles_2 = $pages->find("template=photo|video, highlight=0, sort=created, "); … but it seems there could be a better way with less code
  9. i'd like to have a list of pages sorted by „creation“. $articles = $pages->find("template=x|y, sort=creation"); all the pages have a checkbox-field. the name of the checkbox-field is highlight. and it is a autojoin-field. i want all the highlight-pages listed above the others i don't know how to handle checked and not checked as a value this doesn't work $articles = $pages->find("template=x|y, sort=highlight, sort=creation" );
  10. thx diogo $gp = $pages->get(1016); $children = $gp->children; $articles = $pages->get("parent={$children}, sort=title"); foreach($articles as $article) { echo $article->title; } but it doesn't work maybe because $children is an array?
  11. this is my code $gp = $pages->get(1016); $children = $gp->children; foreach($children as $child) { $articles = $child->children; foreach($articles as $article) { … } } i want all articles to be sorted by title (asc) i tried this: $articles = $child->children('sort=title'); but the sorting happened too early an this doesn't work also (too early) foreach($articles->sort('name') as $article)
  12. thanks Macrura i did an now this. sorry, but i don't know where that should be This page contains the following errors:error on line 46 at column 106: Attribute alt redefined
  13. i installed the module and used this in my template: $rss->title = "Latest updates"; $rss->description = "The most recent pages updated on my site"; $items = $pages->find("limit=10, sort=-modified"); $rss->render($items); now i'm getting an error for the last line: Error: Call to undefined method stdClass::render() (line 11 of /var/www/vhosts/***/httpdocs/tmp/site/templates/feed.php)
  14. it works! $lang = $user->language->name; if($lang == 'default') { setlocale(LC_TIME, "de_DE.UTF8"); } else { setlocale(LC_TIME, "en_EN.UTF8"); } and utf8_encode(strftime('%A <br>%d %B %Y', $page->getUnformatted('postDate'))) THANKS!
  15. UPDATE: i delted setlocale in config.php added it to the template-file now both languageversion are german is there a way to to setlocal as a variable?
  16. @martijn yes, i added setlocale(LC_TIME, "de_DE.UTF8"); to the config.php
  17. and i treid it with this in the template-file utf8_encode(strftime('%d. %B %Y', $page->getUnformatted('date'))); still everthing in english
  18. thanks Jürgen. no luck. still in english i noticed that my html begins always like this: <html lang="en" … is that a problem?
  19. i did a multilanguage-install. english and german are needed i set german as default (install german languagepack at default) then add english (en) as second language my date-output is custom: %A %d %B %Y (Details Tab) echo $page->date the problem is that i always get the english ouput.
  20. @teppo thanks here the final code: <div class="pagination"> <?php $prevPage = $page->prev; $nextPage = $page->next; if($page != $pages->get(1019)->children->first()) { echo "<a class='link next' href='" . $prevPage->url . "' >"; foreach($prevPage->image as $image) { $thumb = $image->height(60); echo "<div><img src='" . $thumb->url . "'/></div>"; } echo "<span>". $prevPage->title ."</span>"; echo "<span class='date' >". $prevPage->teaser_date ."</span>"; echo "</a>"; } if($page != $pages->get(1019)->children->last()) { echo "<a class='link prev' href='" . $prevPage->url . "' >"; foreach($nextPage->image as $image) { $thumb = $image->height(60); echo "<div><img src='" . $thumb->url . "'/></div>"; } echo "<span>". $nextPage->title ."</span>"; echo "<span class='date' >". $nextPage->teaser_date ."</span>"; echo "</a>"; } ?> </div>
  21. thanks Marttijn i edited the code but still getting Internal Error there are always at least 3 children of that page (1019). and all of them aren't hidden. <div class="pagination"> <?php $prevPage = $page->prev; $nextPage = $page->next; if($page != $pages->get(1019)->children->first()) { echo "<a class='link prev' href='" . $prevPage->url . "' >" foreach($prevPage->image as $image) { $thumb = $image->height(60); echo "<div><img src='" . $thumb->url . "'/></div>"; } echo "<span>". $prevPage->title ."</span>"; echo "<span class='date' >". $prevPage->teaser_date ."</span>"; echo "</a>" } if($page != $pages->get(1019)->children->last()) { echo "<a class='link next' href='" . $nextPage->url . "' >" foreach($nextPage->image as $image) { $thumb = $image->height(60); echo "<div><img src='" . $thumb->url . "'/></div>"; } echo "<span>". $nextPage->title ."</span>"; echo "<span class='date' >". $nextPage->teaser_date ."</span>"; echo "</a>" } ?> </div>
  22. there is a pagination (next|prex) at the end of the page i want to hide next on the last page of the siblings and hide prev on the first <?php if($page != $pages->get(1019)->children->first()) { echo "<a class='link prev' href="$page->prev->url">"; foreach($page->prev->image as $image) { $thumb = $image->height(60); echo "<div><img src='$thumb->url'/></div>"; } $test = $page->prev; echo "<span> $test->title </span>"; echo "<span class='date' > $test->teaser_date </span>"; } echo '</a>' if($page != $pages->get(1019)->children->last()) { echo "<a class='link next' href="$page->next->url">"; foreach($page->next->image as $image) { $thumb = $image->height(60); echo "<div><img src='$thumb->url'/></div>"; } $test = $page->next; echo "<span> $test->title </span>"; echo "<span class='date' > $test->teaser_date </span>"; } echo "</a>"; ?> line 3: echo "<a class='link prev' href="$page->prev->url">"; is causing the error but i don't know why
  23. i changed the order and it worked if($box->text) { //text } else { //images } would be nice to know why it doesn't work the other way around
  24. thanks but it doesn't work i still get this <div class="box images" >…</div> <div class="box images" >…</div> <div class="box images" >…</div> <!-- this one below ist the repeater without images --> <div class="box images" ></div>
  25. i have a repeater with 2 fields – image – text if there are images uploaded then the output should be only the image field. if no images uploaded, then only the text-field should be shown right now, if the image-field is empty and the text-field is filled. i'm getting two boxes. and the first one is empty. <?php foreach($page->repeater as $box) { if($box->images) { ?> <div class="box images"> <?php foreach($box->images as $image) { echo "<img src='$image->url'/>"; } ?> </div> <?php } else { } if($box->text) { ?> <div class="box text"><?php echo $box->text; ?></div> <?php } } ?>
×
×
  • Create New...