title: Modify Stack in the Zend HeadScript View Helper
body: <p>I am trying to attack <a href="https://stackoverflow.com/questions/2253170/zend-framework-last-code-to-execute-before-layout-is-rendered">this problem</a> from a completely different angle, because it doesn't look like I can achieve my goal that way.</p>
  
  <p>I want to loop over the item stack in the <a href="http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.headscript" rel="nofollow noreferrer">HeadScript View Helper</a>, and make modifications to it.  <a href="http://framework.zend.com/manual/en/zend.view.helpers.html#zend.view.helpers.initial.headscript" rel="nofollow noreferrer">The documentation</a> for this and some of the other view helpers makes this statement:</p>
  
  <blockquote>
    <p>HeadScript overrides each of append(),
    offsetSet(), prepend(), and set() to
    enforce usage of the special methods
    as listed above. Internally, it stores
    each item as a stdClass  token, which
    it later serializes using the
    itemToString()  method. This allows
    you to perform checks on the items in
    the stack, and optionally modify these
    items by simply modifying the object
    returned.</p>
  </blockquote>
  
  <p>So, where is this "object returned"?  I am missing a piece of the puzzle here.</p>
  
  <p>Thanks for your help!</p>