Using custom header for front (static) page

Hi, Im new to Sage but Ive got it set up fine so far (Im familiar with most of the tools, NPM,Bower, etc) but I am having a problem setting the basic layout. Using bootstrap 4 and have got the header/nav with navwalker, and footer set up, all using the default unchanged base.php wrapper file and the supplied header/footer templates with just the bootstrap markup in those. However I want to use a custom header (created and called custom-header) on the front page which is different to the header for all other pages. Using an if statement as below

 do_action('get_header'); 
  if (is_front_page()) {
  get_template_part('templates', 'custom-header');
  }else {
  get_template_part('templates/header'); 

shows an end of file error for php on line 43 of base .php(which is an empty line) although left as default there is no error and it pulls in the default header template.

Tips welcome Thanks

Additionally I am getting whitespace below the footer on front page but not on any other page, I presume this because either I dont have sidebar enabled on that page or simply that I havent added the custom css yet ?
Thanks

Ive also tried using front-page.php to pull in the custom header just for that page but it doesnt work. ?
Thanks

Could you copy/paste the whole file content perhaps? As I’m not sure if there is actually a syntax error or not.

<?php use Roots\Sage\Setup; use Roots\Sage\Wrapper; ?>

<!doctype html>

> <?php get_template_part('templates/head'); ?> > <?php do_action('get_header'); if (is_front_page()) { get_template_part('templates', 'custom-header'); }else { get_template_part('templates/header'); ?>
<?php include Wrapper\template_path(); ?> <?php if (Setup\display_sidebar()) : ?> <?php endif; ?>
<?php do_action('get_footer'); get_template_part('templates/footer'); wp_footer(); ?>

As above, it works fine using the default base, (it shows a front page w/o sidebar, 3 other pages with sidebar + a blog page with sidebar and search.

When I try the if/else to show the custom header on front page only it shows error “unexpected end of file” on line 40 which is actually empty.

Thanks

Your description indicates that the problem is with the if/else clause. Isn’t the else missing a closing } ?

What folbert says. There is missing an } as you use endif. Im only familiar with using endif in blade syntax. I would try something like this:

<?php
  get_template_part('templates/head');
  do_action('get_header');

  if (is_front_page()){
  	get_template_part('templates', 'custom-header');
  }else{
  	get_template_part('templates/header');
    include Wrapper\template_path();

	  if (Setup\display_sidebar()){
		  include Wrapper\sidebar_path();
	  }
  }
  
  do_action('get_footer'); get_template_part('templates/footer'); wp_footer();
 ?>