2

I'm following the lithium facebook connect tutorial http://www.shift8creative.com/blog/facebook-connect-and-lithium

I get the following errors when i load my page

Notice: Undefined variable: html in /var/www/lithium/app/resources/tmp/cache/templates/template_views_signs_index.html_1175517_1299986110_1801.php on line 3`

and

Fatal error: Call to a member function script() on a non-object in /var/www/lithium/app/resources/tmp/cache/templates/template_views_signs_index.html_1175517_1299986110_1801.php on line 3

My Facebook.php page starts as follows

namespace facebook;
namespace \Exception;

And line 3 of my view

<?php $html->script('http://connect.facebook.net/en_US/all.js', array('inline' => false)); ?>

What may the error stem out of?

Eva611
  • 5,964
  • 8
  • 30
  • 38
  • I'm no lithium developer, but you did initialize `$html` right? and not just copy/pasted it as is? – ifaour Mar 13 '11 at 10:24
  • Yes I did... Line 2 is `` I still seem to get the same error. However if I put that declaration in line 3 right before `$html->script(...` the undefined variable notice goes away. If i initialize anywhere before in the document this should not happen right? I'm still not sure about the second part of the error thought. – Eva611 Mar 13 '11 at 18:50
  • `$html = ''` makes `$html` an empty string, not an object. – alex Mar 14 '11 at 05:50
  • ah, yes... recursion to convert to object ? – Eva611 Mar 14 '11 at 06:03
  • @Eva611: As I suspected, there should be a class in lithium that would initialize that variable, something like `$html = new LithiumHTMLClass();` or something (**P.S:** this is only an example!) – ifaour Mar 14 '11 at 08:10

1 Answers1

3

html is the HTML helper and isn't a magical variable anymore but can be reached using $this->html instead.

For more information, read the documentation about the lithium helpers

So just do:

<?= $this->html->script('//connect.facebook.net/en_US/all.js', /* … */) ?>
greut
  • 4,305
  • 1
  • 30
  • 49