Skip to content
This repository was archived by the owner on Jul 10, 2023. It is now read-only.
This repository was archived by the owner on Jul 10, 2023. It is now read-only.

Custom template controller issues. #5

@christianmagill

Description

@christianmagill

I've been running into issues with custom templates. Whether I am relying on naming the controller the same or setting the template property, the controller fails to send data to the view.

However, the standard page controller does send it's data.

Thanks for any help you can provide!

templates/faq.blade.php

{{--
  Template Name: Frequently Asked Questions
--}}

@extends('layouts.base')

@section('content')
  @while(have_posts()) @php(the_post())
  @include('partials.page-header')
  @include('partials.content-page')
  @endwhile
  {{ $faq or 'No $faq variable returned' }}<br/>
  {{ $page or 'No $page variable returned' }}
@endsection

controllers/faq.php

<?php
namespace App;
use Sober\Controller\Controller;

class Faq extends Controller
{
    /**
     * Protected methods will not be passed to the template
     */
    protected function hidden()
    {

    }
    public function faq()
    {
        return 'Testing FAQ Controller';
    }
}

controllers/page.php

<?php
namespace App;
use Sober\Controller\Controller;

class Page extends Controller
{
    /**
     * Protected methods will not be passed to the template
     */
    protected function hidden()
    {

    }
    public function page()
    {
        return 'Testing Page Controller';
    }
}

Outputs

No $faq variable returned
Testing Page Controller

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions