Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7615363
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T02:37:48+00:00 2026-05-31T02:37:48+00:00

So, I’m having this weird error: Catchable fatal error: Object of class Template_Standard could

  • 0

So, I’m having this weird error: Catchable fatal error: Object of class Template_Standard could not be converted to string in C:\wamp\www\game\template\standard\index.php on line 23

It’s basicly made up of these two files:

template_standard.php (functions file):

<?php
if (!defined('INCLUDED')) exit;

class Template_Standard
{
    public function print_login_text ()
    {
        global $user_functions, $path;
        if ($user_functions -> is_logged_in ())
        {
            return '<p>' . WELCOME_BACK . $_SESSION['username'] . '</p>';
        }
        else
        {
            return '<div id="login_form">
                <form action="' . $path . 'login" method="post">
                    <p>
                        <input type="text" name="name"/> ' . NAME . '<br/>
                        <input type="password" name="pass"/> ' . PASSWORD . '
                    </p>
                    <p><input type="submit" value="' . LOG_IN . '" class="button"/></p>
                    <p><a href="' . $path . 'register" onclick="get_register();return false">' . REGISTER . '</a></p>
                </form>
            </div>';
        }
    }

    public function print_menu ()
    {
        global $path;
        $html = '<ul id="menu">';
        $html .= '<li><a href="' . $path . '"><img src="' . $path . 'media/menu/home.png" width="100" height="35"/></a></li>';
        $html .= '<li><a href="' . $path . 'register"><img src="' . $path . 'media/menu/register.png" width="100" height="35"/></a></li>';
        $html .= '</ul>';
        return $html;
    }
}
?>

And the template file:

<?php
if (!defined('INCLUDED')) exit;

require '././functions/template_standard.php';
$template = new Template_Standard();

$register_form = '<form action="' . $path . 'register" method="post">\\
    <p>\\
        <input type="text" name="name"/> ' . NAME . '<br/>\\
        <input type="password" name="pass"/> ' . PASSWORD . '<br/>\\
        <input type="password" name="pass2"/> ' . PASSWORD_AGAIN . '<br/>\\
        <input type="text" name="email"/> ' . EMAIL . '<br/>\\
    </p>\\
    <p><input type="submit" value="' . REGISTER . '" class="button"/></p>\\
</form>';
$head .= <<<HTML
<link href="{$path}template/$template/style.css" rel="stylesheet" type="text/css"></link>
<!--[if lt IE 9]><style type="text/css">#content{border:1px solid #333;}</style><![endif]-->
<script type="text/javascript">
function get_register ()
{
    var speed = 'fast';
    var html = '$register_form'; // Error here
    $('#login_form').fadeOut(speed, function(){
        $('#login_form').html(html).fadeIn(speed);
    });
    return false;
}

$(document).ready(function(){
    if (screen.height < 768) {
        $('#footer').hide();
    } // Fourth error, and so on
}); // Third error here
</script> // If I remove the place with the first error, the second is here ...
HTML;
$body_start .= '<div id="content"><a href="' . $path . '"><div id="header"><img src="' . $path . 'media/header/logo.jpg" width="600" height="150"/></div></a><div id="menu-container">' . $template -> print_menu () . '</div><br style="clea:left"/><div id="content-left">';
$body_end .= '</div><div id="content-right">' . $template -> print_login_text() . '</div></div><div id="footer"><div style="float:right;text-align:right">Lorem ipsum ...</div>Copyright &copy; 2012 Jacob<br/>All rights reserved</div>';
?>

The thing is, if I remove the line with the error, it’ll just throw an error at another line inside the HTML things. Only way to resolve it is to remove everything in it.
Also, it works good if I have the functions directly in the template file.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T02:37:49+00:00Added an answer on May 31, 2026 at 2:37 am

    You use the $template variable as a string:

    <link href="{$path}template/$template/style.css" rel="stylesheet" type="text/css"></link>
    

    So PHP will try to convert the object to a string but it doesn’t find a __toString() method inside your class!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
Does anyone know how can I replace this 2 symbol below from the string
i got an object with contents of html markup in it, for example: string
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.