Jump to content

webhoes

Members
  • Posts

    233
  • Joined

  • Last visited

Everything posted by webhoes

  1. I also have a gitlab account because I want to learn more about it and they way development should go (as in a real company). I basicly work alone so it might be a little overkill. However as a beginning developer I want to learn to work with repositories. Do you push all code (pw and template files)? Or just the template files? Or do you push docker containers? Do you push from Gitlab to a production server? I currently just use it as backup of the template (not the DB). With gitlab I can add client as Reporter, making it a bit of a helpdesk. They can report bugs or changes and I can pick them up. I can also post the manual there. Those are nice features. I would love to hear more of workflows that would work well with processwire.
  2. @Pixrael I did no know this method. But it works perfectly. I also removed the double title id. Was there by mistake I guess...
  3. Hello, I am using the latest template strategy. For some page I use Id and class to replace or append content to a div. When checking the output I noticed that for the div's that are located between <head></head> the output is generated in between <body></body> I can't figure out why? Does any one know? <?php namespace ProcessWire ;?> <!DOCTYPE html> <html lang="nl"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <!-- Title of this page --> <div id="title-region"><title id="title-region"><?php echo $page->title; ?> | <?php echo $page->template->name; ?> | schildpad | Chrysemys</title></div> <link rel="stylesheet" href="<?php echo \AIOM::CSS(array('styles/bootstrap.css', 'styles/font-awesome.css', 'styles/chosen.min.css', 'styles/prettyPhoto.css', 'scripts/responsive-menu/component.css', 'styles/svg-icons.css', 'styles/typography.css', 'styles/jquery.auto-complete.css', 'styles/shortcodes.css' , 'styles/colors.css', 'styles/style.css', 'styles/responsive.css')); ?>"> <!-- Global site tag (gtag.js) - Google Analytics --> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-108091260-1"></script> <script> window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag('js', new Date()); gtag('config', 'UA-108091260-1'); </script> <div id="google_map"></div> <meta name="description" content="<?php echo $page->summary; ?>" /> <meta property="og:locale" content="nl_NL" /> <meta property="og:type" content="website" /> <meta property="og:title" content="<?php echo $page->title; ?> | Chrysemys " /> <meta property="og:description" content="<?php echo $page->summary; ?>" /> <meta property="og:url" content="<?php echo $page->httpUrl; ?>" /> <meta property="og:site_name" content="Chrysemys" /> <meta property="og:image:secure_url" content="<?php if(count($page->images)) echo 'https://chrysemys.nl' . $page->images->first()->size(1200,630)->url; ?>"/> <meta property="og:image" content="<?php if(count($page->images)) echo 'https://chrysemys.nl' . $page->images->first()->size(1200,630)->url; ?>"/> </head>
  4. I always look for free HTML templates or buy one for about $10. It takes me to about a day to incorporate it in PW. After that you have all fexibility of PW with a kick-ass template.
  5. There is also the site export profile module. Works very nice. http://modules.processwire.com/modules/process-export-profile/
  6. Thanks @kongondo I will have a closer look again.
  7. I already found most of these links. As far as I can see the make it so that a page has 2 routes. It's orginal and the alternative I want just one route (the one without the parent). I also want the to be without the parent in the sitemap.xml.
  8. Hello, I want to make some landing pages. For that I have created a landing-pages templates that hold landing-page as children. Each child I will use to target a specific keyword for google. How can I omit the parent url (landing-pages). So landing-pages/the perfect keyword for google/ wil be /the perfect keyword for google/ I use the the landing-pages template to keep the admin organised and not have a huge amount of pages under Home in the admin.
  9. @abdus you're right. The other field had a max of 1 on it. This field not. I got it working now. Thanks. I totally overlooked this myself.
  10. studbook=$page->id is old... studbook=$page->title what I use... I changed this for one of the tests. I also tried to build up the path to the document with this. $path = $a->annual_report->url; $path .= $a->annual_report->name; $path .= '.' . $a->annual_report->ext; But also this only shows the directory where the pdf resides. Nothing about the pfd itself.
  11. It shows the array of the found reports, as expected. 1105|1106
  12. Hello, I have 2 page type: Books and reports. A report can be link to a book. There is only 1 document (pdf) in a report. I can get the list of linked reports on the book page. But I can not get it to give me the download url. If I use the same field (annual_report) as part of the book template, all works flawlessly. But I need to have the report as a seperate entity. Why doesn't this work? $reports = ''; foreach ($page->annual_report as $report){ $reports .= '<a href="' . $report->url . '" class="download-btn" target="_blank"><i class="fa fa-file-pdf-o" aria-hidden="true"></i>' . $report->description . '</a>'; } //this doensn''t work, but should be correct $ann = ''; $annual = $pages->find("template=annual-report, studbook=$page->id"); foreach($annual as $a){ $ann .= '<a href="' . $a->annual_report->url . '" class="download-btn" target="_blank"><i class="fa fa-file-pdf-o" aria-hidden="true"></i>' . $a->annual_report->description . '</a>'; }
  13. @bernhard, that is a really good tip. Thanks!
  14. @bernhard I also tried something different with count, but did also not get the expected result. Getting a flexible menu in a loop remains a tricky thing.
  15. Thanks @bernhard, that did not work as expected. I ended up using this multiple times. if($item->template->name == 'basic-page') This works as expected, but the only downside that a basic-page has to be the parent. On this site that will do just fine. It is rather inefficient, but this is a Multi language site so the menu title have to come from the pages.
  16. Hello, the following code is for rendering my menu. The templates articles (child is article) and blogs (child is blog) have no childeren (yet). For some reason every menu item gets a "dropdown" class. Also the pages that should not have them. What am I doing wrong here? <ul class='nav navbar-nav' role='navigation'><?php echo "<li><a href='/'>Home</a></li>"; // top navigation consists of homepage and its visible children foreach($homepage->children as $item) { if($item->id == $page->rootParent->id) { echo "<li class='"; if($item->children->find('template!=blog|article')) echo "dropdown"; echo " active' aria-current='true'>"; } else { echo "<li class='"; if($item->children->find('template!=blog|article')) echo "dropdown"; echo "'>"; } echo "<a href='$item->url'"; if($item->children->find('template!=blog|article')) echo "class='dropdown-toggle' data-toggle='dropdown' role= 'button' aria-haspopup='true' aria-expanded='false'"; echo ">" . $item->title . "<span class='caret'></span></a>"; if ($item->children) { echo "<ul class='dropdown-menu sub-menu'>"; foreach ($item->children as $child) { echo "<li><a href='" . $child->url . "'><i class='fa fa-angle-double-right' aria-hidden='true'></i>" . $child->title . "</a></li>"; } echo "</ul>"; } echo "</li>"; $item->children = Null; } // 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>"; ?> <!-- language switcher / navigation --> <?php foreach($languages as $language) { if(!$page->viewable($language)) continue; // is page viewable in this language? if($language->id == $user->language->id) { echo "<li class='active'>"; } else { echo "<li>"; } $url = $page->localUrl($language); $hreflang = $homepage->getLanguageValue($language, 'name'); echo "<a hreflang='$hreflang' href='$url'>$language->title</a></li>"; } ?> </ul>
  17. I use ConnectPageFields and it works on the latest version. Let's say you have 50 types of fish on your site. You add a new book and reference all these fish to that book. If add a new fish and you want to reference it to that same book you would also need to edit that book. With bidirectional link you reference the book when you add the fish. No need to go to the book afterwards. With a few fish and books that's would not be a problem, but if you have more of 50 of each, this would make you live easier. With a bidirectional link both references are visible on both pages in the admin. If you delete one, the other will also be deleted.
  18. Nice, I did not look close enough... my bad. It is my first time too. I also did not foresee this as an issue...
  19. I have this.. but that does not seem to get the correct full url. It still makes links the only have the url that you are on at the moment. The search results all belong to another domain. That is what I want, but the httpUrl should get corresponding domain of that particular page in the search results. // markup for the link $out .= "<a href='$item->httpUrl'>$item->title</a> "; What does the parent->title do for you. You have more closing tags then opening tags...
  20. I use that module for this. But I need full links with the proper full url in the search results. I will check your second link and update my knowledge...
  21. this is the page tree The pages Over, Historie, etc should refer to the rootdomain (Home). All other search results should refer to the corresponding domain. All found pages should be in the search results and the links should jump to the corresponding page with correct domain. Otherwise the page doesn't excist. This is the basis search code (slightly adapted) function renderNav(PageArray $items) { // $out is where we store the markup we are creating in this function $out = ''; // cycle through all the items foreach($items as $item) { // render markup for each navigation item as an <li> if($item->id == wire('page')->id) { // if current item is the same as the page being viewed, add a "current" class to it $out .= "<li class='current'>"; } else { // otherwise just a regular list item $out .= "<li>"; } // markup for the link $out .= "<a href='$item->httpUrl'>$item->title</a> "; // if the item has summary text, include that too if($item->summary) $out .= "<div class='summary'>$item->summary</div>"; // close the list item $out .= "</li>"; } // if output was generated above, wrap it in a <ul> if($out) $out = "<ul class='nav'>$out</ul>\n"; // return the markup we generated above return $out; }
  22. Actually I do want that. It is ok if a page from another domain shows up in the list. But if you click on it, you should go to that page with the corresponding domain.
  23. I can also show the links on the 404 page. But how do I force the right domain for the search results in the list?
  24. I have come across the following quirk. I redirect a 404 to the search so that a 404 is never given but a list of relevant pages. I just found out that this wil build an infinite loop. A page in the rootdomain will show up, but will have the domain you are currently (on of the muli sites) on. But page doens't excist on that domain so you go through the search again and again... Now I changed ->url to ->httpUrl but this doesn't take into account the orginal domain that page is from. Is there a way around this?
  25. I have kind of the same website like you about turtles. https://chrysemys.nl I have a mix of parent/child pages and page references. Alle depending on the specific needs. If a fish could change owner or change aquarium, I would use page reference. User can change this themselves, otherwise you would need to give them too much permissions. I have the taxonomy for turtles. order -> sub order -> family -> species. This is a parent/child tree as these a vast routes that are always the same for a turtle. The same goes for the country or origin: region -> country. Page reference can also be bidirectional. This is very usefull! If you have books on your site you can reference to the fish in that book. In the admin you will see on the fish page all books and on the book page all fish. If you add a new book and select a few fish, that book is also added to those fish in the admin fish page. That way you can make an amazing flexible website To be honest it took me a while to figure it all out. I used to have all page references but later changes some part to parent/child. This because it would make it less possible to make mistakes. For example, I added some countries to a turtle but also referenced the wrong region. Therefor that turtle would appear on wrong pages. Using the parent/child for this made it more dummy proof
×
×
  • Create New...