Link to home
Start Free TrialLog in
Avatar of Larry Vollmer
Larry Vollmer

asked on

PHP question

I have this block of code

<?php
echo $html->css(
      '/hp_events/css/ftaf2',
      'stylesheet',
      array( 'media' => 'screen'));
?>

A coder told me to convert it using $this->html->css - but I am not sure if I am following what he means. can anyone help?
Avatar of Chad Smith
Chad Smith
Flag of United States of America image

echo $this->html->css(
      '/hp_events/css/ftaf2',
      'stylesheet',
      array( 'media' => 'screen'));
Avatar of Larry Vollmer
Larry Vollmer

ASKER

when I try that, i get this error:
Fatal error: Call to a member function css() on a non-object
I think the coder meant for you to put $this in from of the code, see below
<?php
echo $this->html->css(
      '/hp_events/css/ftaf2',
      'stylesheet',
      array( 'media' => 'screen'));
?>

Open in new window

that is what i first thought, but when i use that code i still get that error
this code is from calling a class, can you show us the class?
maybe it is  $this->css ? And what is the error message you are getting?
Fatal error: Call to a member function css() on a non-object
Oh duh, right, you did say that. Can we see the class?
im trying to figure out how to find that
Are you on a CMS, or custom coded website?
ASKER CERTIFIED SOLUTION
Avatar of nanharbison
nanharbison
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Any chance that you are working with a cakePHP site? are you trying that code inside a view (a .ctp file)?
yes this is cakephp and it is a .ctp template
the cap H worked - thanks! and yes this was cakephp