So I'm trying to get my front-end static website to work with Magento backend. 
(I'm not that great at php)

My setup:

www.mywebsite.com/shop2 <-Magento

www.mywebsite.com/index.php <-Static front end

I have a file located at www.mywebsite.com/test.php that correctly displays the contents of my magento cart using the following code:

```
<?php

require_once(dirname(__FILE__).'/shop2/app/Mage.php');

$app = Mage::app();
$session = Mage::getSingleton('core/session', array('name'=>'frontend'));

$block = $app
->getLayout()
->getBlockSingleton('checkout/cart_sidebar')
->setTemplate('checkout/cart/sidebar.phtml');

echo $block->toHtml();

?>

```

However, when I insert the above code into my www.mywebsite.com/index.php sidebar area, it doesn't update with the cart contents of the website.

Any ideas why this would work in the test.php and not in my main index.php website?