Andreas_D Posted July 27, 2017 Share Posted July 27, 2017 Hi, I have a small problem maybe one has a tip. I can not change the title of the page without it afterward no longer works. Many thanks for the help! The Code: ><!DOCTYPE html> <html lang="<?php echo _x('en', 'HTML language code'); ?>"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, initial-scale=1" /> <title><?php echo $title; ?></title> <meta name="description" content="<?php echo $page->summary; ?>" /> <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>scripts/owl/assets/owl.carousel.css" /> <link rel="stylesheet" type="text/css" href="<?php echo $config->urls->templates?>styles/styles-detjen.css" /> <?php handleLanguageHeadLinks(); ?> </head> <body <?php echo 'class="parent-'. strtolower($page->parent()->title) . ' ' . strtolower($page->title) . '"' ?> <?php if ( $page->background ) { echo " style='background-image: url(\"{$page->background->url}\");background-repeat:no-repeat;background-size:cover;'"; } ?> > <header class="top-header"> <a class="logo" id="logo" href="<?php echo $pages->get("/")->url ?>">D /</a> <button class="menu-btn is-mobile" id="menu-btn"> <div class="menu--line"></div> <div class="menu--line"></div> <div class="menu--line"></div> </button> </header> <div class="nav-menu-container is-mobile is-desktop" id="nav-menu-container"> <nav class="navigation-menu"> <!-- top navigation --> <ul class='nav-list mobile-nav'> <li class="close"> </li> <?php echo '<li><ul class="languages">'; $current = 0; $count = count( $languages ); foreach($languages as $language) { $additional = "notLast"; if ( $count - 1 == $current ) { $additional = ""; } $current++; if(!$page->viewable($language)) continue; // is page viewable in this language? if($language->id == $user->language->id) { echo "<li class='current {$additional}'>"; } else { echo "<li class='{$additional}'>"; } $url = $page->localUrl($language); $hreflang = $homepage->getLanguageValue($language, 'name'); echo "<a hreflang='$hreflang' href='$url'>$hreflang</a></li>"; } echo "</ul></li>"; // top navigation consists of homepage and its visible children $landingPage = $pages->get("/"); if($landingPage->id == $page->rootParent->id) { echo "<li class='current'>"; } else { echo "<li>"; } echo "<a href='$landingPage->url'>$landingPage->title</a></li>"; foreach($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> </nav> </div> <div id='main'> <!-- main content --> <div id='content' class='content'> <?php echo $content; ?> </div> </div> <?php if ( isset( $footer )) { ?> <div class="contact-footer-block clearFix"> <div class="small-link leftFloated"><a href="<?php echo $footer[ 'web_link' ]; ?>">imprint</a></div> <div class="small-link rightFloated"><a href="<?php echo $footer[ 'linkedin' ]; ?>">linkedin</a></div> <div class="small-link rightFloated"><a href="<?php echo $footer[ 'instagram' ]; ?>">instagram</a></div> <div class="small-link rightFloated"><a href="<?php echo $footer[ 'twitter' ]; ?>">twitter</a></div> </div> <?php } ?> <div class="scroll-cta" href="<?php echo $pages->get( 1025 )->url ?>"> <div class="c-line"></div> </div> <iframe style="height:0px;width:0px;visibility:hidden" src="about:blank"> this frame prevents back forward cache </iframe> <script src="<?php echo $config->urls->templates?>scripts/jquery-3.1.1.min.js"></script> <script src="<?php echo $config->urls->templates?>scripts/jquery-ui-1.12.1.min.js"></script> <script src="<?php echo $config->urls->templates?>scripts/jquery.touchSwipe.min.js"></script> <script src="<?php echo $config->urls->templates?>scripts/owl/owl.carousel.min.js"></script> <script src="<?php echo $config->urls->templates?>scripts/pace.min.js"></script> <!-- <script src="--><?php //echo $config->urls->templates?><!--scripts/main.js"></script>--> <script src="<?php echo $config->urls->templates?>scripts/main-online.js"></script> <?php if ( isset( $additionalScriptFile ) ) { echo "<script src='{$config->urls->templates}/scripts/$additionalScriptFile'></script>"; } ?> </body> </html> Link to comment Share on other sites More sharing options...
fbg13 Posted July 27, 2017 Share Posted July 27, 2017 19 minutes ago, Andreas_D said: I can not change the title of the page How/where do you change it? What is it before/after the change? 21 minutes ago, Andreas_D said: no longer works What does this mean? Nothing shows up or do you get some error? <title><?php echo $title; ?></title> In your code you don't define $title anywhere. Maybe you want $page->title? 1 Link to comment Share on other sites More sharing options...
Christophe Posted July 28, 2017 Share Posted July 28, 2017 (edited) $title is defined in _init.php in the "templates" folder, isn't it? $title = $page->get('headline|title'); // headline if available, otherwise title Are you modifying the headline field or the title field? Edit: ... in the admin/backend? The browser page title, the header (h1...) page title, the parent page title...? Which "title" (field(s)) exactly doesn't change? Because you are using several ones in your code... Edited July 28, 2017 by Christophe 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now