Click here to Skip to main content
14,937,943 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Writing a little shopping cart thing in raw php, but suddenly I get this problem.

(login file)
<?php

include("models/m_template.php"); 

$Template = new Template(); //Problem is here "Undefined type "Template"

$Template->load("views/v_login.php");


(Template class file)

<?
//Template Class - handless all templating tasks (displaying templates, alerts, errors)

class Template
{
    //Constructor
    function __construct() {}

    //Functions
    function load($url)
    {
        include($url);
    }
}


What I have tried:

I am building this shopping cart as a part of a "follow along" tutorial, which is several years old, I suppose the error is caused because modern php doesn't support what is used in older projects. But I'm not competent enough to figure out what it is exactly.
Posted
Updated 17-Dec-20 23:27pm
v2

1 solution

Try:
PHP
include 'models/m_template.php';



PHP include and require[^]
   
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900